File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed
examples/crewai_example/simple_agent
langtrace_python_sdk/instrumentation/crewai Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -28,5 +28,5 @@ def create_poet_agent(self):
2828 goal = """Create a poem that captures the essence of a given theme or emotion""" ,
2929 allow_delegation = False ,
3030 verbose = True ,
31- llm = self .ollama ,
31+ llm = self .open_ai ,
3232 )
Original file line number Diff line number Diff line change 1+ import sys
2+
3+ sys .path .insert (0 , '/Users/karthikkalyanaraman/work/langtrace/langtrace-python-sdk/src' )
4+
15from crewai import Crew
2- from textwrap import dedent
3- from .agents import PoetryAgents
4- from .tasks import PoetryTasks
6+ from agents import PoetryAgents
7+ from tasks import PoetryTasks
58from langtrace_python_sdk import langtrace
69from dotenv import load_dotenv
7- import agentops
810
911load_dotenv ()
1012langtrace .init ()
Original file line number Diff line number Diff line change @@ -197,6 +197,12 @@ def set_task_attributes(self):
197197
198198 def _parse_agents (self , agents ):
199199 for agent in agents :
200+ model = None
201+ if agent .llm is not None :
202+ if hasattr (agent .llm , "model" ):
203+ model = agent .llm .model
204+ elif hasattr (agent .llm , "model_name" ):
205+ model = agent .llm .model_name
200206 self .crew ["agents" ].append (
201207 {
202208 "id" : str (agent .id ),
@@ -209,7 +215,7 @@ def _parse_agents(self, agents):
209215 "allow_delegation" : agent .allow_delegation ,
210216 "tools" : agent .tools ,
211217 "max_iter" : agent .max_iter ,
212- "llm" : str (agent . llm . model ),
218+ "llm" : str (model if model is not None else "" ),
213219 }
214220 )
215221
You can’t perform that action at this time.
0 commit comments