Skip to content

Commit 776f374

Browse files
committed
Minor fixes
1 parent 7816165 commit 776f374

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/examples/crewai_example/simple_agent/agents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
)

src/examples/crewai_example/simple_agent/main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import sys
2+
3+
sys.path.insert(0, '/Users/karthikkalyanaraman/work/langtrace/langtrace-python-sdk/src')
4+
15
from 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
58
from langtrace_python_sdk import langtrace
69
from dotenv import load_dotenv
7-
import agentops
810

911
load_dotenv()
1012
langtrace.init()

src/langtrace_python_sdk/instrumentation/crewai/patch.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)