fyodorov-llm-agents 0.3.2__py3-none-any.whl → 0.3.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fyodorov_llm_agents/agents/agent.py +4 -32
- fyodorov_llm_agents/tools/mcp_tool_service.py +2 -2
- {fyodorov_llm_agents-0.3.2.dist-info → fyodorov_llm_agents-0.3.4.dist-info}/METADATA +1 -1
- fyodorov_llm_agents-0.3.4.dist-info/RECORD +9 -0
- fyodorov_llm_agents-0.3.2.dist-info/RECORD +0 -9
- {fyodorov_llm_agents-0.3.2.dist-info → fyodorov_llm_agents-0.3.4.dist-info}/WHEEL +0 -0
- {fyodorov_llm_agents-0.3.2.dist-info → fyodorov_llm_agents-0.3.4.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,9 @@
|
|
1
1
|
import os
|
2
2
|
import re
|
3
|
-
import json
|
4
3
|
from pydantic import BaseModel, HttpUrl
|
5
4
|
from typing import Optional
|
6
5
|
import litellm
|
7
|
-
from fyodorov_llm_agents.tools.mcp_tool_service import MCPTool as ToolService
|
6
|
+
# from fyodorov_llm_agents.tools.mcp_tool_service import MCPTool as ToolService
|
8
7
|
from datetime import datetime
|
9
8
|
|
10
9
|
MAX_NAME_LENGTH = 80
|
@@ -135,38 +134,11 @@ class Agent(BaseModel):
|
|
135
134
|
{ "content": input, "role": "user"},
|
136
135
|
]
|
137
136
|
print(f"Tools: {self.tools}")
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
response = litellm.completion(model=model, messages=messages, max_retries=0, tools=tools, tool_choice="auto", base_url=base_url)
|
142
|
-
else:
|
143
|
-
print(f"calling litellm with model {model}, messages: {messages}, max_retries: 0, history: {history}, base_url: {base_url}")
|
144
|
-
response = litellm.completion(model=model, messages=messages, max_retries=0, base_url=base_url)
|
137
|
+
# tools
|
138
|
+
print(f"calling litellm with model {model}, messages: {messages}, max_retries: 0, history: {history}, base_url: {base_url}")
|
139
|
+
response = litellm.completion(model=model, messages=messages, max_retries=0, base_url=base_url)
|
145
140
|
print(f"Response: {response}")
|
146
141
|
answer = response.choices[0].message
|
147
|
-
if hasattr(response, 'tool_calls') and response.tool_calls:
|
148
|
-
for tool_call in response.tool_calls:
|
149
|
-
print(f"Calling function {tool_call.function.name}")
|
150
|
-
function_args = json.loads(tool_call.function.arguments)
|
151
|
-
tool = tools.get(tool_call.function.name)
|
152
|
-
ToolService.get
|
153
|
-
function_response = self.call_api(
|
154
|
-
url=function_args["url"],
|
155
|
-
method=function_args["method"],
|
156
|
-
body=function_args["body"],
|
157
|
-
)
|
158
|
-
messages.append(
|
159
|
-
{
|
160
|
-
"tool_call_id": tool_call.id,
|
161
|
-
"role": "tool",
|
162
|
-
"name": function_name,
|
163
|
-
"content": function_response,
|
164
|
-
}
|
165
|
-
) # extend conversation with function response
|
166
|
-
response = litellm.completion(
|
167
|
-
model=model,
|
168
|
-
messages=messages,
|
169
|
-
)
|
170
142
|
print(f"Answer: {answer}")
|
171
143
|
return {
|
172
144
|
"answer": answer,
|
@@ -62,10 +62,10 @@ class MCPTool():
|
|
62
62
|
raise e
|
63
63
|
|
64
64
|
@staticmethod
|
65
|
-
def
|
65
|
+
def get_by_name_and_user_id(access_token: str, handle: str, user_id: str) -> ToolModel:
|
66
66
|
try:
|
67
67
|
supabase = get_supabase(access_token)
|
68
|
-
result = supabase.table('mcp_tools').select('*').eq('user_id', user_id).eq('
|
68
|
+
result = supabase.table('mcp_tools').select('*').eq('user_id', user_id).eq('handle', handle).limit(1).execute()
|
69
69
|
tool_dict = result.data[0]
|
70
70
|
tool = ToolModel(**tool_dict)
|
71
71
|
return tool
|
@@ -0,0 +1,9 @@
|
|
1
|
+
fyodorov_llm_agents/agents/agent.py,sha256=YAtd7Z4SKmO9pYkDzjfH26HhD2fL40U1aJeRVBVmO0g,6511
|
2
|
+
fyodorov_llm_agents/agents/openai.py,sha256=FA5RS7yn3JwvFA8PXju60XSYC_2oUZFNgBUzeIYtGv0,1154
|
3
|
+
fyodorov_llm_agents/tools/mcp_tool_model.py,sha256=i7oFZReVGZsHN2K8T7mCAGF4t92wMMIR9mCkRHUgKsI,4413
|
4
|
+
fyodorov_llm_agents/tools/mcp_tool_service.py,sha256=9tDvSdKpEAOKKU5MHImUqTOc6MZyk1hEjs3GpzgQUsk,5542
|
5
|
+
fyodorov_llm_agents/tools/tool.py,sha256=HyOk0X_3XE23sa8J-8UZx657tJ0sxwZWMbA4OPxXU6E,7940
|
6
|
+
fyodorov_llm_agents-0.3.4.dist-info/METADATA,sha256=YAqKqTsnk5ckVSerLgni7dXmX-PwjxbVpmBnQjFc-bE,550
|
7
|
+
fyodorov_llm_agents-0.3.4.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
8
|
+
fyodorov_llm_agents-0.3.4.dist-info/top_level.txt,sha256=4QOslsBp8Gh7ng25DceA7fHp4KguTIdAxwURz97gH-g,20
|
9
|
+
fyodorov_llm_agents-0.3.4.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
fyodorov_llm_agents/agents/agent.py,sha256=NbjiyydsrNUdEQYZ_rR1YpAZ-oqRZqxKEwStWxOkxpE,8010
|
2
|
-
fyodorov_llm_agents/agents/openai.py,sha256=FA5RS7yn3JwvFA8PXju60XSYC_2oUZFNgBUzeIYtGv0,1154
|
3
|
-
fyodorov_llm_agents/tools/mcp_tool_model.py,sha256=i7oFZReVGZsHN2K8T7mCAGF4t92wMMIR9mCkRHUgKsI,4413
|
4
|
-
fyodorov_llm_agents/tools/mcp_tool_service.py,sha256=vfWrPOofi_n5k7Hs7bTpVyeLdDuZIWHF6tvK2CxdNjs,5539
|
5
|
-
fyodorov_llm_agents/tools/tool.py,sha256=HyOk0X_3XE23sa8J-8UZx657tJ0sxwZWMbA4OPxXU6E,7940
|
6
|
-
fyodorov_llm_agents-0.3.2.dist-info/METADATA,sha256=Wq826B6fu874n8I6T8JKlAlWODBqzmPa8zJ-YDMWw4A,550
|
7
|
-
fyodorov_llm_agents-0.3.2.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
8
|
-
fyodorov_llm_agents-0.3.2.dist-info/top_level.txt,sha256=4QOslsBp8Gh7ng25DceA7fHp4KguTIdAxwURz97gH-g,20
|
9
|
-
fyodorov_llm_agents-0.3.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|