fyodorov-llm-agents 0.4.16__py3-none-any.whl → 0.4.18__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,15 +72,27 @@ class Agent(AgentModel):
72
72
  raise e
73
73
 
74
74
  @staticmethod
75
- async def get_all_in_db(limit: int = 10, created_at_lt: datetime = datetime.now()) -> [dict]:
75
+ async def get_all_in_db(limit: int = 10, created_at_lt: datetime = datetime.now(), user_id: str = None) -> list[AgentModel]:
76
76
  try:
77
- result = supabase.from_('agents') \
78
- .select("*") \
79
- .limit(limit) \
80
- .lt('created_at', created_at_lt) \
81
- .order('created_at', desc=True) \
82
- .execute()
83
- agents = result.data
77
+ supabase = get_supabase()
78
+ if user_id:
79
+ result = supabase.from_('agents') \
80
+ .select("*") \
81
+ .eq('user_id', user_id) \
82
+ .limit(limit) \
83
+ .lt('created_at', created_at_lt) \
84
+ .order('created_at', desc=True) \
85
+ .execute()
86
+ else:
87
+ result = supabase.from_('agents') \
88
+ .select("*") \
89
+ .limit(limit) \
90
+ .lt('created_at', created_at_lt) \
91
+ .order('created_at', desc=True) \
92
+ .execute()
93
+ if not result.data:
94
+ return []
95
+ agents = [AgentModel(**agent) for agent in result.data]
84
96
  print(f"Fetched agents: {agents}")
85
97
  return agents
86
98
  except Exception as e:
@@ -149,14 +149,26 @@ class Instance(InstanceModel):
149
149
  raise e
150
150
 
151
151
  @staticmethod
152
- def get_all_in_db(limit: int = 10, created_at_lt: datetime = datetime.now()) -> [InstanceModel]:
152
+ def get_all_in_db(limit: int = 10, created_at_lt: datetime = datetime.now(), user_id: str = None) -> list[InstanceModel]:
153
153
  try:
154
- result = supabase.from_('instances') \
155
- .select("*") \
156
- .limit(limit) \
157
- .lt('created_at', created_at_lt) \
158
- .order('created_at', desc=True) \
159
- .execute()
154
+ supabase = get_supabase()
155
+ if user_id:
156
+ result = supabase.from_('instances') \
157
+ .select("*") \
158
+ .eq('user_id', user_id) \
159
+ .limit(limit) \
160
+ .lt('created_at', created_at_lt) \
161
+ .order('created_at', desc=True) \
162
+ .execute()
163
+ else:
164
+ result = supabase.from_('instances') \
165
+ .select("*") \
166
+ .limit(limit) \
167
+ .lt('created_at', created_at_lt) \
168
+ .order('created_at', desc=True) \
169
+ .execute()
170
+ if not result.data:
171
+ return []
160
172
  instance_models = [InstanceModel(**{k: str(v) if not isinstance(v, list) else v for k, v in instance.items()}) for instance in result.data]
161
173
  return instance_models
162
174
  except Exception as e:
@@ -78,17 +78,28 @@ class LLM(LLMModel):
78
78
  raise e
79
79
 
80
80
  @staticmethod
81
- async def get_models(limit: int = 10, created_at_lt: datetime = datetime.now()) -> [dict]:
81
+ async def get_models(limit: int = 10, created_at_lt: datetime = datetime.now(), user_id: str = None) -> list[LLMModel]:
82
82
  try:
83
- result = supabase.table('models') \
84
- .select('*') \
85
- .order('created_at', desc=True) \
86
- .limit(limit) \
87
- .lt('created_at', created_at_lt) \
88
- .execute()
89
- data = result.data
90
- print('Fetched models', data)
91
- return data
83
+ if user_id:
84
+ result = supabase.table('models') \
85
+ .select('*') \
86
+ .eq('user_id', user_id) \
87
+ .order('created_at', desc=True) \
88
+ .limit(limit) \
89
+ .lt('created_at', created_at_lt) \
90
+ .execute()
91
+ data = result.data
92
+ else:
93
+ result = supabase.table('models') \
94
+ .select('*') \
95
+ .order('created_at', desc=True) \
96
+ .limit(limit) \
97
+ .lt('created_at', created_at_lt) \
98
+ .execute()
99
+ data = result.data
100
+ models = [LLMModel(**model) for model in data]
101
+ print('Fetched models', models)
102
+ return models
92
103
  except Exception as e:
93
104
  print('Error fetching models', str(e))
94
105
  raise e
@@ -122,17 +122,31 @@ class Provider(ProviderModel):
122
122
  return provider
123
123
 
124
124
  @staticmethod
125
- async def get_providers(limit: int = 10, created_at_lt: datetime = datetime.now()) -> [dict]:
125
+ async def get_providers(limit: int = 10, created_at_lt: datetime = datetime.now(), user_id: str = None) -> list[dict]:
126
126
  try:
127
- result = supabase.table('providers') \
128
- .select('*') \
129
- .order('created_at', desc=True) \
130
- .limit(limit) \
131
- .lt('created_at', created_at_lt) \
132
- .execute()
133
- data = result.data
134
- print('Fetched providers', data)
135
- return data
127
+ if user_id:
128
+ result = supabase.table('providers') \
129
+ .select('*') \
130
+ .eq('user_id', user_id) \
131
+ .order('created_at', desc=True) \
132
+ .limit(limit) \
133
+ .lt('created_at', created_at_lt) \
134
+ .execute()
135
+ data = result.data
136
+ else:
137
+ result = supabase.table('providers') \
138
+ .select('*') \
139
+ .order('created_at', desc=True) \
140
+ .limit(limit) \
141
+ .lt('created_at', created_at_lt) \
142
+ .execute()
143
+ data = result.data
144
+ for provider in data:
145
+ provider['id'] = str(provider['id'])
146
+ provider['user_id'] = str(provider['user_id'])
147
+ providers = [ProviderModel(**provider) for provider in data]
148
+ print('Fetched providers', providers)
149
+ return providers
136
150
  except Exception as e:
137
151
  print('Error fetching providers', str(e))
138
152
  raise e
@@ -99,17 +99,26 @@ class MCPTool():
99
99
  raise e
100
100
 
101
101
  @staticmethod
102
- async def get_all_in_db(access_token: str, user_id: str = None, limit: int = 10, created_at_lt: datetime = datetime.now()) -> list[ToolModel]:
102
+ async def get_all_in_db(access_token: str, limit: int = 10, created_at_lt: datetime = datetime.now(), user_id: str = None) -> list[ToolModel]:
103
103
  try:
104
104
  supabase = get_supabase(access_token)
105
105
  print('getting tools from db for user', user_id)
106
106
  tools = []
107
- result = supabase.from_('mcp_tools') \
108
- .select("*") \
109
- .limit(limit) \
110
- .lt('created_at', created_at_lt) \
111
- .order('created_at', desc=True) \
112
- .execute()
107
+ if user_id:
108
+ result = supabase.from_('mcp_tools') \
109
+ .select("*") \
110
+ .eq('user_id', user_id) \
111
+ .limit(limit) \
112
+ .lt('created_at', created_at_lt) \
113
+ .order('created_at', desc=True) \
114
+ .execute()
115
+ else:
116
+ result = supabase.from_('mcp_tools') \
117
+ .select("*") \
118
+ .limit(limit) \
119
+ .lt('created_at', created_at_lt) \
120
+ .order('created_at', desc=True) \
121
+ .execute()
113
122
  for tool in result.data:
114
123
  tool["id"] = str(tool["id"])
115
124
  tool["user_id"] = str(tool["user_id"])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fyodorov_llm_agents
3
- Version: 0.4.16
3
+ Version: 0.4.18
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
@@ -0,0 +1,16 @@
1
+ fyodorov_llm_agents/agents/agent_model.py,sha256=UN8KJvPWsoiatBM3Pw0X8bt0G0pGJeEf4vOTMBITnKU,6839
2
+ fyodorov_llm_agents/agents/agent_service.py,sha256=qm3oGtgrbTV3LfmVYTIrZDs4GwmghdRAxxb3gkrS2i4,6553
3
+ fyodorov_llm_agents/agents/openai.py,sha256=FA5RS7yn3JwvFA8PXju60XSYC_2oUZFNgBUzeIYtGv0,1154
4
+ fyodorov_llm_agents/instances/instance_model.py,sha256=PQaoVSH9H4qp_wcLvyT_QgvNtwf9oehOxZaGI6mv1bA,1206
5
+ fyodorov_llm_agents/instances/instance_service.py,sha256=MNUJTKQnt62GiRpyBmGWJSht96ERchEVBlRamnAQv3s,8967
6
+ fyodorov_llm_agents/models/llm_model.py,sha256=aQtXtB7kRpnVdbPu-nmTGAaflbtKz3DPkgcckf1srsg,1645
7
+ fyodorov_llm_agents/models/llm_service.py,sha256=L_YxZIotlPea0ymUfYXY24rdnCuZdOZEMTDrh8J_BAM,4562
8
+ fyodorov_llm_agents/providers/provider_model.py,sha256=OyCK6WMRhyElsp88gILg0wso-OPHI7f55gEeypsJ7O0,957
9
+ fyodorov_llm_agents/providers/provider_service.py,sha256=pvb43ZdF8zFzgP2GELCSE8rDxjjsYe-s0RlcTa8vWIE,6588
10
+ fyodorov_llm_agents/tools/mcp_tool_model.py,sha256=nGdPmqSkA7hqDUTPbNCZAHNSVJCgVOs5dzJfPntLidI,5110
11
+ fyodorov_llm_agents/tools/mcp_tool_service.py,sha256=nOWeCXFP8t7pbFL4Co70c7ukEEl-TQbb1pnPHlG5Tac,7677
12
+ fyodorov_llm_agents/tools/tool.py,sha256=HyOk0X_3XE23sa8J-8UZx657tJ0sxwZWMbA4OPxXU6E,7940
13
+ fyodorov_llm_agents-0.4.18.dist-info/METADATA,sha256=H4n2H1IvfVVwt5XbcjqGhZsgj9nfUVgUtoaO7RGQqx4,551
14
+ fyodorov_llm_agents-0.4.18.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
15
+ fyodorov_llm_agents-0.4.18.dist-info/top_level.txt,sha256=4QOslsBp8Gh7ng25DceA7fHp4KguTIdAxwURz97gH-g,20
16
+ fyodorov_llm_agents-0.4.18.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- fyodorov_llm_agents/agents/agent_model.py,sha256=UN8KJvPWsoiatBM3Pw0X8bt0G0pGJeEf4vOTMBITnKU,6839
2
- fyodorov_llm_agents/agents/agent_service.py,sha256=-55RDait3eZGFfYWGNLGoa06WMcdiBnkzpa7BnWW10Q,6016
3
- fyodorov_llm_agents/agents/openai.py,sha256=FA5RS7yn3JwvFA8PXju60XSYC_2oUZFNgBUzeIYtGv0,1154
4
- fyodorov_llm_agents/instances/instance_model.py,sha256=PQaoVSH9H4qp_wcLvyT_QgvNtwf9oehOxZaGI6mv1bA,1206
5
- fyodorov_llm_agents/instances/instance_service.py,sha256=QolwEosIH5MEVNdAcmPa4pB3cuDyygvOdNFIERRLquc,8468
6
- fyodorov_llm_agents/models/llm_model.py,sha256=aQtXtB7kRpnVdbPu-nmTGAaflbtKz3DPkgcckf1srsg,1645
7
- fyodorov_llm_agents/models/llm_service.py,sha256=35bS0RFXJhJUSjge-v4u5cftn_MT-CmcDuWnC2kCnJo,4008
8
- fyodorov_llm_agents/providers/provider_model.py,sha256=OyCK6WMRhyElsp88gILg0wso-OPHI7f55gEeypsJ7O0,957
9
- fyodorov_llm_agents/providers/provider_service.py,sha256=GST-NLV8aLPsvapQEvgT_qHGYu7IpS5Xsut60XFmD-g,5865
10
- fyodorov_llm_agents/tools/mcp_tool_model.py,sha256=nGdPmqSkA7hqDUTPbNCZAHNSVJCgVOs5dzJfPntLidI,5110
11
- fyodorov_llm_agents/tools/mcp_tool_service.py,sha256=NzZOmOQLH-V4m5Znifxy7hI038MLTT22rj2hkZSK1to,7299
12
- fyodorov_llm_agents/tools/tool.py,sha256=HyOk0X_3XE23sa8J-8UZx657tJ0sxwZWMbA4OPxXU6E,7940
13
- fyodorov_llm_agents-0.4.16.dist-info/METADATA,sha256=vp1qXDwpzpKkvOxjNYPxnGXvNWvX7tEii4gwhRUAaL0,551
14
- fyodorov_llm_agents-0.4.16.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
15
- fyodorov_llm_agents-0.4.16.dist-info/top_level.txt,sha256=4QOslsBp8Gh7ng25DceA7fHp4KguTIdAxwURz97gH-g,20
16
- fyodorov_llm_agents-0.4.16.dist-info/RECORD,,