openlit 1.33.9__py3-none-any.whl → 1.33.11__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.
Files changed (113) hide show
  1. openlit/__helpers.py +78 -0
  2. openlit/__init__.py +41 -13
  3. openlit/instrumentation/ag2/__init__.py +9 -10
  4. openlit/instrumentation/ag2/ag2.py +134 -69
  5. openlit/instrumentation/ai21/__init__.py +6 -5
  6. openlit/instrumentation/ai21/ai21.py +71 -534
  7. openlit/instrumentation/ai21/async_ai21.py +71 -534
  8. openlit/instrumentation/ai21/utils.py +407 -0
  9. openlit/instrumentation/anthropic/__init__.py +3 -3
  10. openlit/instrumentation/anthropic/anthropic.py +5 -5
  11. openlit/instrumentation/anthropic/async_anthropic.py +5 -5
  12. openlit/instrumentation/assemblyai/__init__.py +2 -2
  13. openlit/instrumentation/assemblyai/assemblyai.py +3 -3
  14. openlit/instrumentation/astra/__init__.py +25 -25
  15. openlit/instrumentation/astra/astra.py +7 -7
  16. openlit/instrumentation/astra/async_astra.py +7 -7
  17. openlit/instrumentation/azure_ai_inference/__init__.py +5 -5
  18. openlit/instrumentation/azure_ai_inference/async_azure_ai_inference.py +11 -11
  19. openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +11 -11
  20. openlit/instrumentation/bedrock/__init__.py +2 -2
  21. openlit/instrumentation/bedrock/bedrock.py +3 -3
  22. openlit/instrumentation/chroma/__init__.py +9 -9
  23. openlit/instrumentation/chroma/chroma.py +7 -7
  24. openlit/instrumentation/cohere/__init__.py +7 -7
  25. openlit/instrumentation/cohere/async_cohere.py +10 -10
  26. openlit/instrumentation/cohere/cohere.py +11 -11
  27. openlit/instrumentation/controlflow/__init__.py +4 -4
  28. openlit/instrumentation/controlflow/controlflow.py +5 -5
  29. openlit/instrumentation/crawl4ai/__init__.py +3 -3
  30. openlit/instrumentation/crawl4ai/async_crawl4ai.py +5 -5
  31. openlit/instrumentation/crawl4ai/crawl4ai.py +5 -5
  32. openlit/instrumentation/crewai/__init__.py +3 -3
  33. openlit/instrumentation/crewai/crewai.py +6 -4
  34. openlit/instrumentation/dynamiq/__init__.py +5 -5
  35. openlit/instrumentation/dynamiq/dynamiq.py +5 -5
  36. openlit/instrumentation/elevenlabs/__init__.py +5 -5
  37. openlit/instrumentation/elevenlabs/async_elevenlabs.py +4 -5
  38. openlit/instrumentation/elevenlabs/elevenlabs.py +4 -5
  39. openlit/instrumentation/embedchain/__init__.py +2 -2
  40. openlit/instrumentation/embedchain/embedchain.py +9 -9
  41. openlit/instrumentation/firecrawl/__init__.py +3 -3
  42. openlit/instrumentation/firecrawl/firecrawl.py +5 -5
  43. openlit/instrumentation/google_ai_studio/__init__.py +3 -3
  44. openlit/instrumentation/google_ai_studio/async_google_ai_studio.py +3 -3
  45. openlit/instrumentation/google_ai_studio/google_ai_studio.py +3 -3
  46. openlit/instrumentation/gpt4all/__init__.py +5 -5
  47. openlit/instrumentation/gpt4all/gpt4all.py +350 -225
  48. openlit/instrumentation/gpu/__init__.py +5 -5
  49. openlit/instrumentation/groq/__init__.py +5 -5
  50. openlit/instrumentation/groq/async_groq.py +359 -243
  51. openlit/instrumentation/groq/groq.py +359 -243
  52. openlit/instrumentation/haystack/__init__.py +2 -2
  53. openlit/instrumentation/haystack/haystack.py +5 -5
  54. openlit/instrumentation/julep/__init__.py +7 -7
  55. openlit/instrumentation/julep/async_julep.py +6 -6
  56. openlit/instrumentation/julep/julep.py +6 -6
  57. openlit/instrumentation/langchain/__init__.py +15 -9
  58. openlit/instrumentation/langchain/async_langchain.py +388 -0
  59. openlit/instrumentation/langchain/langchain.py +110 -497
  60. openlit/instrumentation/letta/__init__.py +7 -7
  61. openlit/instrumentation/letta/letta.py +10 -8
  62. openlit/instrumentation/litellm/__init__.py +9 -10
  63. openlit/instrumentation/litellm/async_litellm.py +321 -250
  64. openlit/instrumentation/litellm/litellm.py +319 -248
  65. openlit/instrumentation/llamaindex/__init__.py +2 -2
  66. openlit/instrumentation/llamaindex/llamaindex.py +5 -5
  67. openlit/instrumentation/mem0/__init__.py +2 -2
  68. openlit/instrumentation/mem0/mem0.py +5 -5
  69. openlit/instrumentation/milvus/__init__.py +2 -2
  70. openlit/instrumentation/milvus/milvus.py +7 -7
  71. openlit/instrumentation/mistral/__init__.py +13 -13
  72. openlit/instrumentation/mistral/async_mistral.py +426 -253
  73. openlit/instrumentation/mistral/mistral.py +424 -250
  74. openlit/instrumentation/multion/__init__.py +7 -7
  75. openlit/instrumentation/multion/async_multion.py +9 -7
  76. openlit/instrumentation/multion/multion.py +9 -7
  77. openlit/instrumentation/ollama/__init__.py +19 -39
  78. openlit/instrumentation/ollama/async_ollama.py +137 -563
  79. openlit/instrumentation/ollama/ollama.py +136 -563
  80. openlit/instrumentation/ollama/utils.py +333 -0
  81. openlit/instrumentation/openai/__init__.py +11 -11
  82. openlit/instrumentation/openai/async_openai.py +25 -27
  83. openlit/instrumentation/openai/openai.py +25 -27
  84. openlit/instrumentation/phidata/__init__.py +2 -2
  85. openlit/instrumentation/phidata/phidata.py +6 -4
  86. openlit/instrumentation/pinecone/__init__.py +6 -6
  87. openlit/instrumentation/pinecone/pinecone.py +7 -7
  88. openlit/instrumentation/premai/__init__.py +5 -5
  89. openlit/instrumentation/premai/premai.py +268 -219
  90. openlit/instrumentation/qdrant/__init__.py +2 -2
  91. openlit/instrumentation/qdrant/async_qdrant.py +7 -7
  92. openlit/instrumentation/qdrant/qdrant.py +7 -7
  93. openlit/instrumentation/reka/__init__.py +5 -5
  94. openlit/instrumentation/reka/async_reka.py +93 -55
  95. openlit/instrumentation/reka/reka.py +93 -55
  96. openlit/instrumentation/together/__init__.py +9 -9
  97. openlit/instrumentation/together/async_together.py +284 -242
  98. openlit/instrumentation/together/together.py +284 -242
  99. openlit/instrumentation/transformers/__init__.py +3 -3
  100. openlit/instrumentation/transformers/transformers.py +79 -48
  101. openlit/instrumentation/vertexai/__init__.py +19 -69
  102. openlit/instrumentation/vertexai/async_vertexai.py +333 -990
  103. openlit/instrumentation/vertexai/vertexai.py +333 -990
  104. openlit/instrumentation/vllm/__init__.py +3 -3
  105. openlit/instrumentation/vllm/vllm.py +65 -35
  106. openlit/otel/events.py +85 -0
  107. openlit/otel/tracing.py +3 -13
  108. openlit/semcov/__init__.py +16 -4
  109. {openlit-1.33.9.dist-info → openlit-1.33.11.dist-info}/METADATA +2 -2
  110. openlit-1.33.11.dist-info/RECORD +125 -0
  111. openlit-1.33.9.dist-info/RECORD +0 -121
  112. {openlit-1.33.9.dist-info → openlit-1.33.11.dist-info}/LICENSE +0 -0
  113. {openlit-1.33.9.dist-info → openlit-1.33.11.dist-info}/WHEEL +0 -0
@@ -25,7 +25,7 @@ from openlit.semcov import SemanticConvetion
25
25
  logger = logging.getLogger(__name__)
26
26
 
27
27
  def chat_completions(version, environment, application_name,
28
- tracer, pricing_info, trace_content, metrics, disable_metrics):
28
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
29
29
  """
30
30
  Generates a telemetry wrapper for chat completions to collect metrics.
31
31
 
@@ -35,7 +35,7 @@ def chat_completions(version, environment, application_name,
35
35
  application_name: Name of the application using the OpenAI API.
36
36
  tracer: OpenTelemetry tracer for creating spans.
37
37
  pricing_info: Information used for calculating the cost of OpenAI usage.
38
- trace_content: Flag indicating whether to trace the actual content.
38
+ capture_message_content: Flag indicating whether to trace the actual content.
39
39
 
40
40
  Returns:
41
41
  A function that wraps the chat completions method to add telemetry.
@@ -44,7 +44,7 @@ def chat_completions(version, environment, application_name,
44
44
  class TracedSyncStream:
45
45
  """
46
46
  Wrapper for streaming responses to collect metrics and trace data.
47
- Wraps the 'openai.AsyncStream' response to collect message IDs and aggregated response.
47
+ Wraps the response to collect message IDs and aggregated response.
48
48
 
49
49
  This class implements the '__aiter__' and '__anext__' methods that
50
50
  handle asynchronous streaming responses.
@@ -197,11 +197,11 @@ def chat_completions(version, environment, application_name,
197
197
  output_tokens)
198
198
  self._span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
199
199
  self._server_address)
200
- self._span.set_attribute(SemanticConvetion.GEN_AI_OPENAI_REQUEST_SERVICE_TIER,
200
+ self._span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SERVICE_TIER,
201
201
  self._kwargs.get("service_tier", "auto"))
202
- self._span.set_attribute(SemanticConvetion.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER,
202
+ self._span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_SERVICE_TIER,
203
203
  self._openai_response_service_tier)
204
- self._span.set_attribute(SemanticConvetion.GEN_AI_OPENAI_RESPONSE_SYSTEM_FINGERPRINT,
204
+ self._span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_SYSTEM_FINGERPRINT,
205
205
  self._openai_system_fingerprint)
206
206
  if isinstance(self._llmresponse, str):
207
207
  self._span.set_attribute(SemanticConvetion.GEN_AI_OUTPUT_TYPE,
@@ -229,7 +229,7 @@ def chat_completions(version, environment, application_name,
229
229
  self._ttft)
230
230
  self._span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
231
231
  version)
232
- if trace_content:
232
+ if capture_message_content:
233
233
  self._span.add_event(
234
234
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
235
235
  attributes={
@@ -382,12 +382,12 @@ def chat_completions(version, environment, application_name,
382
382
  output_tokens)
383
383
  span.set_attribute(SemanticConvetion.SERVER_ADDRESS,
384
384
  server_address)
385
- span.set_attribute(SemanticConvetion.GEN_AI_OPENAI_REQUEST_SERVICE_TIER,
385
+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_SERVICE_TIER,
386
386
  kwargs.get("service_tier", "auto"))
387
- span.set_attribute(SemanticConvetion.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER,
387
+ span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_SERVICE_TIER,
388
388
  response_dict.get('service_tier'))
389
- span.set_attribute(SemanticConvetion.GEN_AI_OPENAI_RESPONSE_SYSTEM_FINGERPRINT,
390
- response_dict.get('system_fingerprint'))
389
+ span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_SYSTEM_FINGERPRINT,
390
+ str(response_dict.get('system_fingerprint', '')))
391
391
 
392
392
  # Set base span attribues (Extras)
393
393
  span.set_attribute(DEPLOYMENT_ENVIRONMENT,
@@ -406,7 +406,7 @@ def chat_completions(version, environment, application_name,
406
406
  end_time - start_time)
407
407
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
408
408
  version)
409
- if trace_content:
409
+ if capture_message_content:
410
410
  span.add_event(
411
411
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
412
412
  attributes={
@@ -417,7 +417,7 @@ def chat_completions(version, environment, application_name,
417
417
  for i in range(kwargs.get('n',1)):
418
418
  span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
419
419
  [response_dict.get('choices')[i].get('finish_reason')])
420
- if trace_content:
420
+ if capture_message_content:
421
421
  span.add_event(
422
422
  name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
423
423
  attributes={
@@ -477,7 +477,7 @@ def chat_completions(version, environment, application_name,
477
477
  return wrapper
478
478
 
479
479
  def embedding(version, environment, application_name,
480
- tracer, pricing_info, trace_content, metrics, disable_metrics):
480
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
481
481
  """
482
482
  Generates a telemetry wrapper for embeddings to collect metrics.
483
483
 
@@ -487,7 +487,7 @@ def embedding(version, environment, application_name,
487
487
  application_name: Name of the application using the OpenAI API.
488
488
  tracer: OpenTelemetry tracer for creating spans.
489
489
  pricing_info: Information used for calculating the cost of OpenAI usage.
490
- trace_content: Flag indicating whether to trace the actual content.
490
+ capture_message_content: Flag indicating whether to trace the actual content.
491
491
 
492
492
  Returns:
493
493
  A function that wraps the embeddings method to add telemetry.
@@ -561,7 +561,7 @@ def embedding(version, environment, application_name,
561
561
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
562
562
  version)
563
563
 
564
- if trace_content:
564
+ if capture_message_content:
565
565
  span.add_event(
566
566
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
567
567
  attributes={
@@ -605,7 +605,7 @@ def embedding(version, environment, application_name,
605
605
  return wrapper
606
606
 
607
607
  def image_generate(version, environment, application_name,
608
- tracer, pricing_info, trace_content, metrics, disable_metrics):
608
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
609
609
  """
610
610
  Generates a telemetry wrapper for image generation to collect metrics.
611
611
 
@@ -615,7 +615,7 @@ def image_generate(version, environment, application_name,
615
615
  application_name: Name of the application using the OpenAI API.
616
616
  tracer: OpenTelemetry tracer for creating spans.
617
617
  pricing_info: Information used for calculating the cost of OpenAI image generation.
618
- trace_content: Flag indicating whether to trace the input prompt and generated images.
618
+ capture_message_content: Flag indicating whether to trace the input prompt and generated images.
619
619
 
620
620
  Returns:
621
621
  A function that wraps the image generation method to add telemetry.
@@ -657,8 +657,6 @@ def image_generate(version, environment, application_name,
657
657
  else:
658
658
  image = "url"
659
659
 
660
- request_model = kwargs.get("model", "dall-e-2")
661
-
662
660
  # Calculate cost of the operation
663
661
  cost = get_image_model_cost(request_model,
664
662
  pricing_info, kwargs.get("size", "1024x1024"),
@@ -702,7 +700,7 @@ def image_generate(version, environment, application_name,
702
700
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
703
701
  version)
704
702
 
705
- if trace_content:
703
+ if capture_message_content:
706
704
  span.add_event(
707
705
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
708
706
  attributes={
@@ -754,7 +752,7 @@ def image_generate(version, environment, application_name,
754
752
  return wrapper
755
753
 
756
754
  def image_variatons(version, environment, application_name,
757
- tracer, pricing_info, trace_content, metrics, disable_metrics):
755
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
758
756
  """
759
757
  Generates a telemetry wrapper for creating image variations to collect metrics.
760
758
 
@@ -764,7 +762,7 @@ def image_variatons(version, environment, application_name,
764
762
  application_name: Name of the application using the OpenAI API.
765
763
  tracer: OpenTelemetry tracer for creating spans.
766
764
  pricing_info: Information used for calculating the cost of generating image variations.
767
- trace_content: Flag indicating whether to trace the input image and generated variations.
765
+ capture_message_content: Flag indicating whether to trace the input image and generated variations.
768
766
 
769
767
  Returns:
770
768
  A function that wraps the image variations creation method to add telemetry.
@@ -844,7 +842,7 @@ def image_variatons(version, environment, application_name,
844
842
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
845
843
  version)
846
844
 
847
- if trace_content:
845
+ if capture_message_content:
848
846
  attribute_name = f"{SemanticConvetion.GEN_AI_RESPONSE_IMAGE}.{images_count}"
849
847
  span.add_event(
850
848
  name=attribute_name,
@@ -890,7 +888,7 @@ def image_variatons(version, environment, application_name,
890
888
  return wrapper
891
889
 
892
890
  def audio_create(version, environment, application_name,
893
- tracer, pricing_info, trace_content, metrics, disable_metrics):
891
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
894
892
  """
895
893
  Generates a telemetry wrapper for creating speech audio to collect metrics.
896
894
 
@@ -900,7 +898,7 @@ def audio_create(version, environment, application_name,
900
898
  application_name: Name of the application using the OpenAI API.
901
899
  tracer: OpenTelemetry tracer for creating spans.
902
900
  pricing_info: Information used for calculating the cost of generating speech audio.
903
- trace_content: Flag indicating whether to trace the input text and generated audio.
901
+ capture_message_content: Flag indicating whether to trace the input text and generated audio.
904
902
 
905
903
  Returns:
906
904
  A function that wraps the speech audio creation method to add telemetry.
@@ -969,7 +967,7 @@ def audio_create(version, environment, application_name,
969
967
  cost)
970
968
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
971
969
  version)
972
- if trace_content:
970
+ if capture_message_content:
973
971
  span.add_event(
974
972
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
975
973
  attributes={
@@ -26,7 +26,7 @@ class PhidataInstrumentor(BaseInstrumentor):
26
26
  tracer = kwargs.get("tracer")
27
27
  metrics = kwargs.get("metrics_dict")
28
28
  pricing_info = kwargs.get("pricing_info", {})
29
- trace_content = kwargs.get("trace_content", False)
29
+ capture_message_content = kwargs.get("capture_message_content", False)
30
30
  disable_metrics = kwargs.get("disable_metrics")
31
31
  version = importlib.metadata.version("phidata")
32
32
 
@@ -34,7 +34,7 @@ class PhidataInstrumentor(BaseInstrumentor):
34
34
  "phi.agent",
35
35
  "Agent.print_response",
36
36
  phidata_wrap("phidata.print_response", version, environment, application_name,
37
- tracer, pricing_info, trace_content, metrics, disable_metrics),
37
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
38
38
  )
39
39
 
40
40
  def _uninstrument(self, **kwargs):
@@ -5,7 +5,7 @@ Module for monitoring Phidata calls.
5
5
 
6
6
  import logging
7
7
  from opentelemetry.trace import SpanKind, Status, StatusCode
8
- from opentelemetry.sdk.resources import TELEMETRY_SDK_NAME
8
+ from opentelemetry.sdk.resources import SERVICE_NAME, TELEMETRY_SDK_NAME, DEPLOYMENT_ENVIRONMENT
9
9
  from openlit.__helpers import (
10
10
  handle_exception,
11
11
  )
@@ -15,7 +15,7 @@ from openlit.semcov import SemanticConvetion
15
15
  logger = logging.getLogger(__name__)
16
16
 
17
17
  def phidata_wrap(gen_ai_endpoint, version, environment, application_name,
18
- tracer, pricing_info, trace_content, metrics, disable_metrics):
18
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
19
19
  """
20
20
  Generates a telemetry wrapper for chat completions to collect metrics.
21
21
 
@@ -26,7 +26,7 @@ def phidata_wrap(gen_ai_endpoint, version, environment, application_name,
26
26
  application_name: Name of the application using the Phidata Agent.
27
27
  tracer: OpenTelemetry tracer for creating spans.
28
28
  pricing_info: Information used for calculating the cost of Phidata usage.
29
- trace_content: Flag indicating whether to trace the actual content.
29
+ capture_message_content: Flag indicating whether to trace the actual content.
30
30
 
31
31
  Returns:
32
32
  A function that wraps the chat completions method to add telemetry.
@@ -62,8 +62,10 @@ def phidata_wrap(gen_ai_endpoint, version, environment, application_name,
62
62
  SemanticConvetion.GEN_AI_OPERATION_TYPE_AGENT)
63
63
  span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
64
64
  gen_ai_endpoint)
65
- span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
65
+ span.set_attribute(SERVICE_NAME,
66
66
  application_name)
67
+ span.set_attribute(DEPLOYMENT_ENVIRONMENT,
68
+ environment)
67
69
  span.set_attribute(SemanticConvetion.GEN_AI_AGENT_ID,
68
70
  getattr(instance, 'agent_id', '') or '')
69
71
  span.set_attribute(SemanticConvetion.GEN_AI_AGENT_ROLE,
@@ -21,7 +21,7 @@ class PineconeInstrumentor(BaseInstrumentor):
21
21
  tracer = kwargs.get("tracer")
22
22
  metrics = kwargs.get("metrics_dict")
23
23
  pricing_info = kwargs.get("pricing_info")
24
- trace_content = kwargs.get("trace_content")
24
+ capture_message_content = kwargs.get("capture_message_content")
25
25
  disable_metrics = kwargs.get("disable_metrics")
26
26
  version = importlib.metadata.version("pinecone-client")
27
27
 
@@ -29,35 +29,35 @@ class PineconeInstrumentor(BaseInstrumentor):
29
29
  "pinecone.control.pinecone",
30
30
  "Pinecone.create_index",
31
31
  general_wrap("pinecone.create_index", version, environment, application_name,
32
- tracer, pricing_info, trace_content, metrics, disable_metrics),
32
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
33
33
  )
34
34
 
35
35
  wrap_function_wrapper(
36
36
  "pinecone.data.index",
37
37
  "Index.upsert",
38
38
  general_wrap("pinecone.upsert", version, environment, application_name,
39
- tracer, pricing_info, trace_content, metrics, disable_metrics),
39
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
40
40
  )
41
41
 
42
42
  wrap_function_wrapper(
43
43
  "pinecone.data.index",
44
44
  "Index.query",
45
45
  general_wrap("pinecone.query", version, environment, application_name,
46
- tracer, pricing_info, trace_content, metrics, disable_metrics),
46
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
47
47
  )
48
48
 
49
49
  wrap_function_wrapper(
50
50
  "pinecone.data.index",
51
51
  "Index.update",
52
52
  general_wrap("pinecone.update", version, environment, application_name,
53
- tracer, pricing_info, trace_content, metrics, disable_metrics),
53
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
54
54
  )
55
55
 
56
56
  wrap_function_wrapper(
57
57
  "pinecone.data.index",
58
58
  "Index.delete",
59
59
  general_wrap("pinecone.delete", version, environment, application_name,
60
- tracer, pricing_info, trace_content, metrics, disable_metrics),
60
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
61
61
  )
62
62
 
63
63
 
@@ -5,7 +5,7 @@ Module for monitoring Pinecone.
5
5
 
6
6
  import logging
7
7
  from opentelemetry.trace import SpanKind, Status, StatusCode
8
- from opentelemetry.sdk.resources import TELEMETRY_SDK_NAME
8
+ from opentelemetry.sdk.resources import SERVICE_NAME, TELEMETRY_SDK_NAME, DEPLOYMENT_ENVIRONMENT
9
9
  from openlit.__helpers import handle_exception
10
10
  from openlit.semcov import SemanticConvetion
11
11
 
@@ -23,7 +23,7 @@ def object_count(obj):
23
23
  return None
24
24
 
25
25
  def general_wrap(gen_ai_endpoint, version, environment, application_name,
26
- tracer, pricing_info, trace_content, metrics, disable_metrics):
26
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
27
27
  """
28
28
  Wraps a Pinecone operation to trace and log its execution metrics.
29
29
 
@@ -40,7 +40,7 @@ def general_wrap(gen_ai_endpoint, version, environment, application_name,
40
40
  - application_name (str): The name of the application performing the Pinecone operation.
41
41
  - tracer (opentelemetry.trace.Tracer): An object used for OpenTelemetry tracing.
42
42
  - pricing_info (dict): Information about pricing, not used in current implementation.
43
- - trace_content (bool): A flag indicating whether the content of responses should be traced.
43
+ - capture_message_content (bool): A flag indicating whether the content of responses should be traced.
44
44
 
45
45
  Returns:
46
46
  - function: A decorator function that, when applied, wraps the target function with
@@ -72,9 +72,9 @@ def general_wrap(gen_ai_endpoint, version, environment, application_name,
72
72
  span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
73
73
  span.set_attribute(SemanticConvetion.GEN_AI_ENDPOINT,
74
74
  gen_ai_endpoint)
75
- span.set_attribute(SemanticConvetion.GEN_AI_ENVIRONMENT,
75
+ span.set_attribute(DEPLOYMENT_ENVIRONMENT,
76
76
  environment)
77
- span.set_attribute(SemanticConvetion.GEN_AI_APPLICATION_NAME,
77
+ span.set_attribute(SERVICE_NAME,
78
78
  application_name)
79
79
  span.set_attribute(SemanticConvetion.GEN_AI_OPERATION,
80
80
  SemanticConvetion.GEN_AI_OPERATION_TYPE_VECTORDB)
@@ -146,11 +146,11 @@ def general_wrap(gen_ai_endpoint, version, environment, application_name,
146
146
  attributes = {
147
147
  TELEMETRY_SDK_NAME:
148
148
  "openlit",
149
- SemanticConvetion.GEN_AI_APPLICATION_NAME:
149
+ SERVICE_NAME:
150
150
  application_name,
151
151
  SemanticConvetion.DB_SYSTEM:
152
152
  SemanticConvetion.DB_SYSTEM_PINECONE,
153
- SemanticConvetion.GEN_AI_ENVIRONMENT:
153
+ DEPLOYMENT_ENVIRONMENT:
154
154
  environment,
155
155
  SemanticConvetion.GEN_AI_OPERATION:
156
156
  SemanticConvetion.GEN_AI_OPERATION_TYPE_VECTORDB,
@@ -26,7 +26,7 @@ class PremAIInstrumentor(BaseInstrumentor):
26
26
  tracer = kwargs.get("tracer")
27
27
  metrics = kwargs.get("metrics_dict")
28
28
  pricing_info = kwargs.get("pricing_info", {})
29
- trace_content = kwargs.get("trace_content", False)
29
+ capture_message_content = kwargs.get("capture_message_content", False)
30
30
  disable_metrics = kwargs.get("disable_metrics")
31
31
  version = importlib.metadata.version("premai")
32
32
 
@@ -34,16 +34,16 @@ class PremAIInstrumentor(BaseInstrumentor):
34
34
  wrap_function_wrapper(
35
35
  "premai.api",
36
36
  "ChatCompletionsModule.create",
37
- chat("premai.chat.completions", version, environment, application_name,
38
- tracer, pricing_info, trace_content, metrics, disable_metrics),
37
+ chat(version, environment, application_name,
38
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
39
39
  )
40
40
 
41
41
  # sync embedding
42
42
  wrap_function_wrapper(
43
43
  "premai.api",
44
44
  "EmbeddingsModule.create",
45
- embedding("premai.embeddings", version, environment, application_name,
46
- tracer, pricing_info, trace_content, metrics, disable_metrics),
45
+ embedding(version, environment, application_name,
46
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
47
47
  )
48
48
 
49
49
  def _uninstrument(self, **kwargs):