hivetrace 1.3.6__py3-none-any.whl → 1.3.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hivetrace
3
- Version: 1.3.6
3
+ Version: 1.3.8
4
4
  Summary: Hivetrace SDK for monitoring LLM applications
5
5
  Home-page: http://hivetrace.ai
6
6
  Author: Raft
@@ -38,45 +38,49 @@ Requires-Dist: openai-agents >=0.1.0 ; extra == 'openai_agents'
38
38
 
39
39
  ## Overview
40
40
 
41
- Hivetrace SDK is designed for integration with the Hivetrace service, providing monitoring of user prompts and LLM responses.
41
+ 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.
42
+
43
+ ---
42
44
 
43
45
  ## Installation
44
46
 
45
- Install the SDK via pip:
47
+ Install from PyPI:
46
48
 
47
49
  ```bash
48
50
  pip install hivetrace[base]
49
51
  ```
50
52
 
51
- ## Usage
53
+ ---
54
+
55
+ ## Quick Start
52
56
 
53
57
  ```python
54
58
  from hivetrace import SyncHivetraceSDK, AsyncHivetraceSDK
55
59
  ```
56
60
 
57
- ## Synchronous and Asynchronous Clients
61
+ You can use either the synchronous client (`SyncHivetraceSDK`) or the asynchronous client (`AsyncHivetraceSDK`). Choose the one that fits your runtime.
58
62
 
59
- SDK предоставляет два отдельных клиента: синхронный (`SyncHivetraceSDK`) и асинхронный (`AsyncHivetraceSDK`). Выберите подходящий под ваш режим выполнения.
63
+ ---
60
64
 
61
- ### Sync Mode
65
+ ## Synchronous Client
62
66
 
63
- #### Инициализация (Sync)
67
+ ### Initialize (Sync)
64
68
 
65
69
  ```python
66
- # Sync client (использует переменные окружения или переданный config)
70
+ # The sync client reads configuration from environment variables or accepts an explicit config
67
71
  client = SyncHivetraceSDK()
68
72
  ```
69
73
 
70
- #### Отправка пользовательского запроса
74
+ ### Send a user prompt (input)
71
75
 
72
76
  ```python
73
77
  response = client.input(
74
- application_id="your-application-id", # получен после регистрации приложения в UI
78
+ application_id="your-application-id", # Obtained after registering the application in the UI
75
79
  message="User prompt here",
76
80
  )
77
81
  ```
78
82
 
79
- #### Отправка ответа LLM
83
+ ### Send an LLM response (output)
80
84
 
81
85
  ```python
82
86
  response = client.output(
@@ -85,16 +89,18 @@ response = client.output(
85
89
  )
86
90
  ```
87
91
 
88
- ### Async Mode
92
+ ---
93
+
94
+ ## Asynchronous Client
89
95
 
90
- #### Инициализация (Async)
96
+ ### Initialize (Async)
91
97
 
92
98
  ```python
93
- # Async client (можно использовать как контекстный менеджер)
99
+ # The async client can be used as a context manager
94
100
  client = AsyncHivetraceSDK()
95
101
  ```
96
102
 
97
- #### Отправка пользовательского запроса
103
+ ### Send a user prompt (input)
98
104
 
99
105
  ```python
100
106
  response = await client.input(
@@ -103,7 +109,7 @@ response = await client.input(
103
109
  )
104
110
  ```
105
111
 
106
- #### Отправка ответа LLM
112
+ ### Send an LLM response (output)
107
113
 
108
114
  ```python
109
115
  response = await client.output(
@@ -112,11 +118,13 @@ response = await client.output(
112
118
  )
113
119
  ```
114
120
 
121
+ ---
122
+
115
123
  ## Example with Additional Parameters
116
124
 
117
125
  ```python
118
126
  response = client.input(
119
- application_id="your-application-id",
127
+ application_id="your-application-id",
120
128
  message="User prompt here",
121
129
  additional_parameters={
122
130
  "session_id": "your-session-id",
@@ -130,7 +138,9 @@ response = client.input(
130
138
  )
131
139
  ```
132
140
 
133
- > **Note:** `session_id`, `user_id`, and `agent_id` must be valid UUIDs.
141
+ > **Note:** `session_id`, `user_id`, and all agent IDs must be valid UUIDs.
142
+
143
+ ---
134
144
 
135
145
  ## API
136
146
 
@@ -144,27 +154,29 @@ def input(application_id: str, message: str, additional_parameters: dict | None
144
154
  async def input(application_id: str, message: str, additional_parameters: dict | None = None) -> dict: ...
145
155
  ```
146
156
 
147
- Sends a user prompt to Hivetrace.
157
+ Sends a **user prompt** to Hivetrace.
148
158
 
149
- * `application_id`: Application identifier (must be a valid UUID, created in the UI)
150
- * `message`: User prompt
151
- * `additional_parameters`: Dictionary of additional parameters (optional)
159
+ * `application_id` Application identifier (must be a valid UUID, created in the UI)
160
+ * `message` The user prompt
161
+ * `additional_parameters` Optional dictionary with extra context (session, user, agents, etc.)
152
162
 
153
- **Response Example:**
163
+ **Response example:**
154
164
 
155
165
  ```json
156
166
  {
157
- "status": "processed",
158
- "monitoring_result": {
159
- "is_toxic": false,
160
- "type_of_violation": "benign",
161
- "token_count": 9,
162
- "token_usage_warning": false,
163
- "token_usage_unbounded": false
164
- }
167
+ "status": "processed",
168
+ "monitoring_result": {
169
+ "is_toxic": false,
170
+ "type_of_violation": "benign",
171
+ "token_count": 9,
172
+ "token_usage_warning": false,
173
+ "token_usage_unbounded": false
174
+ }
165
175
  }
166
176
  ```
167
177
 
178
+ ---
179
+
168
180
  ### `output`
169
181
 
170
182
  ```python
@@ -175,39 +187,41 @@ def output(application_id: str, message: str, additional_parameters: dict | None
175
187
  async def output(application_id: str, message: str, additional_parameters: dict | None = None) -> dict: ...
176
188
  ```
177
189
 
178
- Sends an LLM response to Hivetrace.
190
+ Sends an **LLM response** to Hivetrace.
179
191
 
180
- * `application_id`: Application identifier (must be a valid UUID, created in the UI)
181
- * `message`: LLM response
182
- * `additional_parameters`: Dictionary of additional parameters (optional)
192
+ * `application_id` Application identifier (must be a valid UUID, created in the UI)
193
+ * `message` — The LLM response
194
+ * `additional_parameters` Optional dictionary with extra context (session, user, agents, etc.)
183
195
 
184
- **Response Example:**
196
+ **Response example:**
185
197
 
186
198
  ```json
187
199
  {
188
- "status": "processed",
189
- "monitoring_result": {
190
- "is_toxic": false,
191
- "type_of_violation": "safe",
192
- "token_count": 21,
193
- "token_usage_warning": false,
194
- "token_usage_unbounded": false
195
- }
200
+ "status": "processed",
201
+ "monitoring_result": {
202
+ "is_toxic": false,
203
+ "type_of_violation": "safe",
204
+ "token_count": 21,
205
+ "token_usage_warning": false,
206
+ "token_usage_unbounded": false
207
+ }
196
208
  }
197
209
  ```
198
210
 
211
+ ---
212
+
199
213
  ## Sending Requests in Sync Mode
200
214
 
201
215
  ```python
202
216
  def main():
203
- # вариант 1: контекстный менеджер
217
+ # option 1: context manager
204
218
  with SyncHivetraceSDK() as client:
205
219
  response = client.input(
206
220
  application_id="your-application-id",
207
221
  message="User prompt here",
208
222
  )
209
223
 
210
- # вариант 2: явное закрытие
224
+ # option 2: manual close
211
225
  client = SyncHivetraceSDK()
212
226
  try:
213
227
  response = client.input(
@@ -220,20 +234,22 @@ def main():
220
234
  main()
221
235
  ```
222
236
 
237
+ ---
238
+
223
239
  ## Sending Requests in Async Mode
224
240
 
225
241
  ```python
226
242
  import asyncio
227
243
 
228
244
  async def main():
229
- # вариант 1: контекстный менеджер
245
+ # option 1: context manager
230
246
  async with AsyncHivetraceSDK() as client:
231
247
  response = await client.input(
232
248
  application_id="your-application-id",
233
249
  message="User prompt here",
234
250
  )
235
251
 
236
- # вариант 2: явное закрытие
252
+ # option 2: manual close
237
253
  client = AsyncHivetraceSDK()
238
254
  try:
239
255
  response = await client.input(
@@ -252,9 +268,17 @@ asyncio.run(main())
252
268
  await client.close()
253
269
  ```
254
270
 
271
+ ---
272
+
255
273
  ## Configuration
256
274
 
257
- The SDK loads configuration from environment variables. The allowed domain (`HIVETRACE_URL`) and API token (`HIVETRACE_ACCESS_TOKEN`) are automatically retrieved from the environment.
275
+ The SDK reads configuration from environment variables:
276
+
277
+ * `HIVETRACE_URL` — Base URL allowed to call.
278
+ * `HIVETRACE_ACCESS_TOKEN` — API token used for authentication.
279
+
280
+ These are loaded automatically when you create a client.
281
+
258
282
 
259
283
  ### Configuration Sources
260
284
 
@@ -903,3 +927,8 @@ def calculate_sum(a: int, b: int) -> int:
903
927
  Add this tool to your agent’s `tools=[...]` — and its calls will appear in HiveTrace with inputs/outputs.
904
928
 
905
929
  ---
930
+
931
+ License
932
+ ========
933
+
934
+ This project is licensed under Apache License 2.0.
@@ -38,8 +38,8 @@ hivetrace/models/responses.py,sha256=zTcbCZ8GbIjhswb_yR7O3PmRuZaxGWOVtqSRfCy2jNA
38
38
  hivetrace/utils/__init__.py,sha256=BNYbeSuUbrZL7RradjE_OFAxam3L6eexbL2IMfjImv0,747
39
39
  hivetrace/utils/error_helpers.py,sha256=egVQpENputLR8exNpV1cui2LSHqbf8pI6SHRbLdxOX8,2661
40
40
  hivetrace/utils/uuid_generator.py,sha256=W4i2tUSyClNKNgm4O-bk_Qkkmw3cWIuf29DjwXftx0c,344
41
- hivetrace-1.3.6.dist-info/LICENSE,sha256=8d3g3prbWPDLQ5AV0dtyWfYTj5QPl8MJ_wlr2l8pjEU,11333
42
- hivetrace-1.3.6.dist-info/METADATA,sha256=RGRqSBl0bRQhxqF_DnesUru8zPDSNR4aBdmSb-6tIyc,26029
43
- hivetrace-1.3.6.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
44
- hivetrace-1.3.6.dist-info/top_level.txt,sha256=F6mZCzZ5CSftMc-M0NeOYWbwyTzjybR72P4qSBMyZZM,10
45
- hivetrace-1.3.6.dist-info/RECORD,,
41
+ hivetrace-1.3.8.dist-info/LICENSE,sha256=8d3g3prbWPDLQ5AV0dtyWfYTj5QPl8MJ_wlr2l8pjEU,11333
42
+ hivetrace-1.3.8.dist-info/METADATA,sha256=cr1NUfYq_-_ppIS7lDTIx7nJRdjggy_50ZoBAP5KE3s,25863
43
+ hivetrace-1.3.8.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
44
+ hivetrace-1.3.8.dist-info/top_level.txt,sha256=F6mZCzZ5CSftMc-M0NeOYWbwyTzjybR72P4qSBMyZZM,10
45
+ hivetrace-1.3.8.dist-info/RECORD,,