openlit 1.22.5__py3-none-any.whl → 1.24.1__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.
@@ -623,9 +623,11 @@ def achat(gen_ai_endpoint, version, environment, application_name,
623
623
  input_tokens = response.response_metadata.get("prompt_eval_count", 0)
624
624
  output_tokens = response.response_metadata.get("eval_count", 0)
625
625
 
626
+ prompt = "" if isinstance(args[0], list) else args[0]
627
+ model = getattr(instance, 'model_name', getattr(instance, 'model', 'gpt-4'))
626
628
  # Calculate cost of the operation
627
629
  cost = get_chat_model_cost(
628
- str(getattr(instance, 'model')),
630
+ model,
629
631
  pricing_info, input_tokens, output_tokens
630
632
  )
631
633
 
@@ -641,15 +643,13 @@ def achat(gen_ai_endpoint, version, environment, application_name,
641
643
  span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
642
644
  application_name)
643
645
  span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,
644
- str(getattr(instance, 'model')))
646
+ model)
645
647
  span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TEMPERATURE,
646
- str(getattr(instance, 'temperature')))
648
+ str(getattr(instance, 'temperature',1)))
647
649
  span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_K,
648
- str(getattr(instance, 'top_k')))
650
+ str(getattr(instance, 'top_k',1)))
649
651
  span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_TOP_P,
650
- str(getattr(instance, 'top_p')))
651
- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
652
- [response.response_metadata["done_reason"]])
652
+ str(getattr(instance, 'top_p',1)))
653
653
  span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IS_STREAM,
654
654
  False)
655
655
  span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
@@ -664,7 +664,7 @@ def achat(gen_ai_endpoint, version, environment, application_name,
664
664
  span.add_event(
665
665
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
666
666
  attributes={
667
- SemanticConvetion.GEN_AI_CONTENT_PROMPT: args[0],
667
+ SemanticConvetion.GEN_AI_CONTENT_PROMPT: prompt,
668
668
  },
669
669
  )
670
670
  span.add_event(
@@ -689,7 +689,7 @@ def achat(gen_ai_endpoint, version, environment, application_name,
689
689
  SemanticConvetion.GEN_AI_TYPE:
690
690
  SemanticConvetion.GEN_AI_TYPE_CHAT,
691
691
  SemanticConvetion.GEN_AI_REQUEST_MODEL:
692
- str(getattr(instance, 'model'))
692
+ model
693
693
  }
694
694
 
695
695
  metrics["genai_requests"].add(1, attributes)
openlit/otel/metrics.py CHANGED
@@ -34,7 +34,7 @@ def setup_meter(application_name, environment, meter, otlp_endpoint, otlp_header
34
34
  try:
35
35
  if meter is None and not METER_SET:
36
36
  # Create a resource with the service name attribute.
37
- resource = Resource(attributes={
37
+ resource = Resource.create(attributes={
38
38
  SERVICE_NAME: application_name,
39
39
  DEPLOYMENT_ENVIRONMENT: environment,
40
40
  TELEMETRY_SDK_NAME: "openlit"}
openlit/otel/tracing.py CHANGED
@@ -45,7 +45,7 @@ def setup_tracing(application_name, environment, tracer, otlp_endpoint, otlp_hea
45
45
 
46
46
  if not TRACER_SET:
47
47
  # Create a resource with the service name attribute.
48
- resource = Resource(attributes={
48
+ resource = Resource.create(attributes={
49
49
  SERVICE_NAME: application_name,
50
50
  DEPLOYMENT_ENVIRONMENT: environment,
51
51
  TELEMETRY_SDK_NAME: "openlit"}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openlit
3
- Version: 1.22.5
3
+ Version: 1.24.1
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
@@ -15,10 +15,10 @@ Classifier: Programming Language :: Python :: 3.12
15
15
  Requires-Dist: boto3 (>=1.34.0,<2.0.0)
16
16
  Requires-Dist: botocore (>=1.34.0,<2.0.0)
17
17
  Requires-Dist: gpustat (>=1.1.1,<2.0.0)
18
- Requires-Dist: opentelemetry-api (>=1.24.0,<2.0.0)
19
- Requires-Dist: opentelemetry-exporter-otlp (>=1.24.0,<2.0.0)
20
- Requires-Dist: opentelemetry-instrumentation (>=0.45b0,<0.46)
21
- Requires-Dist: opentelemetry-sdk (>=1.24.0,<2.0.0)
18
+ Requires-Dist: opentelemetry-api (>=1.27.0,<2.0.0)
19
+ Requires-Dist: opentelemetry-exporter-otlp (>=1.27.0,<2.0.0)
20
+ Requires-Dist: opentelemetry-instrumentation (>=0.48b0,<0.49)
21
+ Requires-Dist: opentelemetry-sdk (>=1.27.0,<2.0.0)
22
22
  Requires-Dist: requests (>=2.26.0,<3.0.0)
23
23
  Requires-Dist: schedule (>=1.2.2,<2.0.0)
24
24
  Requires-Dist: tiktoken (>=0.7.0,<0.8.0)
@@ -29,7 +29,7 @@ openlit/instrumentation/groq/groq.py,sha256=m4gFPbYzjUUIgjXZ0Alu2Zy1HcO5takCFA2X
29
29
  openlit/instrumentation/haystack/__init__.py,sha256=QK6XxxZUHX8vMv2Crk7rNBOc64iOOBLhJGL_lPlAZ8s,1758
30
30
  openlit/instrumentation/haystack/haystack.py,sha256=oQIZiDhdp3gnJnhYQ1OouJMc9YT0pQ-_31cmNuopa68,3891
31
31
  openlit/instrumentation/langchain/__init__.py,sha256=0AI2Dnqw81IcJw3jM--gGkv_HRh2GtosOGJjvOpw7Zk,3431
32
- openlit/instrumentation/langchain/langchain.py,sha256=lWQiPSVMXg6laEhyr7zvmP6j2bkwlH5yPmd4Gc7_0qk,35667
32
+ openlit/instrumentation/langchain/langchain.py,sha256=g3HDKPq498KitHuQxxfQzvRq9MKAZaR0jStQYTLx_-M,35592
33
33
  openlit/instrumentation/llamaindex/__init__.py,sha256=vPtK65G6b-TwJERowVRUVl7f_nBSlFdwPBtpg8dOGos,1977
34
34
  openlit/instrumentation/llamaindex/llamaindex.py,sha256=uiIigbwhonSbJWA7LpgOVI1R4kxxPODS1K5wyHIQ4hM,4048
35
35
  openlit/instrumentation/milvus/__init__.py,sha256=qi1yfmMrvkDtnrN_6toW8qC9BRL78bq7ayWpObJ8Bq4,2961
@@ -56,10 +56,10 @@ openlit/instrumentation/vertexai/async_vertexai.py,sha256=8JwSwLPPA4lAatf4w_5kJ5
56
56
  openlit/instrumentation/vertexai/vertexai.py,sha256=R6dDQfC3YFoZDygxU2fkflcMsqIv8AVoU3XOwWSvpwA,54951
57
57
  openlit/instrumentation/vllm/__init__.py,sha256=OVWalQ1dXvip1DUsjUGaHX4J-2FrSp-T-qCVOfw7OZo,1495
58
58
  openlit/instrumentation/vllm/vllm.py,sha256=lDzM7F5pgxvh8nKL0dcKB4TD0Mc9wXOWeXOsOGN7Wd8,6527
59
- openlit/otel/metrics.py,sha256=O7NoaDz0bY19mqpE4-0PcKwEe-B-iJFRgOCaanAuZAc,4291
60
- openlit/otel/tracing.py,sha256=vL1ifMbARPBpqK--yXYsCM6y5dSu5LFIKqkhZXtYmUc,3712
59
+ openlit/otel/metrics.py,sha256=-PntPlH4xOBXgnDqgJp3iA7rh1TWxM7PudGnb0GxVDA,4298
60
+ openlit/otel/tracing.py,sha256=2kSj7n7uXSkRegcGFDC8IbnDOxqWTA8dGODs__Yn_yA,3719
61
61
  openlit/semcov/__init__.py,sha256=wpAarrnkndbgvP8VSudi8IRInYtD02hkewqjyiC0dMk,7614
62
- openlit-1.22.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
63
- openlit-1.22.5.dist-info/METADATA,sha256=wLjziD90EPGdF9m0tl6kFT2E0DI85qgeO0_w1b-lbPk,15710
64
- openlit-1.22.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
65
- openlit-1.22.5.dist-info/RECORD,,
62
+ openlit-1.24.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
63
+ openlit-1.24.1.dist-info/METADATA,sha256=sPi3YeEnTMkzJqPH0SqYrdgezeK4vf2Y5W6MJPuNmT4,15710
64
+ openlit-1.24.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
65
+ openlit-1.24.1.dist-info/RECORD,,