netra-sdk 0.1.5__tar.gz → 0.1.6__tar.gz
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_sdk-0.1.5 → netra_sdk-0.1.6}/PKG-INFO +31 -22
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/README.md +30 -21
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/processors/error_detection_processor.py +7 -3
- netra_sdk-0.1.6/netra/version.py +1 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/pyproject.toml +1 -1
- netra_sdk-0.1.5/netra/version.py +0 -1
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/LICENCE +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/__init__.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/anonymizer/__init__.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/anonymizer/anonymizer.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/anonymizer/base.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/anonymizer/fp_anonymizer.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/config.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/decorators.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/exceptions/__init__.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/exceptions/injection.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/exceptions/pii.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/input_scanner.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/__init__.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/aiohttp/__init__.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/aiohttp/version.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/cohere/__init__.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/cohere/version.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/google_genai/__init__.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/google_genai/config.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/google_genai/utils.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/google_genai/version.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/httpx/__init__.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/httpx/version.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/instruments.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/mistralai/__init__.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/mistralai/config.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/mistralai/utils.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/mistralai/version.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/weaviate/__init__.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/instrumentation/weaviate/version.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/pii.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/processors/__init__.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/processors/session_span_processor.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/scanner.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/session.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/session_manager.py +0 -0
- {netra_sdk-0.1.5 → netra_sdk-0.1.6}/netra/tracer.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: netra-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
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
|
|
@@ -407,29 +407,38 @@ Netra.set_custom_event(event_name="conversion", attributes={
|
|
|
407
407
|
Use the custom session tracking utility to track external API calls with detailed observability:
|
|
408
408
|
|
|
409
409
|
```python
|
|
410
|
-
from netra import Netra
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
#
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
session.set_prompt("A cat playing piano")
|
|
410
|
+
from netra import Netra, Session
|
|
411
|
+
from netra.session import UsageModel
|
|
412
|
+
|
|
413
|
+
# Start a new session
|
|
414
|
+
with Netra.start_session("image_generation") as session:
|
|
415
|
+
# Set session attributes
|
|
416
|
+
session.set_prompt("A beautiful sunset over mountains")
|
|
417
|
+
session.set_negative_prompt("blurry, low quality")
|
|
419
418
|
session.set_height("1024")
|
|
420
419
|
session.set_width("1024")
|
|
421
|
-
session.
|
|
422
|
-
session.
|
|
423
|
-
|
|
424
|
-
#
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
420
|
+
session.set_model("dall-e-3")
|
|
421
|
+
session.set_llm_system("openai")
|
|
422
|
+
|
|
423
|
+
# Set usage data with UsageModel
|
|
424
|
+
usage_data = [
|
|
425
|
+
UsageModel(
|
|
426
|
+
model="dall-e-3",
|
|
427
|
+
type="image_generation",
|
|
428
|
+
unit_used=1,
|
|
429
|
+
cost_in_usd=0.02
|
|
430
|
+
)
|
|
431
|
+
]
|
|
432
|
+
session.set_usage(usage_data)
|
|
433
|
+
|
|
434
|
+
# Your API calls here
|
|
435
|
+
# ...
|
|
436
|
+
|
|
437
|
+
# Set custom attributes
|
|
438
|
+
session.set_attribute("custom_key", "custom_value")
|
|
439
|
+
|
|
440
|
+
# Add events
|
|
441
|
+
session.add_event("generation_started", {"step": 1, "status": "processing"})
|
|
433
442
|
session.add_event("processing_completed", {"step": "rendering"})
|
|
434
443
|
|
|
435
444
|
# Session automatically captures duration, status, and any errors
|
|
@@ -331,29 +331,38 @@ Netra.set_custom_event(event_name="conversion", attributes={
|
|
|
331
331
|
Use the custom session tracking utility to track external API calls with detailed observability:
|
|
332
332
|
|
|
333
333
|
```python
|
|
334
|
-
from netra import Netra
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
#
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
session.set_prompt("A cat playing piano")
|
|
334
|
+
from netra import Netra, Session
|
|
335
|
+
from netra.session import UsageModel
|
|
336
|
+
|
|
337
|
+
# Start a new session
|
|
338
|
+
with Netra.start_session("image_generation") as session:
|
|
339
|
+
# Set session attributes
|
|
340
|
+
session.set_prompt("A beautiful sunset over mountains")
|
|
341
|
+
session.set_negative_prompt("blurry, low quality")
|
|
343
342
|
session.set_height("1024")
|
|
344
343
|
session.set_width("1024")
|
|
345
|
-
session.
|
|
346
|
-
session.
|
|
347
|
-
|
|
348
|
-
#
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
344
|
+
session.set_model("dall-e-3")
|
|
345
|
+
session.set_llm_system("openai")
|
|
346
|
+
|
|
347
|
+
# Set usage data with UsageModel
|
|
348
|
+
usage_data = [
|
|
349
|
+
UsageModel(
|
|
350
|
+
model="dall-e-3",
|
|
351
|
+
type="image_generation",
|
|
352
|
+
unit_used=1,
|
|
353
|
+
cost_in_usd=0.02
|
|
354
|
+
)
|
|
355
|
+
]
|
|
356
|
+
session.set_usage(usage_data)
|
|
357
|
+
|
|
358
|
+
# Your API calls here
|
|
359
|
+
# ...
|
|
360
|
+
|
|
361
|
+
# Set custom attributes
|
|
362
|
+
session.set_attribute("custom_key", "custom_value")
|
|
363
|
+
|
|
364
|
+
# Add events
|
|
365
|
+
session.add_event("generation_started", {"step": 1, "status": "processing"})
|
|
357
366
|
session.add_event("processing_completed", {"step": "rendering"})
|
|
358
367
|
|
|
359
368
|
# Session automatically captures duration, status, and any errors
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from typing import Any, Optional
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
from opentelemetry.sdk.trace import SpanProcessor
|
|
@@ -66,9 +66,13 @@ class ErrorDetectionProcessor(SpanProcessor): # type: ignore[misc]
|
|
|
66
66
|
# Wrap set_status
|
|
67
67
|
original_set_status = span.set_status
|
|
68
68
|
|
|
69
|
-
def wrapped_set_status(status: Status) -> Any:
|
|
69
|
+
def wrapped_set_status(status: Union[Status, StatusCode]) -> Any:
|
|
70
70
|
# Check if status code is ERROR
|
|
71
|
-
if status
|
|
71
|
+
if isinstance(status, Status):
|
|
72
|
+
status_code = status.status_code
|
|
73
|
+
elif isinstance(status, StatusCode):
|
|
74
|
+
status_code = status
|
|
75
|
+
if status_code == StatusCode.ERROR:
|
|
72
76
|
event_attributes = {
|
|
73
77
|
"has_error": True,
|
|
74
78
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.6"
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "netra-sdk"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.6"
|
|
8
8
|
description = "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."
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "Sooraj Thomas",email = "sooraj@keyvalue.systems"}
|
netra_sdk-0.1.5/netra/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.5"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|