hiddenlayer-sdk 3.0.0__py3-none-any.whl → 3.0.1__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.
- hiddenlayer/_version.py +1 -1
- {hiddenlayer_sdk-3.0.0.dist-info → hiddenlayer_sdk-3.0.1.dist-info}/METADATA +115 -25
- {hiddenlayer_sdk-3.0.0.dist-info → hiddenlayer_sdk-3.0.1.dist-info}/RECORD +5 -5
- {hiddenlayer_sdk-3.0.0.dist-info → hiddenlayer_sdk-3.0.1.dist-info}/WHEEL +0 -0
- {hiddenlayer_sdk-3.0.0.dist-info → hiddenlayer_sdk-3.0.1.dist-info}/licenses/LICENSE +0 -0
hiddenlayer/_version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: hiddenlayer-sdk
|
3
|
-
Version: 3.0.
|
3
|
+
Version: 3.0.1
|
4
4
|
Summary: The official Python library for the hiddenlayer API
|
5
5
|
Project-URL: Homepage, https://github.com/hiddenlayerai/hiddenlayer-sdk-python
|
6
6
|
Project-URL: Repository, https://github.com/hiddenlayerai/hiddenlayer-sdk-python
|
@@ -70,10 +70,21 @@ client = HiddenLayer(
|
|
70
70
|
environment="prod-eu",
|
71
71
|
)
|
72
72
|
|
73
|
-
|
74
|
-
|
73
|
+
response = client.interactions.analyze(
|
74
|
+
metadata={
|
75
|
+
"model": "REPLACE_ME",
|
76
|
+
"requester_id": "REPLACE_ME",
|
77
|
+
},
|
78
|
+
input={
|
79
|
+
"messages": [
|
80
|
+
{
|
81
|
+
"role": "user",
|
82
|
+
"content": "REPLACE_ME",
|
83
|
+
}
|
84
|
+
]
|
85
|
+
},
|
75
86
|
)
|
76
|
-
print(
|
87
|
+
print(response.analysis)
|
77
88
|
```
|
78
89
|
|
79
90
|
While you can provide a `bearer_token` keyword argument,
|
@@ -96,10 +107,21 @@ client = AsyncHiddenLayer(
|
|
96
107
|
|
97
108
|
|
98
109
|
async def main() -> None:
|
99
|
-
|
100
|
-
|
110
|
+
response = await client.interactions.analyze(
|
111
|
+
metadata={
|
112
|
+
"model": "REPLACE_ME",
|
113
|
+
"requester_id": "REPLACE_ME",
|
114
|
+
},
|
115
|
+
input={
|
116
|
+
"messages": [
|
117
|
+
{
|
118
|
+
"role": "user",
|
119
|
+
"content": "REPLACE_ME",
|
120
|
+
}
|
121
|
+
]
|
122
|
+
},
|
101
123
|
)
|
102
|
-
print(
|
124
|
+
print(response.analysis)
|
103
125
|
|
104
126
|
|
105
127
|
asyncio.run(main())
|
@@ -130,10 +152,21 @@ async def main() -> None:
|
|
130
152
|
async with AsyncHiddenLayer(
|
131
153
|
http_client=DefaultAioHttpClient(),
|
132
154
|
) as client:
|
133
|
-
|
134
|
-
|
155
|
+
response = await client.interactions.analyze(
|
156
|
+
metadata={
|
157
|
+
"model": "REPLACE_ME",
|
158
|
+
"requester_id": "REPLACE_ME",
|
159
|
+
},
|
160
|
+
input={
|
161
|
+
"messages": [
|
162
|
+
{
|
163
|
+
"role": "user",
|
164
|
+
"content": "REPLACE_ME",
|
165
|
+
}
|
166
|
+
]
|
167
|
+
},
|
135
168
|
)
|
136
|
-
print(
|
169
|
+
print(response.analysis)
|
137
170
|
|
138
171
|
|
139
172
|
asyncio.run(main())
|
@@ -157,10 +190,14 @@ from hiddenlayer import HiddenLayer
|
|
157
190
|
|
158
191
|
client = HiddenLayer()
|
159
192
|
|
160
|
-
|
161
|
-
|
193
|
+
response = client.interactions.analyze(
|
194
|
+
metadata={
|
195
|
+
"model": "gpt-5",
|
196
|
+
"requester_id": "user-1234",
|
197
|
+
"provider": "openai",
|
198
|
+
},
|
162
199
|
)
|
163
|
-
print(
|
200
|
+
print(response.metadata)
|
164
201
|
```
|
165
202
|
|
166
203
|
## Handling errors
|
@@ -179,8 +216,19 @@ from hiddenlayer import HiddenLayer
|
|
179
216
|
client = HiddenLayer()
|
180
217
|
|
181
218
|
try:
|
182
|
-
client.
|
183
|
-
|
219
|
+
client.interactions.analyze(
|
220
|
+
metadata={
|
221
|
+
"model": "REPLACE_ME",
|
222
|
+
"requester_id": "REPLACE_ME",
|
223
|
+
},
|
224
|
+
input={
|
225
|
+
"messages": [
|
226
|
+
{
|
227
|
+
"role": "user",
|
228
|
+
"content": "REPLACE_ME",
|
229
|
+
}
|
230
|
+
]
|
231
|
+
},
|
184
232
|
)
|
185
233
|
except hiddenlayer.APIConnectionError as e:
|
186
234
|
print("The server could not be reached")
|
@@ -224,8 +272,19 @@ client = HiddenLayer(
|
|
224
272
|
)
|
225
273
|
|
226
274
|
# Or, configure per-request:
|
227
|
-
client.with_options(max_retries=5).
|
228
|
-
|
275
|
+
client.with_options(max_retries=5).interactions.analyze(
|
276
|
+
metadata={
|
277
|
+
"model": "REPLACE_ME",
|
278
|
+
"requester_id": "REPLACE_ME",
|
279
|
+
},
|
280
|
+
input={
|
281
|
+
"messages": [
|
282
|
+
{
|
283
|
+
"role": "user",
|
284
|
+
"content": "REPLACE_ME",
|
285
|
+
}
|
286
|
+
]
|
287
|
+
},
|
229
288
|
)
|
230
289
|
```
|
231
290
|
|
@@ -249,8 +308,19 @@ client = HiddenLayer(
|
|
249
308
|
)
|
250
309
|
|
251
310
|
# Override per-request:
|
252
|
-
client.with_options(timeout=5.0).
|
253
|
-
|
311
|
+
client.with_options(timeout=5.0).interactions.analyze(
|
312
|
+
metadata={
|
313
|
+
"model": "REPLACE_ME",
|
314
|
+
"requester_id": "REPLACE_ME",
|
315
|
+
},
|
316
|
+
input={
|
317
|
+
"messages": [
|
318
|
+
{
|
319
|
+
"role": "user",
|
320
|
+
"content": "REPLACE_ME",
|
321
|
+
}
|
322
|
+
]
|
323
|
+
},
|
254
324
|
)
|
255
325
|
```
|
256
326
|
|
@@ -292,13 +362,22 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
292
362
|
from hiddenlayer import HiddenLayer
|
293
363
|
|
294
364
|
client = HiddenLayer()
|
295
|
-
response = client.
|
296
|
-
|
365
|
+
response = client.interactions.with_raw_response.analyze(
|
366
|
+
metadata={
|
367
|
+
"model": "REPLACE_ME",
|
368
|
+
"requester_id": "REPLACE_ME",
|
369
|
+
},
|
370
|
+
input={
|
371
|
+
"messages": [{
|
372
|
+
"role": "user",
|
373
|
+
"content": "REPLACE_ME",
|
374
|
+
}]
|
375
|
+
},
|
297
376
|
)
|
298
377
|
print(response.headers.get('X-My-Header'))
|
299
378
|
|
300
|
-
|
301
|
-
print(
|
379
|
+
interaction = response.parse() # get the object that `interactions.analyze()` would have returned
|
380
|
+
print(interaction.analysis)
|
302
381
|
```
|
303
382
|
|
304
383
|
These methods return an [`APIResponse`](https://github.com/hiddenlayerai/hiddenlayer-sdk-python/tree/main/src/hiddenlayer/_response.py) object.
|
@@ -312,8 +391,19 @@ The above interface eagerly reads the full response body when you make the reque
|
|
312
391
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
313
392
|
|
314
393
|
```python
|
315
|
-
with client.
|
316
|
-
|
394
|
+
with client.interactions.with_streaming_response.analyze(
|
395
|
+
metadata={
|
396
|
+
"model": "REPLACE_ME",
|
397
|
+
"requester_id": "REPLACE_ME",
|
398
|
+
},
|
399
|
+
input={
|
400
|
+
"messages": [
|
401
|
+
{
|
402
|
+
"role": "user",
|
403
|
+
"content": "REPLACE_ME",
|
404
|
+
}
|
405
|
+
]
|
406
|
+
},
|
317
407
|
) as response:
|
318
408
|
print(response.headers.get("X-My-Header"))
|
319
409
|
|
@@ -12,7 +12,7 @@ hiddenlayer/_resource.py,sha256=2gb_vW4S82SKkbromH5bXbjusfdkg50fqatzePjeU44,1130
|
|
12
12
|
hiddenlayer/_response.py,sha256=NQRPhM9il3hR8Oh8HyH-aAGHn2-y464jtVbTWt5SfAU,28848
|
13
13
|
hiddenlayer/_streaming.py,sha256=nI65s60yoKWveXysHG-Ly-moTTIbn44wSVTb6A1wxyU,10120
|
14
14
|
hiddenlayer/_types.py,sha256=jJ_NDtjSV3hOcBV3vEPtp5ORmpoKIKnrD_uqvwzFzb8,7241
|
15
|
-
hiddenlayer/_version.py,sha256=
|
15
|
+
hiddenlayer/_version.py,sha256=OB7zD1GDSoq7oHiTUkL0ubMnRRH9Pq9xtuR8eGru_u0,163
|
16
16
|
hiddenlayer/pagination.py,sha256=WQtuZxl0jOJBsIRn8-IxBqbv2F4HzDBYzY1gLlXIqds,3558
|
17
17
|
hiddenlayer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
18
|
hiddenlayer/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
|
@@ -76,7 +76,7 @@ hiddenlayer/types/scans/upload_start_response.py,sha256=wDzz5DDAC0MIDKAdMsHa0Y1G
|
|
76
76
|
hiddenlayer/types/scans/upload/__init__.py,sha256=NVyWXWAU49cRCA-8XaJvK4HSkFh7t7bEWDjuJ3gwSnM,270
|
77
77
|
hiddenlayer/types/scans/upload/file_add_response.py,sha256=oqEXlFo6XlmPlaJgr6l4yjx6Mp20LNfSbvzKrMxZsjU,492
|
78
78
|
hiddenlayer/types/scans/upload/file_complete_response.py,sha256=zhoV24Z_dyD0aP174viJyno5b8P7BG4hizOtPGdps0I,305
|
79
|
-
hiddenlayer_sdk-3.0.
|
80
|
-
hiddenlayer_sdk-3.0.
|
81
|
-
hiddenlayer_sdk-3.0.
|
82
|
-
hiddenlayer_sdk-3.0.
|
79
|
+
hiddenlayer_sdk-3.0.1.dist-info/METADATA,sha256=hPtSxHNAJIAf_rpNIuf_ETeureHmh4RVnQrGePKgn5A,16356
|
80
|
+
hiddenlayer_sdk-3.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
81
|
+
hiddenlayer_sdk-3.0.1.dist-info/licenses/LICENSE,sha256=5_TlOiFFpqKABs8i1L9AimAZ096K4ItapeGm2Qo-RiA,11341
|
82
|
+
hiddenlayer_sdk-3.0.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|