Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Implement Jinja2 Template Support for Task Descriptions to Enhance Flexibility in Prompt Assembly #1799

Open
hardfish82 opened this issue Dec 24, 2024 · 1 comment
Labels
feature-request New feature or request

Comments

@hardfish82
Copy link

Feature Area

Task management

Is your feature request related to a an existing bug? Please link it here.

no

Describe the solution you'd like

Hello,

I would like to propose a feature request for CrewAI to support Jinja2 template formatting in task descriptions. This would greatly increase the flexibility and dynamism in how we assemble task prompts.

Current Situation:
At present, CrewAI's task prompts only supports string replacement, which limits our ability to dynamically adjust prompts based on specific conditions or variables.

Requested Feature:
I suggest that CrewAI supports Jinja2 templates, allowing us to incorporate variables and conditional logic into task descriptions. Jinja2 is a powerful templating engine that enables us to generate task prompts dynamically based on the context.

Expected Benefits:
Increased Flexibility: The ability to customize prompts based on specific task requirements and user inputs.
Enhanced Dynamism: The capability to adjust prompt content dynamically based on real-time data or user interactions.
Improved User Experience: Users will see more personalized and context-relevant task prompts.

Example:

Dear User,
{% if user.is_first_time %}
Welcome to CrewAI! We are delighted that you have chosen us to assist you with your tasks.
{% else %}
Great to see you again! We hope to continue assisting you today.
{% endif %}
Please follow the instructions below to complete the task:
...

I hope this feature can be considered for inclusion in CrewAI, as I believe it will greatly enhance our product experience.

Thank you!

Describe alternatives you've considered

Add another field to compose the final prompt, which support jinja2 template format.

Additional context

No response

Willingness to Contribute

No, I'm just suggesting the idea

@hardfish82 hardfish82 added the feature-request New feature or request label Dec 24, 2024
@hardfish82
Copy link
Author

I have made modifications to the code based on version 0.86.0 locally. The difference is in the attachment.
文本比较(T).pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant