fyodorov-llm-agents 0.4.12__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.
@@ -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,18 +5,18 @@ 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()
@@ -29,6 +29,7 @@ class MCPTool():
29
29
  del tool_dict['updated_at']
30
30
  print('creating tool in db', tool_dict)
31
31
  result = supabase.table('mcp_tools').insert(tool_dict).execute()
32
+ print('created tool in db', result)
32
33
  tool_id = result.data[0]['id']
33
34
  return tool_id
34
35
  except Exception as e:
@@ -36,7 +37,7 @@ class MCPTool():
36
37
  raise e
37
38
 
38
39
  @staticmethod
39
- 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:
40
41
  if not id:
41
42
  raise ValueError('Tool ID is required')
42
43
  try:
@@ -50,7 +51,7 @@ class MCPTool():
50
51
  raise
51
52
 
52
53
  @staticmethod
53
- def delete_in_db(access_token: str, id: str) -> bool:
54
+ async def delete_in_db(access_token: str, id: str) -> bool:
54
55
  if not id:
55
56
  raise ValueError('Tool ID is required')
56
57
  try:
@@ -63,7 +64,7 @@ class MCPTool():
63
64
  raise e
64
65
 
65
66
  @staticmethod
66
- def get_in_db(access_token: str, id: str) -> ToolModel:
67
+ async def get_in_db(access_token: str, id: str) -> ToolModel:
67
68
  if not id:
68
69
  raise ValueError('Tool ID is required')
69
70
  try:
@@ -77,7 +78,7 @@ class MCPTool():
77
78
  raise e
78
79
 
79
80
  @staticmethod
80
- 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:
81
82
  try:
82
83
  supabase = get_supabase(access_token)
83
84
  result = supabase.table('mcp_tools').select('*').eq('user_id', user_id).eq('handle', handle).limit(1).execute()
@@ -95,7 +96,7 @@ class MCPTool():
95
96
  raise e
96
97
 
97
98
  @staticmethod
98
- 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]:
99
100
  try:
100
101
  supabase = get_supabase(access_token)
101
102
  print('getting tools from db for user', user_id)
@@ -121,7 +122,7 @@ class MCPTool():
121
122
  raise e
122
123
 
123
124
  @staticmethod
124
- def get_tool_agents(access_token: str, id: str) -> list[int]:
125
+ async def get_tool_agents(access_token: str, id: str) -> list[int]:
125
126
  if not id:
126
127
  raise ValueError('Tool ID is required')
127
128
  try:
@@ -134,7 +135,7 @@ class MCPTool():
134
135
  raise
135
136
 
136
137
  @staticmethod
137
- 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]:
138
139
  if not id:
139
140
  raise ValueError('Tool ID is required')
140
141
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fyodorov_llm_agents
3
- Version: 0.4.12
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=LxoQ8ZrGt_xYbcAjFTZC4ff8zvzsWq9MstTmroFBTdE,6827
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=jNZ4jHCdBpHwhHeIGaOeEOFDi9tu1BnRsNF3vg-2Pn0,8456
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=r2SI0Aic3qq91WL7BB_ZKX4B7LgB1HMPutx9rgIla7s,6858
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.12.dist-info/METADATA,sha256=_kCun6oTEALyOjTLgMp6z2gAeR8Qq28IjOGdo0-OjxU,551
14
- fyodorov_llm_agents-0.4.12.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
15
- fyodorov_llm_agents-0.4.12.dist-info/top_level.txt,sha256=4QOslsBp8Gh7ng25DceA7fHp4KguTIdAxwURz97gH-g,20
16
- fyodorov_llm_agents-0.4.12.dist-info/RECORD,,
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,,