langtrace-python-sdk 1.3.6__py3-none-any.whl → 2.0.0__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.
Files changed (54) hide show
  1. examples/anthropic_example/completion.py +6 -6
  2. examples/cohere_example/chat.py +5 -4
  3. examples/cohere_example/chat_stream.py +2 -4
  4. examples/cohere_example/{embed_create.py → embed.py} +4 -3
  5. examples/cohere_example/rerank.py +31 -0
  6. examples/cohere_example/tools.py +40 -0
  7. examples/openai_example/chat_completion.py +41 -0
  8. examples/{openai → openai_example}/embeddings_create.py +3 -2
  9. examples/{openai → openai_example}/function_calling.py +3 -5
  10. examples/{openai → openai_example}/images_generate.py +1 -1
  11. examples/openai_example/tool_calling.py +67 -0
  12. examples/{openai → openai_example}/tool_calling_nonstreaming.py +2 -1
  13. langtrace_python_sdk/__init__.py +14 -1
  14. langtrace_python_sdk/constants/instrumentation/cohere.py +6 -1
  15. langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +16 -4
  16. langtrace_python_sdk/instrumentation/anthropic/patch.py +26 -6
  17. langtrace_python_sdk/instrumentation/chroma/instrumentation.py +14 -2
  18. langtrace_python_sdk/instrumentation/chroma/patch.py +16 -4
  19. langtrace_python_sdk/instrumentation/cohere/instrumentation.py +24 -7
  20. langtrace_python_sdk/instrumentation/cohere/patch.py +295 -95
  21. langtrace_python_sdk/instrumentation/langchain/instrumentation.py +14 -3
  22. langtrace_python_sdk/instrumentation/langchain/patch.py +16 -4
  23. langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +15 -2
  24. langtrace_python_sdk/instrumentation/langchain_community/patch.py +20 -3
  25. langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +14 -4
  26. langtrace_python_sdk/instrumentation/langchain_core/patch.py +19 -7
  27. langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +15 -11
  28. langtrace_python_sdk/instrumentation/llamaindex/patch.py +20 -10
  29. langtrace_python_sdk/instrumentation/openai/instrumentation.py +20 -9
  30. langtrace_python_sdk/instrumentation/openai/patch.py +112 -78
  31. langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +14 -3
  32. langtrace_python_sdk/instrumentation/pinecone/patch.py +17 -4
  33. langtrace_python_sdk/langtrace.py +40 -35
  34. langtrace_python_sdk/utils/llm.py +17 -4
  35. langtrace_python_sdk/utils/with_root_span.py +21 -5
  36. langtrace_python_sdk/version.py +1 -1
  37. {langtrace_python_sdk-1.3.6.dist-info → langtrace_python_sdk-2.0.0.dist-info}/METADATA +2 -2
  38. {langtrace_python_sdk-1.3.6.dist-info → langtrace_python_sdk-2.0.0.dist-info}/RECORD +53 -45
  39. tests/anthropic/cassettes/test_anthropic.yaml +85 -0
  40. tests/anthropic/cassettes/test_anthropic_streaming.yaml +456 -0
  41. tests/anthropic/cassettes/test_async_anthropic_streaming.yaml +328 -0
  42. tests/anthropic/conftest.py +38 -0
  43. tests/anthropic/test_anthropic.py +108 -72
  44. tests/conftest.py +17 -0
  45. tests/openai/conftest.py +5 -13
  46. tests/openai/test_chat_completion.py +21 -0
  47. tests/openai/test_image_generation.py +20 -8
  48. examples/openai/chat_completion.py +0 -58
  49. /examples/{openai → openai_example}/__init__.py +0 -0
  50. /examples/{openai → openai_example}/async_tool_calling_nonstreaming.py +0 -0
  51. /examples/{openai → openai_example}/async_tool_calling_streaming.py +0 -0
  52. /examples/{openai → openai_example}/tool_calling_streaming.py +0 -0
  53. {langtrace_python_sdk-1.3.6.dist-info → langtrace_python_sdk-2.0.0.dist-info}/WHEEL +0 -0
  54. {langtrace_python_sdk-1.3.6.dist-info → langtrace_python_sdk-2.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,456 @@
1
+ interactions:
2
+ - request:
3
+ body: '{"max_tokens": 1024, "messages": [{"role": "user", "content": "How are
4
+ you today?"}], "model": "claude-3-opus-20240229", "stream": true}'
5
+ headers:
6
+ accept:
7
+ - application/json
8
+ accept-encoding:
9
+ - gzip, deflate
10
+ anthropic-version:
11
+ - '2023-06-01'
12
+ connection:
13
+ - keep-alive
14
+ content-length:
15
+ - '136'
16
+ content-type:
17
+ - application/json
18
+ host:
19
+ - api.anthropic.com
20
+ user-agent:
21
+ - Anthropic/Python 0.25.6
22
+ x-stainless-arch:
23
+ - arm64
24
+ x-stainless-async:
25
+ - 'false'
26
+ x-stainless-lang:
27
+ - python
28
+ x-stainless-os:
29
+ - MacOS
30
+ x-stainless-package-version:
31
+ - 0.25.6
32
+ x-stainless-runtime:
33
+ - CPython
34
+ x-stainless-runtime-version:
35
+ - 3.11.5
36
+ method: POST
37
+ uri: https://api.anthropic.com/v1/messages
38
+ response:
39
+ body:
40
+ string: 'event: message_start
41
+
42
+ data: {"type":"message_start","message":{"id":"msg_016BhY7v29utzE6bKzyZHvyb","type":"message","role":"assistant","model":"claude-3-opus-20240229","stop_sequence":null,"usage":{"input_tokens":12,"output_tokens":1},"content":[],"stop_reason":null} }
43
+
44
+
45
+ event: content_block_start
46
+
47
+ data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} }
48
+
49
+
50
+ event: ping
51
+
52
+ data: {"type": "ping"}
53
+
54
+
55
+ event: content_block_delta
56
+
57
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"As"} }
58
+
59
+
60
+ event: content_block_delta
61
+
62
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
63
+ an"} }
64
+
65
+
66
+ event: content_block_delta
67
+
68
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
69
+ AI"} }
70
+
71
+
72
+ event: content_block_delta
73
+
74
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
75
+ language"} }
76
+
77
+
78
+ event: content_block_delta
79
+
80
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
81
+ model"} }
82
+
83
+
84
+ event: content_block_delta
85
+
86
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":","} }
87
+
88
+
89
+ event: content_block_delta
90
+
91
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
92
+ I"} }
93
+
94
+
95
+ event: content_block_delta
96
+
97
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
98
+ don"} }
99
+
100
+
101
+ event: content_block_delta
102
+
103
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"''t"} }
104
+
105
+
106
+ event: content_block_delta
107
+
108
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
109
+ have"} }
110
+
111
+
112
+ event: content_block_delta
113
+
114
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
115
+ feelings"} }
116
+
117
+
118
+ event: content_block_delta
119
+
120
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
121
+ or"} }
122
+
123
+
124
+ event: content_block_delta
125
+
126
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
127
+ emotions"}}
128
+
129
+
130
+ event: content_block_delta
131
+
132
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"."}
133
+ }
134
+
135
+
136
+ event: content_block_delta
137
+
138
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
139
+ I"} }
140
+
141
+
142
+ event: content_block_delta
143
+
144
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
145
+ don"} }
146
+
147
+
148
+ event: content_block_delta
149
+
150
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"''t"} }
151
+
152
+
153
+ event: content_block_delta
154
+
155
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
156
+ experience"} }
157
+
158
+
159
+ event: content_block_delta
160
+
161
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
162
+ \""} }
163
+
164
+
165
+ event: content_block_delta
166
+
167
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"goo"} }
168
+
169
+
170
+ event: content_block_delta
171
+
172
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d\""} }
173
+
174
+
175
+ event: content_block_delta
176
+
177
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
178
+ or"} }
179
+
180
+
181
+ event: content_block_delta
182
+
183
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
184
+ \""} }
185
+
186
+
187
+ event: content_block_delta
188
+
189
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"ba"} }
190
+
191
+
192
+ event: content_block_delta
193
+
194
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d\""} }
195
+
196
+
197
+ event: content_block_delta
198
+
199
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
200
+ days"} }
201
+
202
+
203
+ event: content_block_delta
204
+
205
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
206
+ like"} }
207
+
208
+
209
+ event: content_block_delta
210
+
211
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
212
+ humans"} }
213
+
214
+
215
+ event: content_block_delta
216
+
217
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
218
+ "} }
219
+
220
+
221
+ event: content_block_delta
222
+
223
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"do."} }
224
+
225
+
226
+ event: content_block_delta
227
+
228
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
229
+ My"} }
230
+
231
+
232
+ event: content_block_delta
233
+
234
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
235
+ purpose"}}
236
+
237
+
238
+ event: content_block_delta
239
+
240
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
241
+ is"} }
242
+
243
+
244
+ event: content_block_delta
245
+
246
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
247
+ to"} }
248
+
249
+
250
+ event: content_block_delta
251
+
252
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
253
+ assist"} }
254
+
255
+
256
+ event: content_block_delta
257
+
258
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
259
+ you"}}
260
+
261
+
262
+ event: content_block_delta
263
+
264
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
265
+ to"} }
266
+
267
+
268
+ event: content_block_delta
269
+
270
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
271
+ the"} }
272
+
273
+
274
+ event: content_block_delta
275
+
276
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
277
+ best"}}
278
+
279
+
280
+ event: content_block_delta
281
+
282
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
283
+ of"} }
284
+
285
+
286
+ event: content_block_delta
287
+
288
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
289
+ my"} }
290
+
291
+
292
+ event: content_block_delta
293
+
294
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
295
+ abilities"} }
296
+
297
+
298
+ event: content_block_delta
299
+
300
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
301
+ base"} }
302
+
303
+
304
+ event: content_block_delta
305
+
306
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d
307
+ on"} }
308
+
309
+
310
+ event: content_block_delta
311
+
312
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
313
+ the"} }
314
+
315
+
316
+ event: content_block_delta
317
+
318
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
319
+ information"} }
320
+
321
+
322
+ event: content_block_delta
323
+
324
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
325
+ an"} }
326
+
327
+
328
+ event: content_block_delta
329
+
330
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d
331
+ training"} }
332
+
333
+
334
+ event: content_block_delta
335
+
336
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
337
+ I"} }
338
+
339
+
340
+ event: content_block_delta
341
+
342
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
343
+ have"} }
344
+
345
+
346
+ event: content_block_delta
347
+
348
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
349
+ been"} }
350
+
351
+
352
+ event: content_block_delta
353
+
354
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
355
+ provide"} }
356
+
357
+
358
+ event: content_block_delta
359
+
360
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d."} }
361
+
362
+
363
+ event: content_block_delta
364
+
365
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
366
+ How"} }
367
+
368
+
369
+ event: content_block_delta
370
+
371
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
372
+ may"} }
373
+
374
+
375
+ event: content_block_delta
376
+
377
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
378
+ I"} }
379
+
380
+
381
+ event: content_block_delta
382
+
383
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
384
+ help"} }
385
+
386
+
387
+ event: content_block_delta
388
+
389
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
390
+ you"} }
391
+
392
+
393
+ event: content_block_delta
394
+
395
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"
396
+ today"} }
397
+
398
+
399
+ event: content_block_delta
400
+
401
+ data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"?"} }
402
+
403
+
404
+ event: content_block_stop
405
+
406
+ data: {"type":"content_block_stop","index":0 }
407
+
408
+
409
+ event: message_delta
410
+
411
+ data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"output_tokens":63} }
412
+
413
+
414
+ event: message_stop
415
+
416
+ data: {"type":"message_stop" }
417
+
418
+
419
+ '
420
+ headers:
421
+ CF-Cache-Status:
422
+ - DYNAMIC
423
+ CF-RAY:
424
+ - 879639e9f9b611be-MRS
425
+ Cache-Control:
426
+ - no-cache
427
+ Connection:
428
+ - keep-alive
429
+ Content-Type:
430
+ - text/event-stream; charset=utf-8
431
+ Date:
432
+ - Wed, 24 Apr 2024 12:51:43 GMT
433
+ Server:
434
+ - cloudflare
435
+ Transfer-Encoding:
436
+ - chunked
437
+ anthropic-ratelimit-requests-limit:
438
+ - '50'
439
+ anthropic-ratelimit-requests-remaining:
440
+ - '47'
441
+ anthropic-ratelimit-requests-reset:
442
+ - '2024-04-24T12:52:29Z'
443
+ anthropic-ratelimit-tokens-limit:
444
+ - '20000'
445
+ anthropic-ratelimit-tokens-remaining:
446
+ - '19000'
447
+ anthropic-ratelimit-tokens-reset:
448
+ - '2024-04-24T12:52:29Z'
449
+ request-id:
450
+ - req_013pkRw1YmHVKKW4emYvNweS
451
+ via:
452
+ - 1.1 google
453
+ status:
454
+ code: 200
455
+ message: OK
456
+ version: 1