Skip to content

Commit

Permalink
Fix model name
Browse files Browse the repository at this point in the history
  • Loading branch information
bonk1t committed Dec 26, 2024
1 parent a7f02ee commit fc8ca07
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 11 additions & 1 deletion agency_swarm/threads/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from agency_swarm.util.tracking import get_callback_handler
from agency_swarm.util.tracking.langchain_types import (
AgentAction,
AgentFinish,
HumanMessage,
)

Expand Down Expand Up @@ -297,6 +296,11 @@ def _create_run(
response_format: dict | None = None,
):
try:
model_name = (
self.agent.model
if isinstance(self.agent, Agent)
else recipient_agent.model
)
if event_handler:
with self.client.beta.threads.runs.stream(
thread_id=self.id,
Expand All @@ -315,6 +319,7 @@ def _create_run(
"sender_agent_name": self.agent.name,
"recipient_agent_name": recipient_agent.name,
"run_status": "created",
"ls_model_name": model_name,
},
response_format=response_format,
) as stream:
Expand All @@ -336,6 +341,7 @@ def _create_run(
"sender_agent_name": self.agent.name,
"recipient_agent_name": recipient_agent.name,
"run_status": "created",
"ls_model_name": model_name,
},
)
self._run = self.client.beta.threads.runs.poll(
Expand Down Expand Up @@ -500,6 +506,7 @@ def execute_tool(
"agent_name": self.agent.name,
"recipient_agent_name": recipient_agent.name,
"run_status": self._run.status,
"ls_model_name": self._run.model,
},
)

Expand All @@ -522,6 +529,7 @@ def execute_tool(
"agent_name": self.agent.name,
"recipient_agent_name": recipient_agent.name,
"run_status": self._run.status,
"ls_model_name": self._run.model,
},
)

Expand Down Expand Up @@ -914,6 +922,7 @@ def _on_chain_start(
"agent_name": self.agent.name,
"recipient_agent_name": recipient_agent.name,
"run_status": self._run.status,
"ls_model_name": self._run.model,
},
)

Expand All @@ -939,6 +948,7 @@ def _on_chat_model_start(
"agent_name": self.agent.name,
"recipient_agent_name": recipient_agent.name,
"run_status": self._run.status,
"ls_model_name": self._run.model,
},
invocation_params={
"_type": "openai",
Expand Down
1 change: 0 additions & 1 deletion agency_swarm/util/tracking/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def init_tracking(tracker_name: SUPPORTED_TRACKERS_TYPE, **kwargs):
from agentops import LangchainCallbackHandler

handler_class = LangchainCallbackHandler
kwargs["ignore_chat_model"] = True

elif tracker_name == "langfuse":
from langfuse.callback import CallbackHandler
Expand Down

0 comments on commit fc8ca07

Please sign in to comment.