hivetrace 1.3.6__tar.gz → 1.3.7__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 (50) hide show
  1. {hivetrace-1.3.6 → hivetrace-1.3.7}/PKG-INFO +74 -50
  2. {hivetrace-1.3.6 → hivetrace-1.3.7}/README.md +73 -49
  3. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace.egg-info/PKG-INFO +74 -50
  4. {hivetrace-1.3.6 → hivetrace-1.3.7}/setup.py +1 -1
  5. {hivetrace-1.3.6 → hivetrace-1.3.7}/LICENSE +0 -0
  6. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/__init__.py +0 -0
  7. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/__init__.py +0 -0
  8. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/base_adapter.py +0 -0
  9. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/crewai/__init__.py +0 -0
  10. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/crewai/adapter.py +0 -0
  11. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/crewai/decorators.py +0 -0
  12. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/crewai/monitored_agent.py +0 -0
  13. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/crewai/monitored_crew.py +0 -0
  14. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/crewai/tool_wrapper.py +0 -0
  15. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/langchain/__init__.py +0 -0
  16. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/langchain/adapter.py +0 -0
  17. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/langchain/api.py +0 -0
  18. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/langchain/behavior_tracker.py +0 -0
  19. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/langchain/callback.py +0 -0
  20. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/langchain/decorators.py +0 -0
  21. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/langchain/models.py +0 -0
  22. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/openai_agents/__init__.py +0 -0
  23. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/openai_agents/adapter.py +0 -0
  24. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/openai_agents/models.py +0 -0
  25. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/openai_agents/tracing.py +0 -0
  26. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/utils/__init__.py +0 -0
  27. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/adapters/utils/logging.py +0 -0
  28. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/client/__init__.py +0 -0
  29. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/client/async_client.py +0 -0
  30. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/client/base.py +0 -0
  31. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/client/sync_client.py +0 -0
  32. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/errors/__init__.py +0 -0
  33. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/errors/api.py +0 -0
  34. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/errors/base.py +0 -0
  35. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/errors/network.py +0 -0
  36. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/errors/validation.py +0 -0
  37. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/handlers/__init__.py +0 -0
  38. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/handlers/error_handler.py +0 -0
  39. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/handlers/response_builder.py +0 -0
  40. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/models/__init__.py +0 -0
  41. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/models/requests.py +0 -0
  42. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/models/responses.py +0 -0
  43. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/utils/__init__.py +0 -0
  44. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/utils/error_helpers.py +0 -0
  45. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace/utils/uuid_generator.py +0 -0
  46. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace.egg-info/SOURCES.txt +0 -0
  47. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace.egg-info/dependency_links.txt +0 -0
  48. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace.egg-info/requires.txt +0 -0
  49. {hivetrace-1.3.6 → hivetrace-1.3.7}/hivetrace.egg-info/top_level.txt +0 -0
  50. {hivetrace-1.3.6 → hivetrace-1.3.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hivetrace
3
- Version: 1.3.6
3
+ Version: 1.3.7
4
4
  Summary: Hivetrace SDK for monitoring LLM applications
5
5
  Home-page: http://hivetrace.ai
6
6
  Author: Raft
@@ -20,45 +20,49 @@ License-File: LICENSE
20
20
 
21
21
  ## Overview
22
22
 
23
- Hivetrace SDK is designed for integration with the Hivetrace service, providing monitoring of user prompts and LLM responses.
23
+ The Hivetrace SDK lets you integrate with the Hivetrace service to monitor user prompts and LLM responses. It supports both synchronous and asynchronous workflows and can be configured via environment variables.
24
+
25
+ ---
24
26
 
25
27
  ## Installation
26
28
 
27
- Install the SDK via pip:
29
+ Install from PyPI:
28
30
 
29
31
  ```bash
30
32
  pip install hivetrace[base]
31
33
  ```
32
34
 
33
- ## Usage
35
+ ---
36
+
37
+ ## Quick Start
34
38
 
35
39
  ```python
36
40
  from hivetrace import SyncHivetraceSDK, AsyncHivetraceSDK
37
41
  ```
38
42
 
39
- ## Synchronous and Asynchronous Clients
43
+ You can use either the synchronous client (`SyncHivetraceSDK`) or the asynchronous client (`AsyncHivetraceSDK`). Choose the one that fits your runtime.
40
44
 
41
- SDK предоставляет два отдельных клиента: синхронный (`SyncHivetraceSDK`) и асинхронный (`AsyncHivetraceSDK`). Выберите подходящий под ваш режим выполнения.
45
+ ---
42
46
 
43
- ### Sync Mode
47
+ ## Synchronous Client
44
48
 
45
- #### Инициализация (Sync)
49
+ ### Initialize (Sync)
46
50
 
47
51
  ```python
48
- # Sync client (использует переменные окружения или переданный config)
52
+ # The sync client reads configuration from environment variables or accepts an explicit config
49
53
  client = SyncHivetraceSDK()
50
54
  ```
51
55
 
52
- #### Отправка пользовательского запроса
56
+ ### Send a user prompt (input)
53
57
 
54
58
  ```python
55
59
  response = client.input(
56
- application_id="your-application-id", # получен после регистрации приложения в UI
60
+ application_id="your-application-id", # Obtained after registering the application in the UI
57
61
  message="User prompt here",
58
62
  )
59
63
  ```
60
64
 
61
- #### Отправка ответа LLM
65
+ ### Send an LLM response (output)
62
66
 
63
67
  ```python
64
68
  response = client.output(
@@ -67,16 +71,18 @@ response = client.output(
67
71
  )
68
72
  ```
69
73
 
70
- ### Async Mode
74
+ ---
75
+
76
+ ## Asynchronous Client
71
77
 
72
- #### Инициализация (Async)
78
+ ### Initialize (Async)
73
79
 
74
80
  ```python
75
- # Async client (можно использовать как контекстный менеджер)
81
+ # The async client can be used as a context manager
76
82
  client = AsyncHivetraceSDK()
77
83
  ```
78
84
 
79
- #### Отправка пользовательского запроса
85
+ ### Send a user prompt (input)
80
86
 
81
87
  ```python
82
88
  response = await client.input(
@@ -85,7 +91,7 @@ response = await client.input(
85
91
  )
86
92
  ```
87
93
 
88
- #### Отправка ответа LLM
94
+ ### Send an LLM response (output)
89
95
 
90
96
  ```python
91
97
  response = await client.output(
@@ -94,11 +100,13 @@ response = await client.output(
94
100
  )
95
101
  ```
96
102
 
103
+ ---
104
+
97
105
  ## Example with Additional Parameters
98
106
 
99
107
  ```python
100
108
  response = client.input(
101
- application_id="your-application-id",
109
+ application_id="your-application-id",
102
110
  message="User prompt here",
103
111
  additional_parameters={
104
112
  "session_id": "your-session-id",
@@ -112,7 +120,9 @@ response = client.input(
112
120
  )
113
121
  ```
114
122
 
115
- > **Note:** `session_id`, `user_id`, and `agent_id` must be valid UUIDs.
123
+ > **Note:** `session_id`, `user_id`, and all agent IDs must be valid UUIDs.
124
+
125
+ ---
116
126
 
117
127
  ## API
118
128
 
@@ -126,27 +136,29 @@ def input(application_id: str, message: str, additional_parameters: dict | None
126
136
  async def input(application_id: str, message: str, additional_parameters: dict | None = None) -> dict: ...
127
137
  ```
128
138
 
129
- Sends a user prompt to Hivetrace.
139
+ Sends a **user prompt** to Hivetrace.
130
140
 
131
- * `application_id`: Application identifier (must be a valid UUID, created in the UI)
132
- * `message`: User prompt
133
- * `additional_parameters`: Dictionary of additional parameters (optional)
141
+ * `application_id` Application identifier (must be a valid UUID, created in the UI)
142
+ * `message` The user prompt
143
+ * `additional_parameters` Optional dictionary with extra context (session, user, agents, etc.)
134
144
 
135
- **Response Example:**
145
+ **Response example:**
136
146
 
137
147
  ```json
138
148
  {
139
- "status": "processed",
140
- "monitoring_result": {
141
- "is_toxic": false,
142
- "type_of_violation": "benign",
143
- "token_count": 9,
144
- "token_usage_warning": false,
145
- "token_usage_unbounded": false
146
- }
149
+ "status": "processed",
150
+ "monitoring_result": {
151
+ "is_toxic": false,
152
+ "type_of_violation": "benign",
153
+ "token_count": 9,
154
+ "token_usage_warning": false,
155
+ "token_usage_unbounded": false
156
+ }
147
157
  }
148
158
  ```
149
159
 
160
+ ---
161
+
150
162
  ### `output`
151
163
 
152
164
  ```python
@@ -157,39 +169,41 @@ def output(application_id: str, message: str, additional_parameters: dict | None
157
169
  async def output(application_id: str, message: str, additional_parameters: dict | None = None) -> dict: ...
158
170
  ```
159
171
 
160
- Sends an LLM response to Hivetrace.
172
+ Sends an **LLM response** to Hivetrace.
161
173
 
162
- * `application_id`: Application identifier (must be a valid UUID, created in the UI)
163
- * `message`: LLM response
164
- * `additional_parameters`: Dictionary of additional parameters (optional)
174
+ * `application_id` Application identifier (must be a valid UUID, created in the UI)
175
+ * `message` — The LLM response
176
+ * `additional_parameters` Optional dictionary with extra context (session, user, agents, etc.)
165
177
 
166
- **Response Example:**
178
+ **Response example:**
167
179
 
168
180
  ```json
169
181
  {
170
- "status": "processed",
171
- "monitoring_result": {
172
- "is_toxic": false,
173
- "type_of_violation": "safe",
174
- "token_count": 21,
175
- "token_usage_warning": false,
176
- "token_usage_unbounded": false
177
- }
182
+ "status": "processed",
183
+ "monitoring_result": {
184
+ "is_toxic": false,
185
+ "type_of_violation": "safe",
186
+ "token_count": 21,
187
+ "token_usage_warning": false,
188
+ "token_usage_unbounded": false
189
+ }
178
190
  }
179
191
  ```
180
192
 
193
+ ---
194
+
181
195
  ## Sending Requests in Sync Mode
182
196
 
183
197
  ```python
184
198
  def main():
185
- # вариант 1: контекстный менеджер
199
+ # option 1: context manager
186
200
  with SyncHivetraceSDK() as client:
187
201
  response = client.input(
188
202
  application_id="your-application-id",
189
203
  message="User prompt here",
190
204
  )
191
205
 
192
- # вариант 2: явное закрытие
206
+ # option 2: manual close
193
207
  client = SyncHivetraceSDK()
194
208
  try:
195
209
  response = client.input(
@@ -202,20 +216,22 @@ def main():
202
216
  main()
203
217
  ```
204
218
 
219
+ ---
220
+
205
221
  ## Sending Requests in Async Mode
206
222
 
207
223
  ```python
208
224
  import asyncio
209
225
 
210
226
  async def main():
211
- # вариант 1: контекстный менеджер
227
+ # option 1: context manager
212
228
  async with AsyncHivetraceSDK() as client:
213
229
  response = await client.input(
214
230
  application_id="your-application-id",
215
231
  message="User prompt here",
216
232
  )
217
233
 
218
- # вариант 2: явное закрытие
234
+ # option 2: manual close
219
235
  client = AsyncHivetraceSDK()
220
236
  try:
221
237
  response = await client.input(
@@ -234,9 +250,17 @@ asyncio.run(main())
234
250
  await client.close()
235
251
  ```
236
252
 
253
+ ---
254
+
237
255
  ## Configuration
238
256
 
239
- The SDK loads configuration from environment variables. The allowed domain (`HIVETRACE_URL`) and API token (`HIVETRACE_ACCESS_TOKEN`) are automatically retrieved from the environment.
257
+ The SDK reads configuration from environment variables:
258
+
259
+ * `HIVETRACE_URL` — Base URL allowed to call.
260
+ * `HIVETRACE_ACCESS_TOKEN` — API token used for authentication.
261
+
262
+ These are loaded automatically when you create a client.
263
+
240
264
 
241
265
  ### Configuration Sources
242
266
 
@@ -2,45 +2,49 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- Hivetrace SDK is designed for integration with the Hivetrace service, providing monitoring of user prompts and LLM responses.
5
+ The Hivetrace SDK lets you integrate with the Hivetrace service to monitor user prompts and LLM responses. It supports both synchronous and asynchronous workflows and can be configured via environment variables.
6
+
7
+ ---
6
8
 
7
9
  ## Installation
8
10
 
9
- Install the SDK via pip:
11
+ Install from PyPI:
10
12
 
11
13
  ```bash
12
14
  pip install hivetrace[base]
13
15
  ```
14
16
 
15
- ## Usage
17
+ ---
18
+
19
+ ## Quick Start
16
20
 
17
21
  ```python
18
22
  from hivetrace import SyncHivetraceSDK, AsyncHivetraceSDK
19
23
  ```
20
24
 
21
- ## Synchronous and Asynchronous Clients
25
+ You can use either the synchronous client (`SyncHivetraceSDK`) or the asynchronous client (`AsyncHivetraceSDK`). Choose the one that fits your runtime.
22
26
 
23
- SDK предоставляет два отдельных клиента: синхронный (`SyncHivetraceSDK`) и асинхронный (`AsyncHivetraceSDK`). Выберите подходящий под ваш режим выполнения.
27
+ ---
24
28
 
25
- ### Sync Mode
29
+ ## Synchronous Client
26
30
 
27
- #### Инициализация (Sync)
31
+ ### Initialize (Sync)
28
32
 
29
33
  ```python
30
- # Sync client (использует переменные окружения или переданный config)
34
+ # The sync client reads configuration from environment variables or accepts an explicit config
31
35
  client = SyncHivetraceSDK()
32
36
  ```
33
37
 
34
- #### Отправка пользовательского запроса
38
+ ### Send a user prompt (input)
35
39
 
36
40
  ```python
37
41
  response = client.input(
38
- application_id="your-application-id", # получен после регистрации приложения в UI
42
+ application_id="your-application-id", # Obtained after registering the application in the UI
39
43
  message="User prompt here",
40
44
  )
41
45
  ```
42
46
 
43
- #### Отправка ответа LLM
47
+ ### Send an LLM response (output)
44
48
 
45
49
  ```python
46
50
  response = client.output(
@@ -49,16 +53,18 @@ response = client.output(
49
53
  )
50
54
  ```
51
55
 
52
- ### Async Mode
56
+ ---
57
+
58
+ ## Asynchronous Client
53
59
 
54
- #### Инициализация (Async)
60
+ ### Initialize (Async)
55
61
 
56
62
  ```python
57
- # Async client (можно использовать как контекстный менеджер)
63
+ # The async client can be used as a context manager
58
64
  client = AsyncHivetraceSDK()
59
65
  ```
60
66
 
61
- #### Отправка пользовательского запроса
67
+ ### Send a user prompt (input)
62
68
 
63
69
  ```python
64
70
  response = await client.input(
@@ -67,7 +73,7 @@ response = await client.input(
67
73
  )
68
74
  ```
69
75
 
70
- #### Отправка ответа LLM
76
+ ### Send an LLM response (output)
71
77
 
72
78
  ```python
73
79
  response = await client.output(
@@ -76,11 +82,13 @@ response = await client.output(
76
82
  )
77
83
  ```
78
84
 
85
+ ---
86
+
79
87
  ## Example with Additional Parameters
80
88
 
81
89
  ```python
82
90
  response = client.input(
83
- application_id="your-application-id",
91
+ application_id="your-application-id",
84
92
  message="User prompt here",
85
93
  additional_parameters={
86
94
  "session_id": "your-session-id",
@@ -94,7 +102,9 @@ response = client.input(
94
102
  )
95
103
  ```
96
104
 
97
- > **Note:** `session_id`, `user_id`, and `agent_id` must be valid UUIDs.
105
+ > **Note:** `session_id`, `user_id`, and all agent IDs must be valid UUIDs.
106
+
107
+ ---
98
108
 
99
109
  ## API
100
110
 
@@ -108,27 +118,29 @@ def input(application_id: str, message: str, additional_parameters: dict | None
108
118
  async def input(application_id: str, message: str, additional_parameters: dict | None = None) -> dict: ...
109
119
  ```
110
120
 
111
- Sends a user prompt to Hivetrace.
121
+ Sends a **user prompt** to Hivetrace.
112
122
 
113
- * `application_id`: Application identifier (must be a valid UUID, created in the UI)
114
- * `message`: User prompt
115
- * `additional_parameters`: Dictionary of additional parameters (optional)
123
+ * `application_id` Application identifier (must be a valid UUID, created in the UI)
124
+ * `message` The user prompt
125
+ * `additional_parameters` Optional dictionary with extra context (session, user, agents, etc.)
116
126
 
117
- **Response Example:**
127
+ **Response example:**
118
128
 
119
129
  ```json
120
130
  {
121
- "status": "processed",
122
- "monitoring_result": {
123
- "is_toxic": false,
124
- "type_of_violation": "benign",
125
- "token_count": 9,
126
- "token_usage_warning": false,
127
- "token_usage_unbounded": false
128
- }
131
+ "status": "processed",
132
+ "monitoring_result": {
133
+ "is_toxic": false,
134
+ "type_of_violation": "benign",
135
+ "token_count": 9,
136
+ "token_usage_warning": false,
137
+ "token_usage_unbounded": false
138
+ }
129
139
  }
130
140
  ```
131
141
 
142
+ ---
143
+
132
144
  ### `output`
133
145
 
134
146
  ```python
@@ -139,39 +151,41 @@ def output(application_id: str, message: str, additional_parameters: dict | None
139
151
  async def output(application_id: str, message: str, additional_parameters: dict | None = None) -> dict: ...
140
152
  ```
141
153
 
142
- Sends an LLM response to Hivetrace.
154
+ Sends an **LLM response** to Hivetrace.
143
155
 
144
- * `application_id`: Application identifier (must be a valid UUID, created in the UI)
145
- * `message`: LLM response
146
- * `additional_parameters`: Dictionary of additional parameters (optional)
156
+ * `application_id` Application identifier (must be a valid UUID, created in the UI)
157
+ * `message` — The LLM response
158
+ * `additional_parameters` Optional dictionary with extra context (session, user, agents, etc.)
147
159
 
148
- **Response Example:**
160
+ **Response example:**
149
161
 
150
162
  ```json
151
163
  {
152
- "status": "processed",
153
- "monitoring_result": {
154
- "is_toxic": false,
155
- "type_of_violation": "safe",
156
- "token_count": 21,
157
- "token_usage_warning": false,
158
- "token_usage_unbounded": false
159
- }
164
+ "status": "processed",
165
+ "monitoring_result": {
166
+ "is_toxic": false,
167
+ "type_of_violation": "safe",
168
+ "token_count": 21,
169
+ "token_usage_warning": false,
170
+ "token_usage_unbounded": false
171
+ }
160
172
  }
161
173
  ```
162
174
 
175
+ ---
176
+
163
177
  ## Sending Requests in Sync Mode
164
178
 
165
179
  ```python
166
180
  def main():
167
- # вариант 1: контекстный менеджер
181
+ # option 1: context manager
168
182
  with SyncHivetraceSDK() as client:
169
183
  response = client.input(
170
184
  application_id="your-application-id",
171
185
  message="User prompt here",
172
186
  )
173
187
 
174
- # вариант 2: явное закрытие
188
+ # option 2: manual close
175
189
  client = SyncHivetraceSDK()
176
190
  try:
177
191
  response = client.input(
@@ -184,20 +198,22 @@ def main():
184
198
  main()
185
199
  ```
186
200
 
201
+ ---
202
+
187
203
  ## Sending Requests in Async Mode
188
204
 
189
205
  ```python
190
206
  import asyncio
191
207
 
192
208
  async def main():
193
- # вариант 1: контекстный менеджер
209
+ # option 1: context manager
194
210
  async with AsyncHivetraceSDK() as client:
195
211
  response = await client.input(
196
212
  application_id="your-application-id",
197
213
  message="User prompt here",
198
214
  )
199
215
 
200
- # вариант 2: явное закрытие
216
+ # option 2: manual close
201
217
  client = AsyncHivetraceSDK()
202
218
  try:
203
219
  response = await client.input(
@@ -216,9 +232,17 @@ asyncio.run(main())
216
232
  await client.close()
217
233
  ```
218
234
 
235
+ ---
236
+
219
237
  ## Configuration
220
238
 
221
- The SDK loads configuration from environment variables. The allowed domain (`HIVETRACE_URL`) and API token (`HIVETRACE_ACCESS_TOKEN`) are automatically retrieved from the environment.
239
+ The SDK reads configuration from environment variables:
240
+
241
+ * `HIVETRACE_URL` — Base URL allowed to call.
242
+ * `HIVETRACE_ACCESS_TOKEN` — API token used for authentication.
243
+
244
+ These are loaded automatically when you create a client.
245
+
222
246
 
223
247
  ### Configuration Sources
224
248
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hivetrace
3
- Version: 1.3.6
3
+ Version: 1.3.7
4
4
  Summary: Hivetrace SDK for monitoring LLM applications
5
5
  Home-page: http://hivetrace.ai
6
6
  Author: Raft
@@ -20,45 +20,49 @@ License-File: LICENSE
20
20
 
21
21
  ## Overview
22
22
 
23
- Hivetrace SDK is designed for integration with the Hivetrace service, providing monitoring of user prompts and LLM responses.
23
+ The Hivetrace SDK lets you integrate with the Hivetrace service to monitor user prompts and LLM responses. It supports both synchronous and asynchronous workflows and can be configured via environment variables.
24
+
25
+ ---
24
26
 
25
27
  ## Installation
26
28
 
27
- Install the SDK via pip:
29
+ Install from PyPI:
28
30
 
29
31
  ```bash
30
32
  pip install hivetrace[base]
31
33
  ```
32
34
 
33
- ## Usage
35
+ ---
36
+
37
+ ## Quick Start
34
38
 
35
39
  ```python
36
40
  from hivetrace import SyncHivetraceSDK, AsyncHivetraceSDK
37
41
  ```
38
42
 
39
- ## Synchronous and Asynchronous Clients
43
+ You can use either the synchronous client (`SyncHivetraceSDK`) or the asynchronous client (`AsyncHivetraceSDK`). Choose the one that fits your runtime.
40
44
 
41
- SDK предоставляет два отдельных клиента: синхронный (`SyncHivetraceSDK`) и асинхронный (`AsyncHivetraceSDK`). Выберите подходящий под ваш режим выполнения.
45
+ ---
42
46
 
43
- ### Sync Mode
47
+ ## Synchronous Client
44
48
 
45
- #### Инициализация (Sync)
49
+ ### Initialize (Sync)
46
50
 
47
51
  ```python
48
- # Sync client (использует переменные окружения или переданный config)
52
+ # The sync client reads configuration from environment variables or accepts an explicit config
49
53
  client = SyncHivetraceSDK()
50
54
  ```
51
55
 
52
- #### Отправка пользовательского запроса
56
+ ### Send a user prompt (input)
53
57
 
54
58
  ```python
55
59
  response = client.input(
56
- application_id="your-application-id", # получен после регистрации приложения в UI
60
+ application_id="your-application-id", # Obtained after registering the application in the UI
57
61
  message="User prompt here",
58
62
  )
59
63
  ```
60
64
 
61
- #### Отправка ответа LLM
65
+ ### Send an LLM response (output)
62
66
 
63
67
  ```python
64
68
  response = client.output(
@@ -67,16 +71,18 @@ response = client.output(
67
71
  )
68
72
  ```
69
73
 
70
- ### Async Mode
74
+ ---
75
+
76
+ ## Asynchronous Client
71
77
 
72
- #### Инициализация (Async)
78
+ ### Initialize (Async)
73
79
 
74
80
  ```python
75
- # Async client (можно использовать как контекстный менеджер)
81
+ # The async client can be used as a context manager
76
82
  client = AsyncHivetraceSDK()
77
83
  ```
78
84
 
79
- #### Отправка пользовательского запроса
85
+ ### Send a user prompt (input)
80
86
 
81
87
  ```python
82
88
  response = await client.input(
@@ -85,7 +91,7 @@ response = await client.input(
85
91
  )
86
92
  ```
87
93
 
88
- #### Отправка ответа LLM
94
+ ### Send an LLM response (output)
89
95
 
90
96
  ```python
91
97
  response = await client.output(
@@ -94,11 +100,13 @@ response = await client.output(
94
100
  )
95
101
  ```
96
102
 
103
+ ---
104
+
97
105
  ## Example with Additional Parameters
98
106
 
99
107
  ```python
100
108
  response = client.input(
101
- application_id="your-application-id",
109
+ application_id="your-application-id",
102
110
  message="User prompt here",
103
111
  additional_parameters={
104
112
  "session_id": "your-session-id",
@@ -112,7 +120,9 @@ response = client.input(
112
120
  )
113
121
  ```
114
122
 
115
- > **Note:** `session_id`, `user_id`, and `agent_id` must be valid UUIDs.
123
+ > **Note:** `session_id`, `user_id`, and all agent IDs must be valid UUIDs.
124
+
125
+ ---
116
126
 
117
127
  ## API
118
128
 
@@ -126,27 +136,29 @@ def input(application_id: str, message: str, additional_parameters: dict | None
126
136
  async def input(application_id: str, message: str, additional_parameters: dict | None = None) -> dict: ...
127
137
  ```
128
138
 
129
- Sends a user prompt to Hivetrace.
139
+ Sends a **user prompt** to Hivetrace.
130
140
 
131
- * `application_id`: Application identifier (must be a valid UUID, created in the UI)
132
- * `message`: User prompt
133
- * `additional_parameters`: Dictionary of additional parameters (optional)
141
+ * `application_id` Application identifier (must be a valid UUID, created in the UI)
142
+ * `message` The user prompt
143
+ * `additional_parameters` Optional dictionary with extra context (session, user, agents, etc.)
134
144
 
135
- **Response Example:**
145
+ **Response example:**
136
146
 
137
147
  ```json
138
148
  {
139
- "status": "processed",
140
- "monitoring_result": {
141
- "is_toxic": false,
142
- "type_of_violation": "benign",
143
- "token_count": 9,
144
- "token_usage_warning": false,
145
- "token_usage_unbounded": false
146
- }
149
+ "status": "processed",
150
+ "monitoring_result": {
151
+ "is_toxic": false,
152
+ "type_of_violation": "benign",
153
+ "token_count": 9,
154
+ "token_usage_warning": false,
155
+ "token_usage_unbounded": false
156
+ }
147
157
  }
148
158
  ```
149
159
 
160
+ ---
161
+
150
162
  ### `output`
151
163
 
152
164
  ```python
@@ -157,39 +169,41 @@ def output(application_id: str, message: str, additional_parameters: dict | None
157
169
  async def output(application_id: str, message: str, additional_parameters: dict | None = None) -> dict: ...
158
170
  ```
159
171
 
160
- Sends an LLM response to Hivetrace.
172
+ Sends an **LLM response** to Hivetrace.
161
173
 
162
- * `application_id`: Application identifier (must be a valid UUID, created in the UI)
163
- * `message`: LLM response
164
- * `additional_parameters`: Dictionary of additional parameters (optional)
174
+ * `application_id` Application identifier (must be a valid UUID, created in the UI)
175
+ * `message` — The LLM response
176
+ * `additional_parameters` Optional dictionary with extra context (session, user, agents, etc.)
165
177
 
166
- **Response Example:**
178
+ **Response example:**
167
179
 
168
180
  ```json
169
181
  {
170
- "status": "processed",
171
- "monitoring_result": {
172
- "is_toxic": false,
173
- "type_of_violation": "safe",
174
- "token_count": 21,
175
- "token_usage_warning": false,
176
- "token_usage_unbounded": false
177
- }
182
+ "status": "processed",
183
+ "monitoring_result": {
184
+ "is_toxic": false,
185
+ "type_of_violation": "safe",
186
+ "token_count": 21,
187
+ "token_usage_warning": false,
188
+ "token_usage_unbounded": false
189
+ }
178
190
  }
179
191
  ```
180
192
 
193
+ ---
194
+
181
195
  ## Sending Requests in Sync Mode
182
196
 
183
197
  ```python
184
198
  def main():
185
- # вариант 1: контекстный менеджер
199
+ # option 1: context manager
186
200
  with SyncHivetraceSDK() as client:
187
201
  response = client.input(
188
202
  application_id="your-application-id",
189
203
  message="User prompt here",
190
204
  )
191
205
 
192
- # вариант 2: явное закрытие
206
+ # option 2: manual close
193
207
  client = SyncHivetraceSDK()
194
208
  try:
195
209
  response = client.input(
@@ -202,20 +216,22 @@ def main():
202
216
  main()
203
217
  ```
204
218
 
219
+ ---
220
+
205
221
  ## Sending Requests in Async Mode
206
222
 
207
223
  ```python
208
224
  import asyncio
209
225
 
210
226
  async def main():
211
- # вариант 1: контекстный менеджер
227
+ # option 1: context manager
212
228
  async with AsyncHivetraceSDK() as client:
213
229
  response = await client.input(
214
230
  application_id="your-application-id",
215
231
  message="User prompt here",
216
232
  )
217
233
 
218
- # вариант 2: явное закрытие
234
+ # option 2: manual close
219
235
  client = AsyncHivetraceSDK()
220
236
  try:
221
237
  response = await client.input(
@@ -234,9 +250,17 @@ asyncio.run(main())
234
250
  await client.close()
235
251
  ```
236
252
 
253
+ ---
254
+
237
255
  ## Configuration
238
256
 
239
- The SDK loads configuration from environment variables. The allowed domain (`HIVETRACE_URL`) and API token (`HIVETRACE_ACCESS_TOKEN`) are automatically retrieved from the environment.
257
+ The SDK reads configuration from environment variables:
258
+
259
+ * `HIVETRACE_URL` — Base URL allowed to call.
260
+ * `HIVETRACE_ACCESS_TOKEN` — API token used for authentication.
261
+
262
+ These are loaded automatically when you create a client.
263
+
240
264
 
241
265
  ### Configuration Sources
242
266
 
@@ -28,7 +28,7 @@ openai_agents_requires = [
28
28
 
29
29
  setup(
30
30
  name="hivetrace",
31
- version="1.3.6",
31
+ version="1.3.7",
32
32
  author="Raft",
33
33
  author_email="sales@raftds.com",
34
34
  description="Hivetrace SDK for monitoring LLM applications",
File without changes
File without changes