kalibr 1.2.2__py3-none-any.whl → 1.2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: kalibr
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Unified LLM Observability & Multi-Model AI Integration Framework - Deploy to GPT, Claude, Gemini, Copilot with full telemetry.
5
5
  Author-email: Kalibr Team <support@kalibr.systems>
6
6
  License: Apache-2.0
@@ -35,15 +35,15 @@ kalibr/middleware/__init__.py,sha256=qyDUn_irAX67MS-IkuDVxg4RmFnJHDf_BfIT3qfGoBI
35
35
  kalibr/middleware/auto_tracer.py,sha256=ZBSBM0O3a6rwVzfik1n5NUmQDah8_iaf86rU64aPYT4,13037
36
36
  kalibr_crewai/__init__.py,sha256=b0HFTiE80eArtSMBOIEKu1JM6KU0tCjEylKCVVVF29Q,1796
37
37
  kalibr_crewai/callbacks.py,sha256=_d1M4J-6XfKqrVIxnOgOQu57jpFKVv-VIsmPV0HNgZ4,20419
38
- kalibr_crewai/instrumentor.py,sha256=x26v0RcriImkPiC8KB1Hmez1XOYLcDa9o-g35BMu5Ek,24420
38
+ kalibr_crewai/instrumentor.py,sha256=-G_-xaqE3Op70MSEIaZjPYioGDxKRagwLbZmcmmvzFg,26793
39
39
  kalibr_langchain/__init__.py,sha256=O4XYVyhLp1v-Y1kGZw3zD-tUK9wp0UX8Jt6oN0QTHN4,1373
40
40
  kalibr_langchain/async_callback.py,sha256=_Mj_YrKbULNtfxixZ7iwiHyWEV9l178ZA5Oy5A5Pakk,27748
41
41
  kalibr_langchain/callback.py,sha256=SNM1aHOXdG55grHmGyTwbXOeM6hjZTub2REiZD2H-d8,35216
42
42
  kalibr_openai_agents/__init__.py,sha256=wL59LzGstptKigfQDrKKt_7hcMO1JGVQtVAsE0lz-Zw,1367
43
43
  kalibr_openai_agents/processor.py,sha256=F550sdRf3rpguP1yOlgAUQWDLPBy4hSACV3-zOyCpOU,18257
44
- kalibr-1.2.2.dist-info/LICENSE,sha256=5mwAnB38l3_PjmOQn6_L6cZnJvus143DUjMBPIH1yso,10768
45
- kalibr-1.2.2.dist-info/METADATA,sha256=XqhSOZekE5D5WQVT0pH2h1HCZWXiruGM9CqOelAZnf0,11201
46
- kalibr-1.2.2.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
47
- kalibr-1.2.2.dist-info/entry_points.txt,sha256=Kojlc6WRX8V1qS9lOMdDPZpTUVHCtzGtHqXusErgmLY,47
48
- kalibr-1.2.2.dist-info/top_level.txt,sha256=dIfBOWUnnHGFDwgz5zfIx5_0bU3wOUgAbYr4JcFHZmo,59
49
- kalibr-1.2.2.dist-info/RECORD,,
44
+ kalibr-1.2.3.dist-info/LICENSE,sha256=5mwAnB38l3_PjmOQn6_L6cZnJvus143DUjMBPIH1yso,10768
45
+ kalibr-1.2.3.dist-info/METADATA,sha256=x6_p6pRthFdGcHYRMXeKCmf0WRwMU5xE9FT142ce4ts,11201
46
+ kalibr-1.2.3.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
47
+ kalibr-1.2.3.dist-info/entry_points.txt,sha256=Kojlc6WRX8V1qS9lOMdDPZpTUVHCtzGtHqXusErgmLY,47
48
+ kalibr-1.2.3.dist-info/top_level.txt,sha256=dIfBOWUnnHGFDwgz5zfIx5_0bU3wOUgAbYr4JcFHZmo,59
49
+ kalibr-1.2.3.dist-info/RECORD,,
@@ -12,6 +12,8 @@ from datetime import datetime, timezone
12
12
  from functools import wraps
13
13
  from typing import Any, Callable, Dict, List, Optional
14
14
 
15
+ from opentelemetry import trace as otel_trace
16
+
15
17
  from .callbacks import EventBatcher, _count_tokens, _get_provider_from_model
16
18
 
17
19
  # Import Kalibr cost adapters
@@ -275,6 +277,21 @@ class KalibrCrewAIInstrumentor:
275
277
  duration_ms = int((time.time() - start_time) * 1000)
276
278
  ts_end = datetime.now(timezone.utc)
277
279
 
280
+ # Enrich CrewAI's OTel span with Kalibr telemetry
281
+ try:
282
+ current_span = otel_trace.get_current_span()
283
+ if current_span and current_span.is_recording():
284
+ current_span.set_attribute("kalibr.cost_usd", instrumentor._accumulated_cost)
285
+ current_span.set_attribute("kalibr.input_tokens", instrumentor._accumulated_tokens["input"])
286
+ current_span.set_attribute("kalibr.output_tokens", instrumentor._accumulated_tokens["output"])
287
+ current_span.set_attribute("kalibr.total_tokens", instrumentor._accumulated_tokens["input"] + instrumentor._accumulated_tokens["output"])
288
+ current_span.set_attribute("kalibr.model_id", model_name)
289
+ current_span.set_attribute("kalibr.provider", provider)
290
+ current_span.set_attribute("kalibr.duration_ms", duration_ms)
291
+ current_span.set_attribute("kalibr.tenant_id", instrumentor.tenant_id)
292
+ except Exception:
293
+ pass # Don't fail if span enrichment fails
294
+
278
295
  # Build output info
279
296
  output_preview = None
280
297
  if instrumentor.capture_output and result is not None:
@@ -376,6 +393,21 @@ class KalibrCrewAIInstrumentor:
376
393
  duration_ms = int((time.time() - start_time) * 1000)
377
394
  ts_end = datetime.now(timezone.utc)
378
395
 
396
+ # Enrich CrewAI's OTel span with Kalibr telemetry
397
+ try:
398
+ current_span = otel_trace.get_current_span()
399
+ if current_span and current_span.is_recording():
400
+ current_span.set_attribute("kalibr.cost_usd", instrumentor._accumulated_cost)
401
+ current_span.set_attribute("kalibr.input_tokens", instrumentor._accumulated_tokens["input"])
402
+ current_span.set_attribute("kalibr.output_tokens", instrumentor._accumulated_tokens["output"])
403
+ current_span.set_attribute("kalibr.total_tokens", instrumentor._accumulated_tokens["input"] + instrumentor._accumulated_tokens["output"])
404
+ current_span.set_attribute("kalibr.model_id", model_name)
405
+ current_span.set_attribute("kalibr.provider", provider)
406
+ current_span.set_attribute("kalibr.duration_ms", duration_ms)
407
+ current_span.set_attribute("kalibr.tenant_id", instrumentor.tenant_id)
408
+ except Exception:
409
+ pass # Don't fail if span enrichment fails
410
+
379
411
  output_preview = None
380
412
  if instrumentor.capture_output and result is not None:
381
413
  output_preview = str(result)[:500]
File without changes