Update agents/crew.py
Browse files- agents/crew.py +11 -5
agents/crew.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
# https://docs.crewai.com/introduction
|
| 4 |
# https://arize.com/docs/phoenix/integrations/python/crewai/crewai-tracing
|
| 5 |
|
| 6 |
-
import os
|
| 7 |
from agents.models.llms import (
|
| 8 |
LLM_CREW_MANAGER,
|
| 9 |
LLM_CREW_PLANNING,
|
|
@@ -54,6 +54,8 @@ tracer_provider = register(
|
|
| 54 |
set_global_tracer_provider=True
|
| 55 |
)
|
| 56 |
|
|
|
|
|
|
|
| 57 |
@CrewBase
|
| 58 |
class GAIACrew():
|
| 59 |
agents: List[BaseAgent]
|
|
@@ -229,12 +231,13 @@ class GAIACrew():
|
|
| 229 |
return Crew(
|
| 230 |
agents=self.agents,
|
| 231 |
tasks=self.tasks,
|
| 232 |
-
process=Process.sequential,
|
| 233 |
-
manager_llm=LLM_CREW_MANAGER,
|
| 234 |
planning_llm=LLM_CREW_PLANNING,
|
| 235 |
planning=PLANNING_CREW,
|
| 236 |
memory=MEMORY_CREW,
|
| 237 |
-
verbose=VERBOSE_CREW
|
|
|
|
| 238 |
)
|
| 239 |
|
| 240 |
def run_crew(question, file_path):
|
|
@@ -250,7 +253,10 @@ def run_crew(question, file_path):
|
|
| 250 |
print(f"π€ Initial question: {question}")
|
| 251 |
print(f"π€ Final question: {final_question}")
|
| 252 |
|
| 253 |
-
|
|
|
|
|
|
|
|
|
|
| 254 |
final_answer = AITools.get_final_answer(question, str(answer))
|
| 255 |
|
| 256 |
print(f"π€ Initial answer: {answer}")
|
|
|
|
| 3 |
# https://docs.crewai.com/introduction
|
| 4 |
# https://arize.com/docs/phoenix/integrations/python/crewai/crewai-tracing
|
| 5 |
|
| 6 |
+
import logging, os
|
| 7 |
from agents.models.llms import (
|
| 8 |
LLM_CREW_MANAGER,
|
| 9 |
LLM_CREW_PLANNING,
|
|
|
|
| 54 |
set_global_tracer_provider=True
|
| 55 |
)
|
| 56 |
|
| 57 |
+
logging.getLogger("openinference").setLevel(logging.CRITICAL)
|
| 58 |
+
|
| 59 |
@CrewBase
|
| 60 |
class GAIACrew():
|
| 61 |
agents: List[BaseAgent]
|
|
|
|
| 231 |
return Crew(
|
| 232 |
agents=self.agents,
|
| 233 |
tasks=self.tasks,
|
| 234 |
+
process=Process.sequential,
|
| 235 |
+
manager_llm=LLM_CREW_MANAGER,
|
| 236 |
planning_llm=LLM_CREW_PLANNING,
|
| 237 |
planning=PLANNING_CREW,
|
| 238 |
memory=MEMORY_CREW,
|
| 239 |
+
verbose=VERBOSE_CREW,
|
| 240 |
+
tracing=False # Arize Phoenix
|
| 241 |
)
|
| 242 |
|
| 243 |
def run_crew(question, file_path):
|
|
|
|
| 253 |
print(f"π€ Initial question: {question}")
|
| 254 |
print(f"π€ Final question: {final_question}")
|
| 255 |
|
| 256 |
+
print(f"π€ Crew started")
|
| 257 |
+
answer = GAIACrew().crew().kickoff(inputs={"question": final_question})
|
| 258 |
+
print(f"π€ Crew completed")
|
| 259 |
+
|
| 260 |
final_answer = AITools.get_final_answer(question, str(answer))
|
| 261 |
|
| 262 |
print(f"π€ Initial answer: {answer}")
|