fyodorov-llm-agents 0.4.23__py3-none-any.whl → 0.4.25__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.
@@ -47,7 +47,7 @@ class Instance(InstanceModel):
47
47
  @staticmethod
48
48
  async def create_in_db(instance: InstanceModel) -> dict:
49
49
  try:
50
- existing_instance = Instance.get_by_title_and_agent(instance.title, instance.agent_id)
50
+ existing_instance = await Instance.get_by_title_and_agent(instance.title, instance.agent_id)
51
51
  if existing_instance:
52
52
  needs_update = False
53
53
  for key, value in instance.to_dict().items():
@@ -112,7 +112,7 @@ class Instance(InstanceModel):
112
112
  raise e
113
113
 
114
114
  @staticmethod
115
- def get_by_title_and_agent(title: str, agent_id: str) -> dict:
115
+ async def get_by_title_and_agent(title: str, agent_id: str) -> dict:
116
116
  if not title:
117
117
  raise ValueError('Instance title is required')
118
118
  if not agent_id:
@@ -133,7 +133,7 @@ class Instance(InstanceModel):
133
133
  raise e
134
134
 
135
135
  @staticmethod
136
- def get_in_db(id: str) -> InstanceModel:
136
+ async def get_in_db(id: str) -> InstanceModel:
137
137
  if not id:
138
138
  raise ValueError('Instance ID is required')
139
139
  try:
@@ -149,28 +149,32 @@ 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(), user_id: str = None) -> list[InstanceModel]:
152
+ async def get_all_in_db(limit: int = 10, created_at_lt: datetime = datetime.now(), user_id: str = None) -> list[InstanceModel]:
153
153
  try:
154
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:
155
+ agents = await Agent.get_all_in_db(limit=limit, created_at_lt=created_at_lt, user_id=user_id)
156
+ if not agents:
157
+ print("No agents found")
158
+ return []
159
+ agent_ids = [agent.id for agent in agents]
160
+ print(f"Agent IDs: {agent_ids}")
161
+ if not agent_ids:
162
+ print("No agent IDs found")
163
+ return []
164
+ instances = []
165
+ for agent in agents:
164
166
  result = supabase.from_('instances') \
165
167
  .select("*") \
168
+ .eq('agent_id', agent.id) \
166
169
  .limit(limit) \
167
170
  .lt('created_at', created_at_lt) \
168
171
  .order('created_at', desc=True) \
169
172
  .execute()
170
- if not result.data:
171
- return []
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]
173
- return instance_models
173
+ if not result.data:
174
+ continue
175
+ instance_models = [InstanceModel(**{k: str(v) if not isinstance(v, list) else v for k, v in instance.items()}) for instance in result.data]
176
+ instances.append(instance_models)
177
+ return instances
174
178
  except Exception as e:
175
179
  print('[Instance.get_all_in_db] Error fetching instances', str(e))
176
180
  raise e
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fyodorov_llm_agents
3
- Version: 0.4.23
3
+ Version: 0.4.25
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
@@ -3,7 +3,7 @@ fyodorov_llm_agents/agents/agent_model.py,sha256=rsBjOHDHLq5S4Sv8KZDQqAT_1903UFT
3
3
  fyodorov_llm_agents/agents/agent_service.py,sha256=qm3oGtgrbTV3LfmVYTIrZDs4GwmghdRAxxb3gkrS2i4,6553
4
4
  fyodorov_llm_agents/agents/openai.py,sha256=FA5RS7yn3JwvFA8PXju60XSYC_2oUZFNgBUzeIYtGv0,1154
5
5
  fyodorov_llm_agents/instances/instance_model.py,sha256=Kdte858w9AtjgJHtYtuHO2D0pNg186JZZLCWZQPG4D0,1206
6
- fyodorov_llm_agents/instances/instance_service.py,sha256=ssCBa2NqDw8sbreKozKMKsrIO4ZC9M_MEbFoSFyr9jY,8968
6
+ fyodorov_llm_agents/instances/instance_service.py,sha256=DuxmGEm6GzQGw6kMPpAibV-X25DTdXQqKTDDao8BQNI,9201
7
7
  fyodorov_llm_agents/models/llm_model.py,sha256=MEn1L9-COo_8uQujtYXr5ZUsWtBj2kNAOK5J8s3ZKM4,1717
8
8
  fyodorov_llm_agents/models/llm_service.py,sha256=L_YxZIotlPea0ymUfYXY24rdnCuZdOZEMTDrh8J_BAM,4562
9
9
  fyodorov_llm_agents/providers/provider_model.py,sha256=i9aqtuMUERng54hOYTArt4aq0uU4b2wyCZCfJ39RbEI,957
@@ -11,7 +11,7 @@ fyodorov_llm_agents/providers/provider_service.py,sha256=pvb43ZdF8zFzgP2GELCSE8r
11
11
  fyodorov_llm_agents/tools/mcp_tool_model.py,sha256=JM4XItd9TEprDd7Xuz4hCYcPMRL2LVdJ3Fh7CoMug3A,5110
12
12
  fyodorov_llm_agents/tools/mcp_tool_service.py,sha256=nOWeCXFP8t7pbFL4Co70c7ukEEl-TQbb1pnPHlG5Tac,7677
13
13
  fyodorov_llm_agents/tools/tool.py,sha256=HyOk0X_3XE23sa8J-8UZx657tJ0sxwZWMbA4OPxXU6E,7940
14
- fyodorov_llm_agents-0.4.23.dist-info/METADATA,sha256=dgzV7u7tVSHL1dI5RtCXbp4S5HpbvDC_Wcy75A4ksy8,551
15
- fyodorov_llm_agents-0.4.23.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
16
- fyodorov_llm_agents-0.4.23.dist-info/top_level.txt,sha256=4QOslsBp8Gh7ng25DceA7fHp4KguTIdAxwURz97gH-g,20
17
- fyodorov_llm_agents-0.4.23.dist-info/RECORD,,
14
+ fyodorov_llm_agents-0.4.25.dist-info/METADATA,sha256=Ze4iHCWuGiAwhuxeQEAmZy3_3_7jwY7wmKD-E1EZFFM,551
15
+ fyodorov_llm_agents-0.4.25.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
16
+ fyodorov_llm_agents-0.4.25.dist-info/top_level.txt,sha256=4QOslsBp8Gh7ng25DceA7fHp4KguTIdAxwURz97gH-g,20
17
+ fyodorov_llm_agents-0.4.25.dist-info/RECORD,,