hivetrace 1.3.6__py3-none-any.whl → 1.3.7__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.
- {hivetrace-1.3.6.dist-info → hivetrace-1.3.7.dist-info}/METADATA +74 -50
- {hivetrace-1.3.6.dist-info → hivetrace-1.3.7.dist-info}/RECORD +5 -5
- {hivetrace-1.3.6.dist-info → hivetrace-1.3.7.dist-info}/LICENSE +0 -0
- {hivetrace-1.3.6.dist-info → hivetrace-1.3.7.dist-info}/WHEEL +0 -0
- {hivetrace-1.3.6.dist-info → hivetrace-1.3.7.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hivetrace
|
|
3
|
-
Version: 1.3.
|
|
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
|
|
@@ -38,45 +38,49 @@ Requires-Dist: openai-agents >=0.1.0 ; extra == 'openai_agents'
|
|
|
38
38
|
|
|
39
39
|
## Overview
|
|
40
40
|
|
|
41
|
-
Hivetrace SDK
|
|
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
|
|
47
|
+
Install from PyPI:
|
|
46
48
|
|
|
47
49
|
```bash
|
|
48
50
|
pip install hivetrace[base]
|
|
49
51
|
```
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
52
56
|
|
|
53
57
|
```python
|
|
54
58
|
from hivetrace import SyncHivetraceSDK, AsyncHivetraceSDK
|
|
55
59
|
```
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
You can use either the synchronous client (`SyncHivetraceSDK`) or the asynchronous client (`AsyncHivetraceSDK`). Choose the one that fits your runtime.
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
---
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
## Synchronous Client
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
### Initialize (Sync)
|
|
64
68
|
|
|
65
69
|
```python
|
|
66
|
-
#
|
|
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", #
|
|
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
|
-
|
|
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
|
-
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Asynchronous Client
|
|
89
95
|
|
|
90
|
-
|
|
96
|
+
### Initialize (Async)
|
|
91
97
|
|
|
92
98
|
```python
|
|
93
|
-
#
|
|
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
|
-
|
|
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
|
|
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
|
|
150
|
-
* `message
|
|
151
|
-
* `additional_parameters
|
|
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
|
|
163
|
+
**Response example:**
|
|
154
164
|
|
|
155
165
|
```json
|
|
156
166
|
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
|
181
|
-
* `message
|
|
182
|
-
* `additional_parameters
|
|
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
|
|
196
|
+
**Response example:**
|
|
185
197
|
|
|
186
198
|
```json
|
|
187
199
|
{
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
|
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
|
|
|
@@ -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.
|
|
42
|
-
hivetrace-1.3.
|
|
43
|
-
hivetrace-1.3.
|
|
44
|
-
hivetrace-1.3.
|
|
45
|
-
hivetrace-1.3.
|
|
41
|
+
hivetrace-1.3.7.dist-info/LICENSE,sha256=8d3g3prbWPDLQ5AV0dtyWfYTj5QPl8MJ_wlr2l8pjEU,11333
|
|
42
|
+
hivetrace-1.3.7.dist-info/METADATA,sha256=FfxxOqtTC2RWlESYdqK-WWr0xRH47el7iUAsjc_cFnk,25793
|
|
43
|
+
hivetrace-1.3.7.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
44
|
+
hivetrace-1.3.7.dist-info/top_level.txt,sha256=F6mZCzZ5CSftMc-M0NeOYWbwyTzjybR72P4qSBMyZZM,10
|
|
45
|
+
hivetrace-1.3.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|