Skip to content

Commit

Permalink
fix: Handle empty tools
Browse files Browse the repository at this point in the history
  • Loading branch information
whiterabbit1983 committed Sep 13, 2024
1 parent 6db5e4c commit 9118d86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion agents-api/agents_api/common/protocol/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def get_active_tools(self) -> list[Tool]:
active_agent = self.get_active_agent()
try:
active_toolset = next(
toolset for toolset in self.toolsets if toolset.agent_id == active_agent.id
toolset
for toolset in self.toolsets
if toolset.agent_id == active_agent.id
)
except StopIteration:
return []
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/routers/sessions/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def chat(
# Get the response from the model
model_response = await litellm.acompletion(
messages=messages,
tools=tools,
tools=tools or None,
user=str(developer.id), # For tracking usage
tags=developer.tags, # For filtering models in litellm
**settings,
Expand Down

0 comments on commit 9118d86

Please sign in to comment.