seekrai 0.4.4__py3-none-any.whl → 0.5.0__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.
Files changed (46) hide show
  1. seekrai/__init__.py +0 -1
  2. seekrai/abstract/api_requestor.py +108 -251
  3. seekrai/abstract/response_parsing.py +99 -0
  4. seekrai/client.py +6 -2
  5. seekrai/filemanager.py +92 -3
  6. seekrai/resources/__init__.py +6 -1
  7. seekrai/resources/agents/__init__.py +11 -6
  8. seekrai/resources/agents/agent_inference.py +236 -29
  9. seekrai/resources/agents/agents.py +272 -0
  10. seekrai/resources/agents/threads.py +454 -0
  11. seekrai/resources/alignment.py +3 -9
  12. seekrai/resources/completions.py +3 -9
  13. seekrai/resources/deployments.py +4 -9
  14. seekrai/resources/embeddings.py +3 -9
  15. seekrai/resources/files.py +118 -53
  16. seekrai/resources/finetune.py +3 -9
  17. seekrai/resources/images.py +3 -5
  18. seekrai/resources/ingestion.py +3 -9
  19. seekrai/resources/models.py +35 -124
  20. seekrai/resources/projects.py +4 -9
  21. seekrai/resources/resource_base.py +10 -0
  22. seekrai/resources/vectordb.py +482 -0
  23. seekrai/types/__init__.py +87 -0
  24. seekrai/types/agents/__init__.py +89 -0
  25. seekrai/types/agents/agent.py +42 -0
  26. seekrai/types/agents/runs.py +117 -0
  27. seekrai/types/agents/threads.py +265 -0
  28. seekrai/types/agents/tools/__init__.py +16 -0
  29. seekrai/types/agents/tools/env_model_config.py +7 -0
  30. seekrai/types/agents/tools/schemas/__init__.py +8 -0
  31. seekrai/types/agents/tools/schemas/file_search.py +9 -0
  32. seekrai/types/agents/tools/schemas/file_search_env.py +11 -0
  33. seekrai/types/agents/tools/tool.py +14 -0
  34. seekrai/types/agents/tools/tool_env_types.py +4 -0
  35. seekrai/types/agents/tools/tool_types.py +10 -0
  36. seekrai/types/alignment.py +6 -2
  37. seekrai/types/files.py +3 -0
  38. seekrai/types/finetune.py +1 -0
  39. seekrai/types/models.py +3 -0
  40. seekrai/types/vectordb.py +78 -0
  41. {seekrai-0.4.4.dist-info → seekrai-0.5.0.dist-info}/METADATA +3 -3
  42. seekrai-0.5.0.dist-info/RECORD +67 -0
  43. {seekrai-0.4.4.dist-info → seekrai-0.5.0.dist-info}/WHEEL +1 -1
  44. seekrai-0.4.4.dist-info/RECORD +0 -49
  45. {seekrai-0.4.4.dist-info → seekrai-0.5.0.dist-info}/LICENSE +0 -0
  46. {seekrai-0.4.4.dist-info → seekrai-0.5.0.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,272 @@
1
+ from seekrai.abstract import api_requestor
2
+ from seekrai.resources.agents.agent_inference import AgentInference, AsyncAgentInference
3
+ from seekrai.resources.agents.threads import AgentThreads, AsyncAgentThreads
4
+ from seekrai.seekrflow_response import SeekrFlowResponse
5
+ from seekrai.types import SeekrFlowClient, SeekrFlowRequest
6
+ from seekrai.types.agents.agent import (
7
+ Agent,
8
+ AgentDeleteResponse,
9
+ CreateAgentRequest,
10
+ )
11
+
12
+
13
+ class Agents:
14
+ def __init__(self, client: SeekrFlowClient) -> None:
15
+ self._client = client
16
+ self._requestor = api_requestor.APIRequestor(
17
+ client=self._client,
18
+ )
19
+ self.runs = AgentInference(client)
20
+ self.threads = AgentThreads(client)
21
+
22
+ def retrieve(self, agent_id: str) -> Agent:
23
+ """
24
+ Retrieve an agent by its ID.
25
+
26
+ Args:
27
+ agent_id: The ID of the Agent to retrieve.
28
+
29
+ Returns: An agent.
30
+ """
31
+ response, _, _ = self._requestor.request(
32
+ options=SeekrFlowRequest(
33
+ method="GET",
34
+ url=f"flow/agents/{agent_id}",
35
+ ),
36
+ )
37
+
38
+ assert isinstance(response, SeekrFlowResponse)
39
+ return Agent(**response.data)
40
+
41
+ def create(self, request: CreateAgentRequest) -> Agent:
42
+ """
43
+ Create an agent based on a set of instructions and tooling.
44
+
45
+ Args:
46
+ request: The request object containing all the agent config (instructions, tooling, etc.)
47
+
48
+ Returns:
49
+ The newly created agent.
50
+ """
51
+ response, _, _ = self._requestor.request(
52
+ options=SeekrFlowRequest(
53
+ method="POST", url="flow/agents/create", params=request.model_dump()
54
+ ),
55
+ )
56
+
57
+ assert isinstance(response, SeekrFlowResponse)
58
+ return Agent(**response.data)
59
+
60
+ def list_agents(self) -> list[Agent]:
61
+ """
62
+ Retrieve an entire list of agents for the user.
63
+
64
+ Args:
65
+ None.
66
+
67
+ Returns: A list of agents.
68
+ """
69
+ response, _, _ = self._requestor.request(
70
+ options=SeekrFlowRequest(
71
+ method="GET",
72
+ url="flow/agents/",
73
+ ),
74
+ )
75
+ assert isinstance(response, SeekrFlowResponse)
76
+
77
+ agents = [Agent(**agent) for agent in response.data["data"]]
78
+
79
+ return agents
80
+
81
+ def promote(self, agent_id: str) -> Agent:
82
+ """
83
+ Re-deploy an existing agent.
84
+
85
+ Args:
86
+ agent_id: The ID of the existing agent to re-deploy
87
+
88
+ Returns:
89
+ The agent that was re-deployed.
90
+ """
91
+ response, _, _ = self._requestor.request(
92
+ options=SeekrFlowRequest(
93
+ method="PUT",
94
+ url=f"flow/agents/{agent_id}/promote",
95
+ ),
96
+ )
97
+
98
+ assert isinstance(response, SeekrFlowResponse)
99
+ return Agent(**response.data)
100
+
101
+ def demote(self, agent_id: str) -> Agent:
102
+ """
103
+ Scale down an Agent deployment.
104
+
105
+ Args:
106
+ agent_id: The ID of the agent to demote.
107
+
108
+ Returns:
109
+ The agent whose corresponding deployment was scaled down.
110
+ """
111
+ response, _, _ = self._requestor.request(
112
+ options=SeekrFlowRequest(
113
+ method="PUT",
114
+ url=f"flow/agents/{agent_id}/demote",
115
+ ),
116
+ )
117
+
118
+ assert isinstance(response, SeekrFlowResponse)
119
+ return Agent(**response.data)
120
+
121
+ def delete(self, agent_id: str) -> AgentDeleteResponse:
122
+ """
123
+ Demote an agent (if it's currently active/deployed) and subsequently delete the agent from the DB.
124
+
125
+ DESTRUCTIVE OPERATION - cannot recover deleted agents.
126
+
127
+ Args:
128
+ agent_id: The ID of the agent to delete.
129
+
130
+ Returns:
131
+ A response indicating whether the delete operation was successful.
132
+ """
133
+ response, _, _ = self._requestor.request(
134
+ options=SeekrFlowRequest(
135
+ method="DELETE",
136
+ url=f"flow/agents/{agent_id}",
137
+ ),
138
+ )
139
+
140
+ assert isinstance(response, SeekrFlowResponse)
141
+ return AgentDeleteResponse(**response.data)
142
+
143
+
144
+ class AsyncAgents:
145
+ def __init__(self, client: SeekrFlowClient) -> None:
146
+ self._client = client
147
+ self._requestor = api_requestor.APIRequestor(
148
+ client=self._client,
149
+ )
150
+ self.runs = AsyncAgentInference(client)
151
+ self.threads = AsyncAgentThreads(client)
152
+
153
+ async def retrieve(self, agent_id: str) -> Agent:
154
+ """
155
+ Retrieve an agent by its ID.
156
+
157
+ Args:
158
+ agent_id: The ID of the Agent to retrieve.
159
+
160
+ Returns: An agent.
161
+ """
162
+ response, _, _ = await self._requestor.arequest(
163
+ options=SeekrFlowRequest(
164
+ method="GET",
165
+ url=f"flow/agents/{agent_id}",
166
+ ),
167
+ )
168
+
169
+ assert isinstance(response, SeekrFlowResponse)
170
+ return Agent(**response.data)
171
+
172
+ async def create(self, request: CreateAgentRequest) -> Agent:
173
+ """
174
+ Create an agent based on a set of instructions and tooling.
175
+
176
+ Args:
177
+ request: The request object containing all the agent config (instructions, tooling, etc.)
178
+
179
+ Returns:
180
+ The newly created agent.
181
+ """
182
+ response, _, _ = await self._requestor.arequest(
183
+ options=SeekrFlowRequest(
184
+ method="POST", url="flow/agents/create", params=request.model_dump()
185
+ ),
186
+ )
187
+
188
+ assert isinstance(response, SeekrFlowResponse)
189
+ return Agent(**response.data)
190
+
191
+ async def list_agents(self) -> list[Agent]:
192
+ """
193
+ Retrieve an entire list of agents for the user.
194
+
195
+ Args:
196
+ None.
197
+
198
+ Returns: A list of agents.
199
+ """
200
+ response, _, _ = await self._requestor.arequest(
201
+ options=SeekrFlowRequest(
202
+ method="GET",
203
+ url="flow/agents/",
204
+ ),
205
+ )
206
+ assert isinstance(response, SeekrFlowResponse)
207
+
208
+ agents = [Agent(**agent) for agent in response.data["data"]]
209
+
210
+ return agents
211
+
212
+ async def promote(self, agent_id: str) -> Agent:
213
+ """
214
+ Re-deploy an existing agent.
215
+
216
+ Args:
217
+ agent_id: The ID of the existing agent to re-deploy
218
+
219
+ Returns:
220
+ The agent that was re-deployed.
221
+ """
222
+ response, _, _ = await self._requestor.arequest(
223
+ options=SeekrFlowRequest(
224
+ method="PUT",
225
+ url=f"flow/agents/{agent_id}/promote",
226
+ ),
227
+ )
228
+
229
+ assert isinstance(response, SeekrFlowResponse)
230
+ return Agent(**response.data)
231
+
232
+ async def demote(self, agent_id: str) -> Agent:
233
+ """
234
+ Scale down an Agent deployment.
235
+
236
+ Args:
237
+ agent_id: The ID of the agent to demote.
238
+
239
+ Returns:
240
+ The agent whose corresponding deployment was scaled down.
241
+ """
242
+ response, _, _ = await self._requestor.arequest(
243
+ options=SeekrFlowRequest(
244
+ method="PUT",
245
+ url=f"flow/agents/{agent_id}/demote",
246
+ ),
247
+ )
248
+
249
+ assert isinstance(response, SeekrFlowResponse)
250
+ return Agent(**response.data)
251
+
252
+ async def delete(self, agent_id: str) -> AgentDeleteResponse:
253
+ """
254
+ Demote an agent (if it's currently active/deployed) and subsequently delete the agent from the DB.
255
+
256
+ DESTRUCTIVE OPERATION - cannot recover deleted agents.
257
+
258
+ Args:
259
+ agent_id: The ID of the agent to delete.
260
+
261
+ Returns:
262
+ A response indicating whether the delete operation was successful.
263
+ """
264
+ response, _, _ = await self._requestor.arequest(
265
+ options=SeekrFlowRequest(
266
+ method="DELETE",
267
+ url=f"flow/agents/{agent_id}",
268
+ ),
269
+ )
270
+
271
+ assert isinstance(response, SeekrFlowResponse)
272
+ return AgentDeleteResponse(**response.data)