mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-02 15:52:34 +00:00
Enhance markdown feature based on PR feedback
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -526,10 +526,14 @@ class Task(BaseModel):
|
||||
return guardrail_result
|
||||
|
||||
def prompt(self) -> str:
|
||||
"""Prompt the task.
|
||||
|
||||
"""Generates the task prompt with optional markdown formatting.
|
||||
|
||||
When the markdown attribute is True, instructions for formatting the
|
||||
response in Markdown syntax will be added to the prompt.
|
||||
|
||||
Returns:
|
||||
Prompt of the task.
|
||||
str: The formatted prompt string containing the task description,
|
||||
expected output, and optional markdown formatting instructions.
|
||||
"""
|
||||
tasks_slices = [self.description]
|
||||
|
||||
@@ -539,9 +543,15 @@ class Task(BaseModel):
|
||||
tasks_slices = [self.description, output]
|
||||
|
||||
if self.markdown:
|
||||
markdown_instruction = "Your final answer MUST be formatted in Markdown syntax."
|
||||
markdown_instruction = """Your final answer MUST be formatted in Markdown syntax.
|
||||
Follow these guidelines:
|
||||
- Use # for headers
|
||||
- Use ** for bold text
|
||||
- Use * for italic text
|
||||
- Use - or * for bullet points
|
||||
- Use `code` for inline code
|
||||
- Use ```language for code blocks"""
|
||||
tasks_slices.append(markdown_instruction)
|
||||
|
||||
return "\n".join(tasks_slices)
|
||||
|
||||
def interpolate_inputs_and_add_conversation_history(
|
||||
|
||||
Reference in New Issue
Block a user