raindrop-ai 0.0.34__py3-none-any.whl → 0.0.36__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.
raindrop/analytics.py
CHANGED
|
@@ -66,6 +66,7 @@ __all__ = [
|
|
|
66
66
|
"start_span",
|
|
67
67
|
"ManualSpan",
|
|
68
68
|
"set_span_properties",
|
|
69
|
+
"set_llm_span_io",
|
|
69
70
|
"flush",
|
|
70
71
|
"shutdown",
|
|
71
72
|
]
|
|
@@ -347,6 +348,59 @@ def _should_send_prompts():
|
|
|
347
348
|
).lower() == "true" or context_api.get_value("override_enable_content_tracing")
|
|
348
349
|
|
|
349
350
|
|
|
351
|
+
def set_llm_span_io(
|
|
352
|
+
input: Any = None,
|
|
353
|
+
output: Any = None,
|
|
354
|
+
) -> None:
|
|
355
|
+
"""
|
|
356
|
+
Set LLM input/output content on the current span.
|
|
357
|
+
|
|
358
|
+
Use this to add prompt/completion content to auto-instrumented spans
|
|
359
|
+
that don't capture content automatically (e.g., Bedrock with aioboto3).
|
|
360
|
+
|
|
361
|
+
Args:
|
|
362
|
+
input: The input/prompt content (messages, text, etc.)
|
|
363
|
+
output: The output/completion content (response text, message, etc.)
|
|
364
|
+
|
|
365
|
+
Example:
|
|
366
|
+
response = await bedrock_client.converse(modelId=model, messages=messages)
|
|
367
|
+
raindrop.set_llm_span_io(
|
|
368
|
+
input=messages,
|
|
369
|
+
output=response["output"]["message"]["content"]
|
|
370
|
+
)
|
|
371
|
+
"""
|
|
372
|
+
if not _should_send_prompts():
|
|
373
|
+
return
|
|
374
|
+
|
|
375
|
+
span = get_current_span()
|
|
376
|
+
if not span or not span.is_recording():
|
|
377
|
+
logger.debug("[raindrop] set_llm_span_io called but no active span found")
|
|
378
|
+
return
|
|
379
|
+
|
|
380
|
+
try:
|
|
381
|
+
if input is not None:
|
|
382
|
+
input_str = (
|
|
383
|
+
json.dumps(input, cls=JSONEncoder)
|
|
384
|
+
if not isinstance(input, str)
|
|
385
|
+
else input
|
|
386
|
+
)
|
|
387
|
+
input_str = _truncate_json_if_needed(input_str)
|
|
388
|
+
span.set_attribute("gen_ai.prompt.0.role", "user")
|
|
389
|
+
span.set_attribute("gen_ai.prompt.0.content", input_str)
|
|
390
|
+
|
|
391
|
+
if output is not None:
|
|
392
|
+
output_str = (
|
|
393
|
+
json.dumps(output, cls=JSONEncoder)
|
|
394
|
+
if not isinstance(output, str)
|
|
395
|
+
else output
|
|
396
|
+
)
|
|
397
|
+
output_str = _truncate_json_if_needed(output_str)
|
|
398
|
+
span.set_attribute("gen_ai.completion.0.role", "assistant")
|
|
399
|
+
span.set_attribute("gen_ai.completion.0.content", output_str)
|
|
400
|
+
except Exception as e:
|
|
401
|
+
logger.debug(f"[raindrop] Failed to record LLM content: {e}")
|
|
402
|
+
|
|
403
|
+
|
|
350
404
|
# Signal types - This is now defined in models.py
|
|
351
405
|
# SignalType = Literal["default", "feedback", "edit"]
|
|
352
406
|
|
raindrop/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = "0.0.
|
|
1
|
+
VERSION = "0.0.36"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: raindrop-ai
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.36
|
|
4
4
|
Summary: Raindrop AI (Python SDK)
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Raindrop AI
|
|
@@ -11,9 +11,11 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Requires-Dist: opentelemetry-sdk (>=1.39.0)
|
|
14
15
|
Requires-Dist: pydantic (>=2.09,<3)
|
|
15
16
|
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
16
17
|
Requires-Dist: traceloop-sdk (>=0.46.0)
|
|
18
|
+
Requires-Dist: urllib3 (>=2.6.0)
|
|
17
19
|
Description-Content-Type: text/markdown
|
|
18
20
|
|
|
19
21
|
# Raindrop Python SDK
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
raindrop/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
raindrop/analytics.py,sha256=
|
|
2
|
+
raindrop/analytics.py,sha256=dL64bp5Sk1gq5PYcKAdQBNlmrn-5aW-LXTa0C3CApKA,30335
|
|
3
3
|
raindrop/interaction.py,sha256=Kw8HNaDSHVIi1p-2HK5SsYGI4Xg1zQFml4dX2EhIT7w,3123
|
|
4
4
|
raindrop/models.py,sha256=9lOOUQ2FF11RPkntuLZwN3e54pa9HtR8lGvCbzlWOPM,5198
|
|
5
5
|
raindrop/redact.py,sha256=rMNUoI90KxOY3d_zcHAr0TFD2yQ_CDgpDz-1XJLVmHs,7658
|
|
6
|
-
raindrop/version.py,sha256=
|
|
6
|
+
raindrop/version.py,sha256=l8qKbO0eI3Ja_0j_Y0EQzBqlq-Sw-KTFzu8GAbKB2VU,19
|
|
7
7
|
raindrop/well-known-names.json,sha256=9giJF6u6W1R0APW-Pf1dvNUU32OXQEoQ9CBQXSnA3ks,144403
|
|
8
|
-
raindrop_ai-0.0.
|
|
9
|
-
raindrop_ai-0.0.
|
|
10
|
-
raindrop_ai-0.0.
|
|
8
|
+
raindrop_ai-0.0.36.dist-info/METADATA,sha256=DK-3tpiRg0EeXqXOOzr9TRext7DhnJ3J5kgnvZGQFag,1346
|
|
9
|
+
raindrop_ai-0.0.36.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
10
|
+
raindrop_ai-0.0.36.dist-info/RECORD,,
|
|
File without changes
|