seekrai 0.5.14__tar.gz → 0.5.15__tar.gz

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 (75) hide show
  1. {seekrai-0.5.14 → seekrai-0.5.15}/PKG-INFO +1 -1
  2. {seekrai-0.5.14 → seekrai-0.5.15}/pyproject.toml +1 -1
  3. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/client.py +4 -0
  4. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/__init__.py +9 -1
  5. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/agents/__init__.py +6 -0
  6. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/agents/agent_inference.py +6 -0
  7. seekrai-0.5.15/src/seekrai/resources/agents/agent_observability.py +131 -0
  8. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/models.py +0 -1
  9. seekrai-0.5.15/src/seekrai/types/agents/observability.py +33 -0
  10. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/runs.py +2 -0
  11. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/finetune.py +2 -0
  12. {seekrai-0.5.14 → seekrai-0.5.15}/LICENSE +0 -0
  13. {seekrai-0.5.14 → seekrai-0.5.15}/README.md +0 -0
  14. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/__init__.py +0 -0
  15. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/abstract/__init__.py +0 -0
  16. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/abstract/api_requestor.py +0 -0
  17. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/abstract/response_parsing.py +0 -0
  18. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/constants.py +0 -0
  19. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/error.py +0 -0
  20. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/filemanager.py +0 -0
  21. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/agents/agents.py +0 -0
  22. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/agents/python_functions.py +0 -0
  23. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/agents/threads.py +0 -0
  24. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/alignment.py +0 -0
  25. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/chat/__init__.py +0 -0
  26. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/chat/completions.py +0 -0
  27. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/completions.py +0 -0
  28. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/deployments.py +0 -0
  29. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/embeddings.py +0 -0
  30. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/explainability.py +0 -0
  31. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/files.py +0 -0
  32. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/finetune.py +0 -0
  33. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/images.py +0 -0
  34. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/ingestion.py +0 -0
  35. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/projects.py +0 -0
  36. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/resource_base.py +0 -0
  37. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/resources/vectordb.py +0 -0
  38. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/seekrflow_response.py +0 -0
  39. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/__init__.py +0 -0
  40. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/abstract.py +0 -0
  41. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/__init__.py +0 -0
  42. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/agent.py +0 -0
  43. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/python_functions.py +0 -0
  44. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/threads.py +0 -0
  45. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/tools/__init__.py +0 -0
  46. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/tools/env_model_config.py +0 -0
  47. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/tools/schemas/__init__.py +0 -0
  48. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/tools/schemas/file_search.py +0 -0
  49. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/tools/schemas/file_search_env.py +0 -0
  50. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/tools/schemas/run_python.py +0 -0
  51. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/tools/schemas/run_python_env.py +0 -0
  52. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/tools/schemas/web_search.py +0 -0
  53. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/tools/schemas/web_search_env.py +0 -0
  54. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/tools/tool.py +0 -0
  55. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/agents/tools/tool_types.py +0 -0
  56. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/alignment.py +0 -0
  57. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/chat_completions.py +0 -0
  58. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/common.py +0 -0
  59. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/completions.py +0 -0
  60. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/deployments.py +0 -0
  61. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/embeddings.py +0 -0
  62. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/error.py +0 -0
  63. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/explainability.py +0 -0
  64. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/files.py +0 -0
  65. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/images.py +0 -0
  66. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/ingestion.py +0 -0
  67. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/models.py +0 -0
  68. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/projects.py +0 -0
  69. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/types/vectordb.py +0 -0
  70. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/utils/__init__.py +0 -0
  71. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/utils/_log.py +0 -0
  72. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/utils/api_helpers.py +0 -0
  73. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/utils/files.py +0 -0
  74. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/utils/tools.py +0 -0
  75. {seekrai-0.5.14 → seekrai-0.5.15}/src/seekrai/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: seekrai
3
- Version: 0.5.14
3
+ Version: 0.5.15
4
4
  Summary: Python client for SeekrAI
5
5
  License: Apache-2.0
6
6
  Author: SeekrFlow
@@ -14,7 +14,7 @@ build-backend = "poetry.core.masonry.api"
14
14
 
15
15
  [tool.poetry]
16
16
  name = "seekrai"
17
- version = "0.5.14"
17
+ version = "0.5.15"
18
18
  authors = [
19
19
  "SeekrFlow <support@seekr.com>"
20
20
  ]
@@ -24,6 +24,7 @@ class SeekrFlow:
24
24
  deployments: resources.Deployments
25
25
  vector_database: resources.VectorDatabase
26
26
  agents: resources.Agents
27
+ observability: resources.AgentObservability
27
28
 
28
29
  # client options
29
30
  client: SeekrFlowClient
@@ -89,6 +90,7 @@ class SeekrFlow:
89
90
  self.deployments = resources.Deployments(self.client)
90
91
  self.vector_database = resources.VectorDatabase(self.client)
91
92
  self.agents = resources.Agents(self.client)
93
+ self.observability = resources.AgentObservability(self.client)
92
94
 
93
95
 
94
96
  class AsyncSeekrFlow:
@@ -105,6 +107,7 @@ class AsyncSeekrFlow:
105
107
  deployments: resources.AsyncDeployments
106
108
  vector_database: resources.AsyncVectorDatabase
107
109
  agents: resources.AsyncAgents
110
+ observability: resources.AsyncAgentObservability
108
111
 
109
112
  # client options
110
113
  client: SeekrFlowClient
@@ -170,6 +173,7 @@ class AsyncSeekrFlow:
170
173
  self.deployments = resources.AsyncDeployments(self.client)
171
174
  self.vector_database = resources.AsyncVectorDatabase(self.client)
172
175
  self.agents = resources.AsyncAgents(self.client)
176
+ self.observability = resources.AsyncAgentObservability(self.client)
173
177
 
174
178
 
175
179
  Client = SeekrFlow
@@ -1,4 +1,10 @@
1
- from seekrai.resources.agents import AgentInference, Agents, AsyncAgents
1
+ from seekrai.resources.agents import (
2
+ AgentInference,
3
+ AgentObservability,
4
+ Agents,
5
+ AsyncAgentObservability,
6
+ AsyncAgents,
7
+ )
2
8
  from seekrai.resources.alignment import Alignment, AsyncAlignment
3
9
  from seekrai.resources.chat import AsyncChat, Chat
4
10
  from seekrai.resources.completions import AsyncCompletions, Completions
@@ -39,6 +45,8 @@ __all__ = [
39
45
  "Deployments",
40
46
  "AsyncAgents",
41
47
  "Agents",
48
+ "AgentObservability",
49
+ "AsyncAgentObservability",
42
50
  "VectorDatabase",
43
51
  "AsyncVectorDatabase",
44
52
  "AgentInference",
@@ -1,4 +1,8 @@
1
1
  from seekrai.resources.agents.agent_inference import AgentInference, AsyncAgentInference
2
+ from seekrai.resources.agents.agent_observability import (
3
+ AgentObservability,
4
+ AsyncAgentObservability,
5
+ )
2
6
  from seekrai.resources.agents.agents import Agents, AsyncAgents
3
7
  from seekrai.resources.agents.python_functions import (
4
8
  AsyncCustomFunctions,
@@ -16,4 +20,6 @@ __all__ = [
16
20
  "AsyncAgentThreads",
17
21
  "CustomFunctions",
18
22
  "AsyncCustomFunctions",
23
+ "AgentObservability",
24
+ "AsyncAgentObservability",
19
25
  ]
@@ -19,6 +19,7 @@ class AgentInference:
19
19
  stream: bool = False,
20
20
  model_settings: ModelSettings = ModelSettings(),
21
21
  response_format: Optional[Any] = None,
22
+ group: Optional[str] = None,
22
23
  ) -> Union[RunResponse, Iterator[Any]]:
23
24
  """
24
25
  Run an inference call on a deployed agent.
@@ -29,6 +30,7 @@ class AgentInference:
29
30
  stream (bool, optional): Whether to stream the response. Defaults to False.
30
31
  model_settings (optional): Additional parameters (such as temperature, max_tokens, etc).
31
32
  response_format: Optional structured output specification. If provided, the LLM will be constrained to return JSON matching this schema.
33
+ group (str, optional): Label used to associate a group of runs. Defaults to None.
32
34
 
33
35
  Returns:
34
36
  A dictionary with the response (if non-streaming) or an iterator over response chunks.
@@ -39,6 +41,7 @@ class AgentInference:
39
41
  response_format=ResponseFormat.from_value(response_format)
40
42
  if response_format
41
43
  else None,
44
+ group=group,
42
45
  ).model_dump()
43
46
  endpoint = f"threads/{thread_id}/runs"
44
47
  if stream:
@@ -156,6 +159,7 @@ class AsyncAgentInference:
156
159
  stream: bool = False,
157
160
  model_settings: ModelSettings = ModelSettings(),
158
161
  response_format: Optional[Any] = None,
162
+ group: Optional[str] = None,
159
163
  ) -> Union[RunResponse, AsyncGenerator[Any, None]]:
160
164
  """
161
165
  Run an inference call on a deployed agent.
@@ -166,6 +170,7 @@ class AsyncAgentInference:
166
170
  stream (bool, optional): Whether to stream the response. Defaults to False.
167
171
  model_settings (optional): Additional parameters (such as temperature, max_tokens, etc).
168
172
  response_format: Optional structured output specification. If provided, the LLM will be constrained to return JSON matching this schema.
173
+ group (str, optional): Label used to associate a group of runs. Defaults to None.
169
174
 
170
175
  Returns:
171
176
  A dictionary with the response (if non-streaming) or an iterator over response chunks.
@@ -176,6 +181,7 @@ class AsyncAgentInference:
176
181
  response_format=ResponseFormat.from_value(response_format)
177
182
  if response_format
178
183
  else None,
184
+ group=group,
179
185
  ).model_dump()
180
186
  endpoint = f"threads/{thread_id}/runs"
181
187
  if stream:
@@ -0,0 +1,131 @@
1
+ from datetime import datetime
2
+ from typing import Any, Optional
3
+
4
+ from seekrai.abstract import api_requestor
5
+ from seekrai.seekrflow_response import SeekrFlowResponse
6
+ from seekrai.types import SeekrFlowRequest
7
+ from seekrai.types.agents.observability import (
8
+ ObservabilitySpansRequest,
9
+ ObservabilitySpansResponse,
10
+ )
11
+
12
+
13
+ BASE_OBSERVABILITY_ENDPOINT = "observability/spans"
14
+
15
+
16
+ class AgentObservability:
17
+ def __init__(self, client: Any):
18
+ self._client = client
19
+ self._requestor = api_requestor.APIRequestor(client=self._client)
20
+
21
+ def query_spans(
22
+ self,
23
+ min_start_time: Optional[datetime] = None,
24
+ max_start_time: Optional[datetime] = None,
25
+ agent_id: Optional[str] = None,
26
+ run_id: Optional[str] = None,
27
+ trace_id: Optional[str] = None,
28
+ thread_id: Optional[str] = None,
29
+ group: Optional[str] = None,
30
+ limit: int = 100,
31
+ order: str = "desc",
32
+ offset: int = 0,
33
+ ) -> ObservabilitySpansResponse:
34
+ """
35
+ Retrieve spans for a given run or group of runs given a set of facets.
36
+ """
37
+ payload = ObservabilitySpansRequest(
38
+ min_start_datetime=min_start_time,
39
+ max_start_datetime=max_start_time,
40
+ agent_id=agent_id,
41
+ run_id=run_id,
42
+ trace_id=trace_id,
43
+ thread_id=thread_id,
44
+ group=group,
45
+ limit=limit,
46
+ order=order,
47
+ offset=offset,
48
+ ).model_dump()
49
+
50
+ response, _, _ = self._requestor.request(
51
+ options=SeekrFlowRequest(
52
+ method="POST", url=BASE_OBSERVABILITY_ENDPOINT, params=payload
53
+ )
54
+ )
55
+
56
+ assert isinstance(response, SeekrFlowResponse)
57
+
58
+ return ObservabilitySpansResponse(spans=response.data)
59
+
60
+ def retrieve_span(self, span_id: str) -> Optional[dict[str, Any]]:
61
+ """
62
+ Retrieve a specific span given a span_id.
63
+ """
64
+ endpoint = f"{BASE_OBSERVABILITY_ENDPOINT}/{span_id}"
65
+
66
+ response, _, _ = self._requestor.request(
67
+ options=SeekrFlowRequest(method="GET", url=endpoint)
68
+ )
69
+
70
+ assert isinstance(response, SeekrFlowResponse)
71
+
72
+ return response.data
73
+
74
+
75
+ class AsyncAgentObservability:
76
+ def __init__(self, client: Any) -> None:
77
+ self._client = client
78
+ self._requestor = api_requestor.APIRequestor(client=self._client)
79
+
80
+ async def query_spans(
81
+ self,
82
+ min_start_time: Optional[datetime] = None,
83
+ max_start_time: Optional[datetime] = None,
84
+ agent_id: Optional[str] = None,
85
+ run_id: Optional[str] = None,
86
+ trace_id: Optional[str] = None,
87
+ thread_id: Optional[str] = None,
88
+ group: Optional[str] = None,
89
+ limit: int = 100,
90
+ order: str = "desc",
91
+ offset: int = 0,
92
+ ) -> ObservabilitySpansResponse:
93
+ """
94
+ Retrieve spans for a given run or group of runs given a set of facets.
95
+ """
96
+ payload = ObservabilitySpansRequest(
97
+ min_start_datetime=min_start_time,
98
+ max_start_datetime=max_start_time,
99
+ agent_id=agent_id,
100
+ run_id=run_id,
101
+ trace_id=trace_id,
102
+ thread_id=thread_id,
103
+ group=group,
104
+ limit=limit,
105
+ order=order,
106
+ offset=offset,
107
+ ).model_dump()
108
+
109
+ response, _, _ = await self._requestor.arequest(
110
+ options=SeekrFlowRequest(
111
+ method="POST", url=BASE_OBSERVABILITY_ENDPOINT, params=payload
112
+ )
113
+ )
114
+
115
+ assert isinstance(response, SeekrFlowResponse)
116
+
117
+ return ObservabilitySpansResponse(spans=response.data)
118
+
119
+ async def retrieve_span(self, span_id: str) -> Optional[dict[str, Any]]:
120
+ """
121
+ Retrieve a specific span given a span_id.
122
+ """
123
+ endpoint = f"{BASE_OBSERVABILITY_ENDPOINT}/{span_id}"
124
+
125
+ response, _, _ = self._requestor.request(
126
+ options=SeekrFlowRequest(method="GET", url=endpoint)
127
+ )
128
+
129
+ assert isinstance(response, SeekrFlowResponse)
130
+
131
+ return response.data
@@ -5,7 +5,6 @@ from seekrai.resources.resource_base import ResourceBase
5
5
  from seekrai.seekrflow_response import SeekrFlowResponse
6
6
  from seekrai.types import ModelList, ModelResponse, SeekrFlowRequest
7
7
  from seekrai.types.common import ObjectType
8
- from seekrai.utils import parse_timestamp
9
8
 
10
9
 
11
10
  class Models(ResourceBase):
@@ -0,0 +1,33 @@
1
+ from datetime import datetime
2
+ from typing import Any, Dict, List, Optional
3
+
4
+ from pydantic import field_serializer
5
+
6
+ from seekrai.types.abstract import BaseModel
7
+
8
+
9
+ class ObservabilitySpansRequest(BaseModel):
10
+ """Request model for requesting observability spans."""
11
+
12
+ min_start_datetime: Optional[datetime]
13
+ max_start_datetime: Optional[datetime]
14
+ agent_id: Optional[str]
15
+ run_id: Optional[str]
16
+ trace_id: Optional[str]
17
+ thread_id: Optional[str]
18
+ group: Optional[str]
19
+ limit: int = 100
20
+ order: str = "desc"
21
+ offset: int = 0
22
+
23
+ @field_serializer("min_start_datetime", "max_start_datetime")
24
+ def serialize_dt(self, dt: Optional[datetime], _info: Any) -> Optional[str]:
25
+ if dt is not None:
26
+ return dt.isoformat()
27
+ return None
28
+
29
+
30
+ class ObservabilitySpansResponse(BaseModel):
31
+ """Response model for requesting observability spans."""
32
+
33
+ spans: List[Dict[str, Any]]
@@ -58,6 +58,7 @@ class RunRequest(BaseModel):
58
58
  agent_id: str = Field(default="default_agent")
59
59
  model_settings: ModelSettings = ModelSettings()
60
60
  response_format: Optional[Union[ResponseFormat, Dict[str, Any], type]] = None
61
+ group: Optional[str] = None
61
62
 
62
63
 
63
64
  class RunResponse(BaseModel):
@@ -66,6 +67,7 @@ class RunResponse(BaseModel):
66
67
  run_id: str
67
68
  thread_id: str
68
69
  status: str
70
+ group: Optional[str] = None
69
71
 
70
72
 
71
73
  class RunStatus(str, Enum):
@@ -26,6 +26,7 @@ class FinetuneJobStatus(str, Enum):
26
26
  STATUS_CANCELLED = "cancelled"
27
27
  STATUS_FAILED = "failed"
28
28
  STATUS_COMPLETED = "completed"
29
+ STATUS_DELETED = "deleted"
29
30
 
30
31
 
31
32
  class FinetuneEventLevels(str, Enum):
@@ -182,6 +183,7 @@ class FinetuneResponse(BaseModel):
182
183
  experiment_name: str | None = None
183
184
  # job status
184
185
  status: FinetuneJobStatus | None = None
186
+ deleted_at: datetime | None = None
185
187
 
186
188
  # list of fine-tune events
187
189
  events: List[FinetuneEvent] | None = None
File without changes
File without changes
File without changes