fyodorov-llm-agents 0.4.11__py3-none-any.whl → 0.4.13__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_model.py +2 -2
- fyodorov_llm_agents/instances/instance_service.py +2 -2
- fyodorov_llm_agents/tools/mcp_tool_service.py +18 -14
- {fyodorov_llm_agents-0.4.11.dist-info → fyodorov_llm_agents-0.4.13.dist-info}/METADATA +1 -1
- {fyodorov_llm_agents-0.4.11.dist-info → fyodorov_llm_agents-0.4.13.dist-info}/RECORD +7 -7
- {fyodorov_llm_agents-0.4.11.dist-info → fyodorov_llm_agents-0.4.13.dist-info}/WHEEL +0 -0
- {fyodorov_llm_agents-0.4.11.dist-info → fyodorov_llm_agents-0.4.13.dist-info}/top_level.txt +0 -0
@@ -72,7 +72,7 @@ class Agent(BaseModel):
|
|
72
72
|
# 'rag': self.rag,
|
73
73
|
# }
|
74
74
|
|
75
|
-
def call_with_fn_calling(self, input: str = "", history = [], user_id: str = "") -> dict:
|
75
|
+
async def call_with_fn_calling(self, input: str = "", history = [], user_id: str = "") -> dict:
|
76
76
|
litellm.set_verbose = True
|
77
77
|
model = self.model
|
78
78
|
# Set environmental variable
|
@@ -101,7 +101,7 @@ class Agent(BaseModel):
|
|
101
101
|
mcp_tools = []
|
102
102
|
for tool in self.tools:
|
103
103
|
try:
|
104
|
-
tool_instance = ToolService.get_by_name_and_user_id(tool, user_id)
|
104
|
+
tool_instance = await ToolService.get_by_name_and_user_id(tool, user_id)
|
105
105
|
mcp_tools.append(tool_instance)
|
106
106
|
except Exception as e:
|
107
107
|
print(f"Error fetching tool {tool}: {e}")
|
@@ -28,10 +28,10 @@ class Instance(InstanceModel):
|
|
28
28
|
agent.api_url = provider.api_url
|
29
29
|
for index, tool in enumerate(agent.tools):
|
30
30
|
if isinstance(tool, str):
|
31
|
-
agent.tools[index] = ToolService.get_by_name_and_user_id(access_token, tool, user_id)
|
31
|
+
agent.tools[index] = await ToolService.get_by_name_and_user_id(access_token, tool, user_id)
|
32
32
|
print(f"Tool fetched via Tool.get_by_name_and_user_id in chat_w_fn_calls: {agent.tools[index]}")
|
33
33
|
agent.prompt += f"\n\n{agent.tools[index].handle}: {agent.tools[index].description}\n\n"
|
34
|
-
res = agent.call_with_fn_calling(input=input, history=self.chat_history, user_id=user_id)
|
34
|
+
res = await agent.call_with_fn_calling(input=input, history=self.chat_history, user_id=user_id)
|
35
35
|
self.chat_history.append({
|
36
36
|
"role": "user",
|
37
37
|
"content": input
|
@@ -5,27 +5,31 @@ from .mcp_tool_model import MCPTool as ToolModel
|
|
5
5
|
class MCPTool():
|
6
6
|
|
7
7
|
@staticmethod
|
8
|
-
def create_or_update_in_db(access_token: str, tool: ToolModel, user_id: str) -> str:
|
8
|
+
async def create_or_update_in_db(access_token: str, tool: ToolModel, user_id: str) -> str:
|
9
9
|
print(f"Creating or updating tool with handle {tool.handle} for user {user_id}")
|
10
10
|
tool_w_id = MCPTool.get_by_name_and_user_id(access_token, tool.handle, user_id)
|
11
11
|
if tool_w_id:
|
12
12
|
print(f"Tool with handle {tool.handle} already exists, updating it.")
|
13
|
-
return MCPTool.update_in_db(access_token, tool_w_id.id, tool)
|
13
|
+
return await MCPTool.update_in_db(access_token, tool_w_id.id, tool)
|
14
14
|
else:
|
15
15
|
print(f"Tool with handle {tool.handle} does not exist, creating it.")
|
16
|
-
return MCPTool.create_in_db(access_token, tool, user_id)
|
16
|
+
return await MCPTool.create_in_db(access_token, tool, user_id)
|
17
17
|
|
18
18
|
@staticmethod
|
19
|
-
def create_in_db(access_token: str, tool: ToolModel, user_id: str) -> str:
|
19
|
+
async def create_in_db(access_token: str, tool: ToolModel, user_id: str) -> str:
|
20
20
|
try:
|
21
21
|
supabase = get_supabase(access_token)
|
22
22
|
tool_dict = tool.to_dict()
|
23
23
|
tool_dict['user_id'] = user_id
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
if 'id' in tool_dict:
|
25
|
+
del tool_dict['id']
|
26
|
+
if 'created_at' in tool_dict:
|
27
|
+
del tool_dict['created_at']
|
28
|
+
if 'updated_at' in tool_dict:
|
29
|
+
del tool_dict['updated_at']
|
27
30
|
print('creating tool in db', tool_dict)
|
28
31
|
result = supabase.table('mcp_tools').insert(tool_dict).execute()
|
32
|
+
print('created tool in db', result)
|
29
33
|
tool_id = result.data[0]['id']
|
30
34
|
return tool_id
|
31
35
|
except Exception as e:
|
@@ -33,7 +37,7 @@ class MCPTool():
|
|
33
37
|
raise e
|
34
38
|
|
35
39
|
@staticmethod
|
36
|
-
def update_in_db(access_token: str, id: str, tool: ToolModel) -> dict:
|
40
|
+
async def update_in_db(access_token: str, id: str, tool: ToolModel) -> dict:
|
37
41
|
if not id:
|
38
42
|
raise ValueError('Tool ID is required')
|
39
43
|
try:
|
@@ -47,7 +51,7 @@ class MCPTool():
|
|
47
51
|
raise
|
48
52
|
|
49
53
|
@staticmethod
|
50
|
-
def delete_in_db(access_token: str, id: str) -> bool:
|
54
|
+
async def delete_in_db(access_token: str, id: str) -> bool:
|
51
55
|
if not id:
|
52
56
|
raise ValueError('Tool ID is required')
|
53
57
|
try:
|
@@ -60,7 +64,7 @@ class MCPTool():
|
|
60
64
|
raise e
|
61
65
|
|
62
66
|
@staticmethod
|
63
|
-
def get_in_db(access_token: str, id: str) -> ToolModel:
|
67
|
+
async def get_in_db(access_token: str, id: str) -> ToolModel:
|
64
68
|
if not id:
|
65
69
|
raise ValueError('Tool ID is required')
|
66
70
|
try:
|
@@ -74,7 +78,7 @@ class MCPTool():
|
|
74
78
|
raise e
|
75
79
|
|
76
80
|
@staticmethod
|
77
|
-
def get_by_name_and_user_id(access_token: str, handle: str, user_id: str) -> ToolModel:
|
81
|
+
async def get_by_name_and_user_id(access_token: str, handle: str, user_id: str) -> ToolModel:
|
78
82
|
try:
|
79
83
|
supabase = get_supabase(access_token)
|
80
84
|
result = supabase.table('mcp_tools').select('*').eq('user_id', user_id).eq('handle', handle).limit(1).execute()
|
@@ -92,7 +96,7 @@ class MCPTool():
|
|
92
96
|
raise e
|
93
97
|
|
94
98
|
@staticmethod
|
95
|
-
def get_all_in_db(access_token: str, user_id: str = None, limit: int = 10, created_at_lt: datetime = datetime.now()) -> list[dict]:
|
99
|
+
async def get_all_in_db(access_token: str, user_id: str = None, limit: int = 10, created_at_lt: datetime = datetime.now()) -> list[dict]:
|
96
100
|
try:
|
97
101
|
supabase = get_supabase(access_token)
|
98
102
|
print('getting tools from db for user', user_id)
|
@@ -118,7 +122,7 @@ class MCPTool():
|
|
118
122
|
raise e
|
119
123
|
|
120
124
|
@staticmethod
|
121
|
-
def get_tool_agents(access_token: str, id: str) -> list[int]:
|
125
|
+
async def get_tool_agents(access_token: str, id: str) -> list[int]:
|
122
126
|
if not id:
|
123
127
|
raise ValueError('Tool ID is required')
|
124
128
|
try:
|
@@ -131,7 +135,7 @@ class MCPTool():
|
|
131
135
|
raise
|
132
136
|
|
133
137
|
@staticmethod
|
134
|
-
def set_tool_agents(access_token: str, id: str, agent_ids: list[int]) -> list[int]:
|
138
|
+
async def set_tool_agents(access_token: str, id: str, agent_ids: list[int]) -> list[int]:
|
135
139
|
if not id:
|
136
140
|
raise ValueError('Tool ID is required')
|
137
141
|
try:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fyodorov_llm_agents
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.13
|
4
4
|
Summary: LLM agents for the Fyodorov AI suite
|
5
5
|
Author-email: Daniel Ransom <02masseur.alibis@icloud.com>
|
6
6
|
Project-URL: Homepage, https://github.com/FyodorovAI/fyodorov-llm-agents
|
@@ -1,16 +1,16 @@
|
|
1
|
-
fyodorov_llm_agents/agents/agent_model.py,sha256=
|
1
|
+
fyodorov_llm_agents/agents/agent_model.py,sha256=UN8KJvPWsoiatBM3Pw0X8bt0G0pGJeEf4vOTMBITnKU,6839
|
2
2
|
fyodorov_llm_agents/agents/agent_service.py,sha256=-55RDait3eZGFfYWGNLGoa06WMcdiBnkzpa7BnWW10Q,6016
|
3
3
|
fyodorov_llm_agents/agents/openai.py,sha256=FA5RS7yn3JwvFA8PXju60XSYC_2oUZFNgBUzeIYtGv0,1154
|
4
4
|
fyodorov_llm_agents/instances/instance_model.py,sha256=PQaoVSH9H4qp_wcLvyT_QgvNtwf9oehOxZaGI6mv1bA,1206
|
5
|
-
fyodorov_llm_agents/instances/instance_service.py,sha256=
|
5
|
+
fyodorov_llm_agents/instances/instance_service.py,sha256=QolwEosIH5MEVNdAcmPa4pB3cuDyygvOdNFIERRLquc,8468
|
6
6
|
fyodorov_llm_agents/models/llm_model.py,sha256=aQtXtB7kRpnVdbPu-nmTGAaflbtKz3DPkgcckf1srsg,1645
|
7
7
|
fyodorov_llm_agents/models/llm_service.py,sha256=35bS0RFXJhJUSjge-v4u5cftn_MT-CmcDuWnC2kCnJo,4008
|
8
8
|
fyodorov_llm_agents/providers/provider_model.py,sha256=OyCK6WMRhyElsp88gILg0wso-OPHI7f55gEeypsJ7O0,957
|
9
9
|
fyodorov_llm_agents/providers/provider_service.py,sha256=GST-NLV8aLPsvapQEvgT_qHGYu7IpS5Xsut60XFmD-g,5865
|
10
10
|
fyodorov_llm_agents/tools/mcp_tool_model.py,sha256=nGdPmqSkA7hqDUTPbNCZAHNSVJCgVOs5dzJfPntLidI,5110
|
11
|
-
fyodorov_llm_agents/tools/mcp_tool_service.py,sha256=
|
11
|
+
fyodorov_llm_agents/tools/mcp_tool_service.py,sha256=XFm6mVy3QHmJhquPapZb7qo_bhftBTrtXURe7alBRQY,6972
|
12
12
|
fyodorov_llm_agents/tools/tool.py,sha256=HyOk0X_3XE23sa8J-8UZx657tJ0sxwZWMbA4OPxXU6E,7940
|
13
|
-
fyodorov_llm_agents-0.4.
|
14
|
-
fyodorov_llm_agents-0.4.
|
15
|
-
fyodorov_llm_agents-0.4.
|
16
|
-
fyodorov_llm_agents-0.4.
|
13
|
+
fyodorov_llm_agents-0.4.13.dist-info/METADATA,sha256=MnLvh8NTB-zhvRe2Wdlm0GiECOZr21v1rN24cj_9Og4,551
|
14
|
+
fyodorov_llm_agents-0.4.13.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
15
|
+
fyodorov_llm_agents-0.4.13.dist-info/top_level.txt,sha256=4QOslsBp8Gh7ng25DceA7fHp4KguTIdAxwURz97gH-g,20
|
16
|
+
fyodorov_llm_agents-0.4.13.dist-info/RECORD,,
|
File without changes
|
File without changes
|