Skip to content

Commit ae183d7

Browse files
committed
1) change back to non parallel function calling, 2) change llm backend for io_agent
1 parent 41fc4d2 commit ae183d7

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

litemultiagent/agents/base.py

+7-14
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
from openai import OpenAI
44
import json
55
from concurrent.futures import ThreadPoolExecutor, as_completed
6-
#from litemultiagent.config.agent_config import agent_to_model, model_cost
7-
# from litemultiagent.agents.base import BaseAgent
8-
# from litemultiagent.tools.registry import ToolRegistry, Tool
96
from supabase import create_client, Client
107
from litellm import completion
118
import os
@@ -45,7 +42,7 @@
4542
"tool_choice" : "auto",
4643
},
4744
"io_agent": {
48-
"model_name" : "gpt-4o-mini",
45+
"model_name" : "claude-3-5-sonnet-20240620",
4946
"tool_choice" : "auto",
5047
},
5148
"retrieval_agent": {
@@ -116,7 +113,7 @@ def _send_completion_request(self, depth: int = 0) -> str:
116113
if self.save_to == "csv":
117114
self._save_to_csv(response, depth)
118115
message = response.choices[0].message
119-
self.messages.append(message)
116+
self.messages.append(message.model_dump())
120117
return message.content
121118

122119
response = completion(
@@ -137,7 +134,7 @@ def _send_completion_request(self, depth: int = 0) -> str:
137134

138135
if tool_calls is None or len(tool_calls) == 0:
139136
message = response.choices[0].message
140-
self.messages.append(message)
137+
self.messages.append(message.model_dump())
141138
return message.content
142139

143140
tool_call_message = {
@@ -156,14 +153,10 @@ def _process_tool_calls(self, tool_calls: List[Dict[str, Any]]) -> List[Dict[str
156153
tool_call_responses = []
157154
logger.info(f"Number of function calls: {len(tool_calls)}")
158155

159-
with ThreadPoolExecutor(max_workers=None) as executor:
160-
future_to_tool_call = {executor.submit(self._process_single_tool_call, tool_call): tool_call for tool_call
161-
in tool_calls}
162-
163-
for future in as_completed(future_to_tool_call):
164-
result = future.result()
165-
if result:
166-
tool_call_responses.append(result)
156+
for tool_call in tool_calls:
157+
result = self._process_single_tool_call(tool_call)
158+
if result:
159+
tool_call_responses.append(result)
167160

168161
return tool_call_responses
169162

litemultiagent/main.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,19 @@ def main():
152152
main_agent = agent_manager.get_agent(main_agent_config)
153153

154154
# # # Example usage
155-
# task = "generate a image of a ginger cat and save it as ginger_cat.png"
156-
# result = main_agent.execute(task)
157-
# print("IO Agent Result:", result)
158-
#
159-
# task = "write python script to calculate the sum from 1 to 10, and run the python script to get result"
160-
# result = main_agent.execute(task)
161-
# print("IO Agent Result:", result)
155+
task = "generate a image of a ginger cat and save it as ginger_cat.png"
156+
result = main_agent.execute(task)
157+
print("IO Agent Result:", result)
158+
159+
task = "write python script to calculate the sum from 1 to 10, and run the python script to get result"
160+
result = main_agent.execute(task)
161+
print("IO Agent Result:", result)
162162

163163
task = "browse web to search and check the brands of dining table, and summarize the results in a table, save the table into a markdown file called summary.md"
164164
result = main_agent.execute(task)
165165
print("IO Agent Result:", result)
166166

167+
168+
167169
if __name__ == "__main__":
168170
main()

0 commit comments

Comments
 (0)