Skip to content

Commit

Permalink
hotfix(agent): Wrong indentation preventing tool calls (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
RezaRahemtola authored Feb 24, 2025
1 parent d29c472 commit 9e8b37c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
32 changes: 15 additions & 17 deletions libertai_agents/libertai_agents/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,22 @@ async def generate_answer(
if not only_final_answer:
yield tool_calls_message

executed_calls = self.__execute_tool_calls(
tool_calls_message.tool_calls
executed_calls = self.__execute_tool_calls(tool_calls_message.tool_calls)
results = await asyncio.gather(*executed_calls)
tool_results_messages: list[Message] = [
ToolResponseMessage(
role="tool",
name=call.function.name,
tool_call_id=call.id,
content=str(results[i]),
)
results = await asyncio.gather(*executed_calls)
tool_results_messages: list[Message] = [
ToolResponseMessage(
role="tool",
name=call.function.name,
tool_call_id=call.id,
content=str(results[i]),
)
for i, call in enumerate(tool_calls_message.tool_calls)
]
if not only_final_answer:
for tool_result_message in tool_results_messages:
yield tool_result_message
# Doing the next iteration of the loop with the results to make other tool calls or to answer
messages = messages + tool_results_messages
for i, call in enumerate(tool_calls_message.tool_calls)
]
if not only_final_answer:
for tool_result_message in tool_results_messages:
yield tool_result_message
# Doing the next iteration of the loop with the results to make other tool calls or to answer
messages = messages + tool_results_messages

async def __api_generate_answer(
self,
Expand Down
2 changes: 1 addition & 1 deletion libertai_agents/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "libertai-agents"
version = "0.1.4"
version = "0.1.5"
description = "Framework to create and deploy decentralized agents"
authors = ["LibertAI.io team <hello@libertai.io>"]
readme = "README.md"
Expand Down

0 comments on commit 9e8b37c

Please sign in to comment.