openlit 1.30.3__py3-none-any.whl → 1.30.4__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.
@@ -481,11 +481,12 @@ def chat(gen_ai_endpoint, version, environment, application_name,
481
481
  response = wrapped(*args, **kwargs)
482
482
 
483
483
  try:
484
- input_tokens = response.response_metadata.get("prompt_eval_count", 0)
485
- output_tokens = response.response_metadata.get("eval_count", 0)
484
+ token_usage = response.response_metadata.get("token_usage", {})
485
+ input_tokens = token_usage.get("prompt_tokens", 0)
486
+ output_tokens = token_usage.get("completion_tokens", 0)
487
+ model = response.response_metadata.get("model_name", "gpt-4")
486
488
 
487
489
  prompt = "" if isinstance(args[0], list) else args[0]
488
- model = getattr(instance, 'model_name', getattr(instance, 'model', 'gpt-4'))
489
490
 
490
491
  # Calculate cost of the operation
491
492
  cost = get_chat_model_cost(
@@ -620,11 +621,12 @@ def achat(gen_ai_endpoint, version, environment, application_name,
620
621
  response = await wrapped(*args, **kwargs)
621
622
 
622
623
  try:
623
- input_tokens = response.response_metadata.get("prompt_eval_count", 0)
624
- output_tokens = response.response_metadata.get("eval_count", 0)
624
+ token_usage = response.response_metadata.get("token_usage", {})
625
+ input_tokens = token_usage.get("prompt_tokens", 0)
626
+ output_tokens = token_usage.get("completion_tokens", 0)
627
+ model = response.response_metadata.get("model_name", "gpt-4")
625
628
 
626
629
  prompt = "" if isinstance(args[0], list) else args[0]
627
- model = getattr(instance, 'model_name', getattr(instance, 'model', 'gpt-4'))
628
630
  # Calculate cost of the operation
629
631
  cost = get_chat_model_cost(
630
632
  model,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openlit
3
- Version: 1.30.3
3
+ Version: 1.30.4
4
4
  Summary: OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications and GPUs, facilitating the integration of observability into your GenAI-driven projects
5
5
  Home-page: https://github.com/openlit/openlit/tree/main/openlit/python
6
6
  Keywords: OpenTelemetry,otel,otlp,llm,tracing,openai,anthropic,claude,cohere,llm monitoring,observability,monitoring,gpt,Generative AI,chatGPT,gpu
@@ -43,7 +43,7 @@ openlit/instrumentation/groq/groq.py,sha256=m4gFPbYzjUUIgjXZ0Alu2Zy1HcO5takCFA2X
43
43
  openlit/instrumentation/haystack/__init__.py,sha256=QK6XxxZUHX8vMv2Crk7rNBOc64iOOBLhJGL_lPlAZ8s,1758
44
44
  openlit/instrumentation/haystack/haystack.py,sha256=oQIZiDhdp3gnJnhYQ1OouJMc9YT0pQ-_31cmNuopa68,3891
45
45
  openlit/instrumentation/langchain/__init__.py,sha256=0AI2Dnqw81IcJw3jM--gGkv_HRh2GtosOGJjvOpw7Zk,3431
46
- openlit/instrumentation/langchain/langchain.py,sha256=g3HDKPq498KitHuQxxfQzvRq9MKAZaR0jStQYTLx_-M,35592
46
+ openlit/instrumentation/langchain/langchain.py,sha256=rDGfneqnarCQTRXrVZocMStkXKgnFdzH3wHqXuWnWiw,35668
47
47
  openlit/instrumentation/litellm/__init__.py,sha256=Z-LsVHKJdPganHfJA_rWg7xAfQYkvLfpLdF-eckU4qY,2401
48
48
  openlit/instrumentation/litellm/async_litellm.py,sha256=1MKNZbvKaf1lFWbXi1MQy3qFNNeXawav34SDlOQ_H3w,27544
49
49
  openlit/instrumentation/litellm/litellm.py,sha256=4YqCQ4CEQ4sfDu7pTlnflL_AfUqYEQdJDTO7nHJ6noY,27450
@@ -77,7 +77,7 @@ openlit/instrumentation/vllm/vllm.py,sha256=lDzM7F5pgxvh8nKL0dcKB4TD0Mc9wXOWeXOs
77
77
  openlit/otel/metrics.py,sha256=y7SQDTyfLakMrz0V4DThN-WAeap7YZzyndeYGSP6nVg,4516
78
78
  openlit/otel/tracing.py,sha256=fG3vl-flSZ30whCi7rrG25PlkIhhr8PhnfJYCkZzCD0,3895
79
79
  openlit/semcov/__init__.py,sha256=_IjU498Sc0Rjz55y9S3dUelgRalmrzzBgFglPzOlIfk,9137
80
- openlit-1.30.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
81
- openlit-1.30.3.dist-info/METADATA,sha256=Ej7sFOJ8OV2V00Vx_Oki13Q4pyvqYQS7_inRYngrIx8,20915
82
- openlit-1.30.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
83
- openlit-1.30.3.dist-info/RECORD,,
80
+ openlit-1.30.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
81
+ openlit-1.30.4.dist-info/METADATA,sha256=vpRhJggYW01tCPU-klJ6LMVzi6WB32N2OmM41MVBCfg,20915
82
+ openlit-1.30.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
83
+ openlit-1.30.4.dist-info/RECORD,,