netra-sdk 0.1.41__py3-none-any.whl → 0.1.42__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.
Potentially problematic release.
This version of netra-sdk might be problematic. Click here for more details.
- netra/__init__.py +2 -2
- netra/session_manager.py +13 -9
- netra/version.py +1 -1
- {netra_sdk-0.1.41.dist-info → netra_sdk-0.1.42.dist-info}/METADATA +3 -3
- {netra_sdk-0.1.41.dist-info → netra_sdk-0.1.42.dist-info}/RECORD +7 -7
- {netra_sdk-0.1.41.dist-info → netra_sdk-0.1.42.dist-info}/LICENCE +0 -0
- {netra_sdk-0.1.41.dist-info → netra_sdk-0.1.42.dist-info}/WHEEL +0 -0
netra/__init__.py
CHANGED
|
@@ -249,13 +249,13 @@ class Netra:
|
|
|
249
249
|
logger.warning("Both event_name and attributes must be provided for custom events.")
|
|
250
250
|
|
|
251
251
|
@classmethod
|
|
252
|
-
def add_conversation(cls, conversation_type: ConversationType,
|
|
252
|
+
def add_conversation(cls, conversation_type: ConversationType, role: str, content: Any) -> None:
|
|
253
253
|
"""
|
|
254
254
|
Append a conversation entry and set span attribute 'conversation' as an array.
|
|
255
255
|
If a conversation array already exists for the current active span, this appends
|
|
256
256
|
to it; otherwise, it initializes a new array.
|
|
257
257
|
"""
|
|
258
|
-
SessionManager.add_conversation(conversation_type=conversation_type,
|
|
258
|
+
SessionManager.add_conversation(conversation_type=conversation_type, role=role, content=content)
|
|
259
259
|
|
|
260
260
|
@classmethod
|
|
261
261
|
def start_span(
|
netra/session_manager.py
CHANGED
|
@@ -20,7 +20,6 @@ logger = logging.getLogger(__name__)
|
|
|
20
20
|
class ConversationType(str, Enum):
|
|
21
21
|
INPUT = "input"
|
|
22
22
|
OUTPUT = "output"
|
|
23
|
-
SYSTEM = "system"
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
class SessionManager:
|
|
@@ -262,7 +261,7 @@ class SessionManager:
|
|
|
262
261
|
logger.exception(f"Failed to add custom event: {name} - {e}")
|
|
263
262
|
|
|
264
263
|
@staticmethod
|
|
265
|
-
def add_conversation(conversation_type: ConversationType,
|
|
264
|
+
def add_conversation(conversation_type: ConversationType, role: str, content: Any) -> None:
|
|
266
265
|
"""
|
|
267
266
|
Append a conversation entry and set span attribute 'conversation' as an array.
|
|
268
267
|
|
|
@@ -278,13 +277,13 @@ class SessionManager:
|
|
|
278
277
|
raise TypeError("conversation_type must be a ConversationType enum value (input, output, system)")
|
|
279
278
|
normalized_type = conversation_type.value
|
|
280
279
|
|
|
281
|
-
if not isinstance(
|
|
282
|
-
raise TypeError(f"
|
|
283
|
-
if not
|
|
284
|
-
raise ValueError("
|
|
280
|
+
if not isinstance(role, str):
|
|
281
|
+
raise TypeError(f"role must be a string, got {type(role)}")
|
|
282
|
+
if not role:
|
|
283
|
+
raise ValueError("role must be a non-empty string")
|
|
285
284
|
|
|
286
|
-
if not
|
|
287
|
-
raise ValueError("
|
|
285
|
+
if not content:
|
|
286
|
+
raise ValueError("content must not be empty")
|
|
288
287
|
|
|
289
288
|
try:
|
|
290
289
|
span = trace.get_current_span()
|
|
@@ -313,7 +312,12 @@ class SessionManager:
|
|
|
313
312
|
existing = []
|
|
314
313
|
|
|
315
314
|
# Append new entry
|
|
316
|
-
entry: Dict[str, Any] = {"type": normalized_type, "
|
|
315
|
+
entry: Dict[str, Any] = {"type": normalized_type, "role": role, "content": content}
|
|
316
|
+
# Add value_type and media_type based on value type for backend parsing
|
|
317
|
+
if isinstance(content, str):
|
|
318
|
+
entry["format"] = "text"
|
|
319
|
+
elif isinstance(content, dict):
|
|
320
|
+
entry["format"] = "json"
|
|
317
321
|
existing.append(entry)
|
|
318
322
|
|
|
319
323
|
SessionManager.set_attribute_on_active_span("conversation", existing)
|
netra/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.42"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: netra-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.42
|
|
4
4
|
Summary: A Python SDK for AI application observability that provides OpenTelemetry-based monitoring, tracing, and PII protection for LLM and vector database applications. Enables easy instrumentation, session tracking, and privacy-focused data collection for AI systems in production environments.
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Keywords: netra,tracing,observability,sdk,ai,llm,vector,database
|
|
@@ -73,8 +73,8 @@ Requires-Dist: stanza (>=1.10.1,<2.0.0) ; extra == "presidio"
|
|
|
73
73
|
Requires-Dist: traceloop-sdk (>=0.40.7,<0.43.0)
|
|
74
74
|
Requires-Dist: transformers (==4.51.3) ; extra == "presidio"
|
|
75
75
|
Project-URL: Changelog, https://github.com/KeyValueSoftwareSystems/netra-sdk-py/blob/main/CHANGELOG.md
|
|
76
|
-
Project-URL: Documentation, https://
|
|
77
|
-
Project-URL: Homepage, https://
|
|
76
|
+
Project-URL: Documentation, https://docs.getnetra.ai/introduction
|
|
77
|
+
Project-URL: Homepage, https://getnetra.ai/
|
|
78
78
|
Project-URL: Repository, https://github.com/KeyValueSoftwareSystems/netra-sdk-py
|
|
79
79
|
Description-Content-Type: text/markdown
|
|
80
80
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
netra/__init__.py,sha256
|
|
1
|
+
netra/__init__.py,sha256=-eEBq3ndX3JAWDo4_Ra0L19KrTfrJhNDjlAwChb3_IA,10353
|
|
2
2
|
netra/anonymizer/__init__.py,sha256=KeGPPZqKVZbtkbirEKYTYhj6aZHlakjdQhD7QHqBRio,133
|
|
3
3
|
netra/anonymizer/anonymizer.py,sha256=IcrYkdwWrFauGWUeAW-0RwrSUM8VSZCFNtoywZhvIqU,3778
|
|
4
4
|
netra/anonymizer/base.py,sha256=ytPxHCUD2OXlEY6fNTuMmwImNdIjgj294I41FIgoXpU,5946
|
|
@@ -45,11 +45,11 @@ netra/processors/instrumentation_span_processor.py,sha256=VzurzwtGleFltxzKD_gjVk
|
|
|
45
45
|
netra/processors/scrubbing_span_processor.py,sha256=dJ86Ncmjvmrhm_uAdGTwcGvRpZbVVWqD9AOFwEMWHZY,6701
|
|
46
46
|
netra/processors/session_span_processor.py,sha256=qcsBl-LnILWefsftI8NQhXDGb94OWPc8LvzhVA0JS_c,2432
|
|
47
47
|
netra/scanner.py,sha256=kyDpeZiscCPb6pjuhS-sfsVj-dviBFRepdUWh0sLoEY,11554
|
|
48
|
-
netra/session_manager.py,sha256=
|
|
48
|
+
netra/session_manager.py,sha256=iU5UG_Y-fPMoyRxjfEqYCBxzzmcSVJi411Ni6gL7g9w,12683
|
|
49
49
|
netra/span_wrapper.py,sha256=IygQX78xQRlL_Z1MfKfUbv0okihx92qNClnRlYFtRNc,8004
|
|
50
50
|
netra/tracer.py,sha256=FJO8Cine-WL9K_4wn6RVjQOgX6c1JCp_8QowUbRSVHk,7718
|
|
51
|
-
netra/version.py,sha256=
|
|
52
|
-
netra_sdk-0.1.
|
|
53
|
-
netra_sdk-0.1.
|
|
54
|
-
netra_sdk-0.1.
|
|
55
|
-
netra_sdk-0.1.
|
|
51
|
+
netra/version.py,sha256=a0ON039K5sX117g1thh7kP35cYMBjBhhhU9A-PERuT0,23
|
|
52
|
+
netra_sdk-0.1.42.dist-info/LICENCE,sha256=8B_UoZ-BAl0AqiHAHUETCgd3I2B9yYJ1WEQtVb_qFMA,11359
|
|
53
|
+
netra_sdk-0.1.42.dist-info/METADATA,sha256=ogWH-5_FBACadeZamwnUqoiAiIkRclRg5561U_a0Lqc,28137
|
|
54
|
+
netra_sdk-0.1.42.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
55
|
+
netra_sdk-0.1.42.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|