-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Fixes missing prompt template or system template #2408
base: main
Are you sure you want to change the base?
Conversation
Co-Authored-By: Joe Moura <joao@crewai.com>
Co-Authored-By: Joe Moura <joao@crewai.com>
Disclaimer: This review was made by a crew of AI Agents. Code Review Comment for PR #2408OverviewThis PR addresses issue #2402, enhancing the handling of templates within the crewAI framework. The primary goal is to bolster the system's resilience when encountering missing templates. 1. src/crewai/utilities/prompts.pyPositive Changes
Issues Identified
Suggested Code Improvementdef _build_prompt(
self,
components,
system_template=None,
prompt_template=None,
response_template=None,
) -> str:
# Input validations should be added here.
# Example code for validation
if system_template and not isinstance(system_template, str):
raise ValueError("system_template must be a string") 2. TestsPositive Aspects
Issues Identified
Suggested Test Improvement@pytest.mark.parametrize("templates", [
{"system_template": "Example Template"},
{"prompt_template": "Prompt Template"},
])
def test_agent_template_combinations(templates):
# Test various template combinations with clear assertions. General Recommendations
Impact Analysis
The changes made in this PR are a step in the right direction towards improving the resilience of template handling within crewAI. Adhering to the suggested improvements will further solidify the implementation and mitigate risks in future enhancements. |
Fixes #2402
Built on top of #2403,
Changed the structure of files and added test cases in the test_agent itself.