mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
* feat: add crew Testing/evalauting feature * feat: add docs and add unit test * feat: improve testing output table * feat: add tests * feat: fix type checking issue * feat: add raise ValueError when testing if output is not the expected * docs: add docs for Testing * feat: improve tests and fix some issue * feat: back to sync * feat: change opdeai model * feat: fix test
55 lines
1.4 KiB
Python
55 lines
1.4 KiB
Python
#!/usr/bin/env python
|
|
import sys
|
|
from {{folder_name}}.crew import {{crew_name}}Crew
|
|
|
|
# This main file is intended to be a way for your to run your
|
|
# crew locally, so refrain from adding necessary logic into this file.
|
|
# Replace with inputs you want to test with, it will automatically
|
|
# interpolate any tasks and agents information
|
|
|
|
def run():
|
|
"""
|
|
Run the crew.
|
|
"""
|
|
inputs = {
|
|
'topic': 'AI LLMs'
|
|
}
|
|
{{crew_name}}Crew().crew().kickoff(inputs=inputs)
|
|
|
|
|
|
def train():
|
|
"""
|
|
Train the crew for a given number of iterations.
|
|
"""
|
|
inputs = {
|
|
"topic": "AI LLMs"
|
|
}
|
|
try:
|
|
{{crew_name}}Crew().crew().train(n_iterations=int(sys.argv[1]), inputs=inputs)
|
|
|
|
except Exception as e:
|
|
raise Exception(f"An error occurred while training the crew: {e}")
|
|
|
|
def replay():
|
|
"""
|
|
Replay the crew execution from a specific task.
|
|
"""
|
|
try:
|
|
{{crew_name}}Crew().crew().replay(task_id=sys.argv[1])
|
|
|
|
except Exception as e:
|
|
raise Exception(f"An error occurred while replaying the crew: {e}")
|
|
|
|
def test():
|
|
"""
|
|
Test the crew execution and returns the results.
|
|
"""
|
|
inputs = {
|
|
"topic": "AI LLMs"
|
|
}
|
|
try:
|
|
{{crew_name}}Crew().crew().test(n_iterations=int(sys.argv[1]), openai_model_name=sys.argv[2], inputs=inputs)
|
|
|
|
except Exception as e:
|
|
raise Exception(f"An error occurred while replaying the crew: {e}")
|