openlit 1.33.10__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 (112) hide show
  1. openlit/__helpers.py +73 -0
  2. openlit/__init__.py +38 -11
  3. openlit/instrumentation/ag2/__init__.py +9 -10
  4. openlit/instrumentation/ag2/ag2.py +133 -68
  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 +4 -4
  11. openlit/instrumentation/anthropic/async_anthropic.py +4 -4
  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 +2 -2
  16. openlit/instrumentation/astra/async_astra.py +2 -2
  17. openlit/instrumentation/azure_ai_inference/__init__.py +5 -5
  18. openlit/instrumentation/azure_ai_inference/async_azure_ai_inference.py +8 -8
  19. openlit/instrumentation/azure_ai_inference/azure_ai_inference.py +8 -8
  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 +2 -2
  24. openlit/instrumentation/cohere/__init__.py +7 -7
  25. openlit/instrumentation/cohere/async_cohere.py +9 -9
  26. openlit/instrumentation/cohere/cohere.py +9 -9
  27. openlit/instrumentation/controlflow/__init__.py +4 -4
  28. openlit/instrumentation/controlflow/controlflow.py +2 -2
  29. openlit/instrumentation/crawl4ai/__init__.py +3 -3
  30. openlit/instrumentation/crawl4ai/async_crawl4ai.py +2 -2
  31. openlit/instrumentation/crawl4ai/crawl4ai.py +2 -2
  32. openlit/instrumentation/crewai/__init__.py +3 -3
  33. openlit/instrumentation/crewai/crewai.py +2 -2
  34. openlit/instrumentation/dynamiq/__init__.py +5 -5
  35. openlit/instrumentation/dynamiq/dynamiq.py +2 -2
  36. openlit/instrumentation/elevenlabs/__init__.py +5 -5
  37. openlit/instrumentation/elevenlabs/async_elevenlabs.py +3 -3
  38. openlit/instrumentation/elevenlabs/elevenlabs.py +3 -3
  39. openlit/instrumentation/embedchain/__init__.py +2 -2
  40. openlit/instrumentation/embedchain/embedchain.py +4 -4
  41. openlit/instrumentation/firecrawl/__init__.py +3 -3
  42. openlit/instrumentation/firecrawl/firecrawl.py +2 -2
  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 +3 -3
  47. openlit/instrumentation/gpt4all/gpt4all.py +7 -7
  48. openlit/instrumentation/groq/__init__.py +3 -3
  49. openlit/instrumentation/groq/async_groq.py +5 -5
  50. openlit/instrumentation/groq/groq.py +5 -5
  51. openlit/instrumentation/haystack/__init__.py +2 -2
  52. openlit/instrumentation/haystack/haystack.py +2 -2
  53. openlit/instrumentation/julep/__init__.py +7 -7
  54. openlit/instrumentation/julep/async_julep.py +3 -3
  55. openlit/instrumentation/julep/julep.py +3 -3
  56. openlit/instrumentation/langchain/__init__.py +2 -2
  57. openlit/instrumentation/langchain/async_langchain.py +13 -9
  58. openlit/instrumentation/langchain/langchain.py +13 -8
  59. openlit/instrumentation/letta/__init__.py +7 -7
  60. openlit/instrumentation/letta/letta.py +5 -5
  61. openlit/instrumentation/litellm/__init__.py +5 -5
  62. openlit/instrumentation/litellm/async_litellm.py +8 -8
  63. openlit/instrumentation/litellm/litellm.py +8 -8
  64. openlit/instrumentation/llamaindex/__init__.py +2 -2
  65. openlit/instrumentation/llamaindex/llamaindex.py +2 -2
  66. openlit/instrumentation/mem0/__init__.py +2 -2
  67. openlit/instrumentation/mem0/mem0.py +2 -2
  68. openlit/instrumentation/milvus/__init__.py +2 -2
  69. openlit/instrumentation/milvus/milvus.py +2 -2
  70. openlit/instrumentation/mistral/__init__.py +7 -7
  71. openlit/instrumentation/mistral/async_mistral.py +10 -10
  72. openlit/instrumentation/mistral/mistral.py +10 -10
  73. openlit/instrumentation/multion/__init__.py +7 -7
  74. openlit/instrumentation/multion/async_multion.py +5 -5
  75. openlit/instrumentation/multion/multion.py +5 -5
  76. openlit/instrumentation/ollama/__init__.py +11 -9
  77. openlit/instrumentation/ollama/async_ollama.py +71 -465
  78. openlit/instrumentation/ollama/ollama.py +71 -465
  79. openlit/instrumentation/ollama/utils.py +333 -0
  80. openlit/instrumentation/openai/__init__.py +11 -11
  81. openlit/instrumentation/openai/async_openai.py +18 -18
  82. openlit/instrumentation/openai/openai.py +18 -18
  83. openlit/instrumentation/phidata/__init__.py +2 -2
  84. openlit/instrumentation/phidata/phidata.py +2 -2
  85. openlit/instrumentation/pinecone/__init__.py +6 -6
  86. openlit/instrumentation/pinecone/pinecone.py +2 -2
  87. openlit/instrumentation/premai/__init__.py +3 -3
  88. openlit/instrumentation/premai/premai.py +7 -7
  89. openlit/instrumentation/qdrant/__init__.py +2 -2
  90. openlit/instrumentation/qdrant/async_qdrant.py +2 -2
  91. openlit/instrumentation/qdrant/qdrant.py +2 -2
  92. openlit/instrumentation/reka/__init__.py +3 -3
  93. openlit/instrumentation/reka/async_reka.py +3 -3
  94. openlit/instrumentation/reka/reka.py +3 -3
  95. openlit/instrumentation/together/__init__.py +5 -5
  96. openlit/instrumentation/together/async_together.py +8 -8
  97. openlit/instrumentation/together/together.py +8 -8
  98. openlit/instrumentation/transformers/__init__.py +2 -2
  99. openlit/instrumentation/transformers/transformers.py +4 -4
  100. openlit/instrumentation/vertexai/__init__.py +9 -9
  101. openlit/instrumentation/vertexai/async_vertexai.py +4 -4
  102. openlit/instrumentation/vertexai/vertexai.py +4 -4
  103. openlit/instrumentation/vllm/__init__.py +2 -2
  104. openlit/instrumentation/vllm/vllm.py +3 -3
  105. openlit/otel/events.py +85 -0
  106. openlit/otel/tracing.py +3 -13
  107. openlit/semcov/__init__.py +13 -1
  108. {openlit-1.33.10.dist-info → openlit-1.33.11.dist-info}/METADATA +2 -2
  109. openlit-1.33.11.dist-info/RECORD +125 -0
  110. openlit-1.33.10.dist-info/RECORD +0 -122
  111. {openlit-1.33.10.dist-info → openlit-1.33.11.dist-info}/LICENSE +0 -0
  112. {openlit-1.33.10.dist-info → openlit-1.33.11.dist-info}/WHEEL +0 -0
@@ -15,7 +15,7 @@ from openlit.semcov import SemanticConvetion
15
15
  logger = logging.getLogger(__name__)
16
16
 
17
17
  def create_agent(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 create_agent(gen_ai_endpoint, version, environment, application_name,
26
26
  application_name: Name of the application using the Letta Agent.
27
27
  tracer: OpenTelemetry tracer for creating spans.
28
28
  pricing_info: Information used for calculating the cost of Letta 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.
@@ -94,7 +94,7 @@ def create_agent(gen_ai_endpoint, version, environment, application_name,
94
94
  return wrapper
95
95
 
96
96
  def send_message(gen_ai_endpoint, version, environment, application_name,
97
- tracer, pricing_info, trace_content, metrics, disable_metrics):
97
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
98
98
  """
99
99
  Generates a telemetry wrapper for chat completions to collect metrics.
100
100
 
@@ -105,7 +105,7 @@ def send_message(gen_ai_endpoint, version, environment, application_name,
105
105
  application_name: Name of the application using the Letta Agent.
106
106
  tracer: OpenTelemetry tracer for creating spans.
107
107
  pricing_info: Information used for calculating the cost of Letta usage.
108
- trace_content: Flag indicating whether to trace the actual content.
108
+ capture_message_content: Flag indicating whether to trace the actual content.
109
109
 
110
110
  Returns:
111
111
  A function that wraps the chat completions method to add telemetry.
@@ -158,7 +158,7 @@ def send_message(gen_ai_endpoint, version, environment, application_name,
158
158
  span.set_attribute(SemanticConvetion.GEN_AI_USAGE_COST,
159
159
  cost)
160
160
 
161
- if trace_content:
161
+ if capture_message_content:
162
162
  span.add_event(
163
163
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
164
164
  attributes={
@@ -29,7 +29,7 @@ class LiteLLMInstrumentor(BaseInstrumentor):
29
29
  tracer = kwargs.get("tracer")
30
30
  metrics = kwargs.get("metrics_dict")
31
31
  pricing_info = kwargs.get("pricing_info", {})
32
- trace_content = kwargs.get("trace_content", False)
32
+ capture_message_content = kwargs.get("capture_message_content", False)
33
33
  disable_metrics = kwargs.get("disable_metrics")
34
34
  version = importlib.metadata.version("litellm")
35
35
 
@@ -38,28 +38,28 @@ class LiteLLMInstrumentor(BaseInstrumentor):
38
38
  "litellm",
39
39
  "completion",
40
40
  completion(version, environment, application_name,
41
- tracer, pricing_info, trace_content, metrics, disable_metrics),
41
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
42
42
  )
43
43
 
44
44
  wrap_function_wrapper(
45
45
  "litellm",
46
46
  "acompletion",
47
47
  acompletion(version, environment, application_name,
48
- tracer, pricing_info, trace_content, metrics, disable_metrics),
48
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
49
49
  )
50
50
 
51
51
  wrap_function_wrapper(
52
52
  "litellm",
53
53
  "embedding",
54
54
  embedding(version, environment, application_name,
55
- tracer, pricing_info, trace_content, metrics, disable_metrics),
55
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
56
56
  )
57
57
 
58
58
  wrap_function_wrapper(
59
59
  "litellm",
60
60
  "aembedding",
61
61
  aembedding(version, environment, application_name,
62
- tracer, pricing_info, trace_content, metrics, disable_metrics),
62
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
63
63
  )
64
64
 
65
65
  def _uninstrument(self, **kwargs):
@@ -22,7 +22,7 @@ from openlit.semcov import SemanticConvetion
22
22
  logger = logging.getLogger(__name__)
23
23
 
24
24
  def acompletion(version, environment, application_name,
25
- tracer, pricing_info, trace_content, metrics, disable_metrics):
25
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
26
26
  """
27
27
  Generates a telemetry wrapper for chat completions to collect metrics.
28
28
 
@@ -32,7 +32,7 @@ def acompletion(version, environment, application_name,
32
32
  application_name: Name of the application using the LiteLLM SDK.
33
33
  tracer: OpenTelemetry tracer for creating spans.
34
34
  pricing_info: Information used for calculating the cost of LiteLLM usage.
35
- trace_content: Flag indicating whether to trace the actual content.
35
+ capture_message_content: Flag indicating whether to trace the actual content.
36
36
 
37
37
  Returns:
38
38
  A function that wraps the chat completions method to add telemetry.
@@ -217,7 +217,7 @@ def acompletion(version, environment, application_name,
217
217
  self._ttft)
218
218
  self._span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
219
219
  version)
220
- if trace_content:
220
+ if capture_message_content:
221
221
  self._span.add_event(
222
222
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
223
223
  attributes={
@@ -393,7 +393,7 @@ def acompletion(version, environment, application_name,
393
393
  end_time - start_time)
394
394
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
395
395
  version)
396
- if trace_content:
396
+ if capture_message_content:
397
397
  span.add_event(
398
398
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
399
399
  attributes={
@@ -404,7 +404,7 @@ def acompletion(version, environment, application_name,
404
404
  for i in range(kwargs.get('n',1)):
405
405
  span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
406
406
  [response_dict.get('choices')[i].get('finish_reason')])
407
- if trace_content:
407
+ if capture_message_content:
408
408
  span.add_event(
409
409
  name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
410
410
  attributes={
@@ -464,7 +464,7 @@ def acompletion(version, environment, application_name,
464
464
  return wrapper
465
465
 
466
466
  def aembedding(version, environment, application_name,
467
- tracer, pricing_info, trace_content, metrics, disable_metrics):
467
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
468
468
  """
469
469
  Generates a telemetry wrapper for embeddings to collect metrics.
470
470
 
@@ -474,7 +474,7 @@ def aembedding(version, environment, application_name,
474
474
  application_name: Name of the application using the LiteLLM API.
475
475
  tracer: OpenTelemetry tracer for creating spans.
476
476
  pricing_info: Information used for calculating the cost of LiteLLM usage.
477
- trace_content: Flag indicating whether to trace the actual content.
477
+ capture_message_content: Flag indicating whether to trace the actual content.
478
478
 
479
479
  Returns:
480
480
  A function that wraps the embeddings method to add telemetry.
@@ -548,7 +548,7 @@ def aembedding(version, environment, application_name,
548
548
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
549
549
  version)
550
550
 
551
- if trace_content:
551
+ if capture_message_content:
552
552
  span.add_event(
553
553
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
554
554
  attributes={
@@ -22,7 +22,7 @@ from openlit.semcov import SemanticConvetion
22
22
  logger = logging.getLogger(__name__)
23
23
 
24
24
  def completion(version, environment, application_name,
25
- tracer, pricing_info, trace_content, metrics, disable_metrics):
25
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
26
26
  """
27
27
  Generates a telemetry wrapper for chat completions to collect metrics.
28
28
 
@@ -32,7 +32,7 @@ def completion(version, environment, application_name,
32
32
  application_name: Name of the application using the LiteLLM SDK.
33
33
  tracer: OpenTelemetry tracer for creating spans.
34
34
  pricing_info: Information used for calculating the cost of LiteLLM usage.
35
- trace_content: Flag indicating whether to trace the actual content.
35
+ capture_message_content: Flag indicating whether to trace the actual content.
36
36
 
37
37
  Returns:
38
38
  A function that wraps the chat completions method to add telemetry.
@@ -217,7 +217,7 @@ def completion(version, environment, application_name,
217
217
  self._ttft)
218
218
  self._span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
219
219
  version)
220
- if trace_content:
220
+ if capture_message_content:
221
221
  self._span.add_event(
222
222
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
223
223
  attributes={
@@ -393,7 +393,7 @@ def completion(version, environment, application_name,
393
393
  end_time - start_time)
394
394
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
395
395
  version)
396
- if trace_content:
396
+ if capture_message_content:
397
397
  span.add_event(
398
398
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
399
399
  attributes={
@@ -404,7 +404,7 @@ def completion(version, environment, application_name,
404
404
  for i in range(kwargs.get('n',1)):
405
405
  span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
406
406
  [response_dict.get('choices')[i].get('finish_reason')])
407
- if trace_content:
407
+ if capture_message_content:
408
408
  span.add_event(
409
409
  name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
410
410
  attributes={
@@ -464,7 +464,7 @@ def completion(version, environment, application_name,
464
464
  return wrapper
465
465
 
466
466
  def embedding(version, environment, application_name,
467
- tracer, pricing_info, trace_content, metrics, disable_metrics):
467
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
468
468
  """
469
469
  Generates a telemetry wrapper for embeddings to collect metrics.
470
470
 
@@ -474,7 +474,7 @@ def embedding(version, environment, application_name,
474
474
  application_name: Name of the application using the LiteLLM API.
475
475
  tracer: OpenTelemetry tracer for creating spans.
476
476
  pricing_info: Information used for calculating the cost of LiteLLM usage.
477
- trace_content: Flag indicating whether to trace the actual content.
477
+ capture_message_content: Flag indicating whether to trace the actual content.
478
478
 
479
479
  Returns:
480
480
  A function that wraps the embeddings method to add telemetry.
@@ -548,7 +548,7 @@ def embedding(version, environment, application_name,
548
548
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
549
549
  version)
550
550
 
551
- if trace_content:
551
+ if capture_message_content:
552
552
  span.add_event(
553
553
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
554
554
  attributes={
@@ -35,7 +35,7 @@ class LlamaIndexInstrumentor(BaseInstrumentor):
35
35
  environment = kwargs.get("environment")
36
36
  tracer = kwargs.get("tracer")
37
37
  pricing_info = kwargs.get("pricing_info")
38
- trace_content = kwargs.get("trace_content")
38
+ capture_message_content = kwargs.get("capture_message_content")
39
39
  version = importlib.metadata.version("llama-index")
40
40
 
41
41
  for wrapped_method in WRAPPED_METHODS:
@@ -47,7 +47,7 @@ class LlamaIndexInstrumentor(BaseInstrumentor):
47
47
  wrap_package,
48
48
  wrap_object,
49
49
  wrapper(gen_ai_endpoint, version, environment, application_name,
50
- tracer, pricing_info, trace_content),
50
+ tracer, pricing_info, capture_message_content),
51
51
  )
52
52
 
53
53
  @staticmethod
@@ -13,7 +13,7 @@ from openlit.semcov import SemanticConvetion
13
13
  logger = logging.getLogger(__name__)
14
14
 
15
15
  def load_data(gen_ai_endpoint, version, environment, application_name,
16
- tracer, pricing_info, trace_content):
16
+ tracer, pricing_info, capture_message_content):
17
17
  """
18
18
  Creates a wrapper around a function call to trace and log its execution metrics.
19
19
 
@@ -27,7 +27,7 @@ def load_data(gen_ai_endpoint, version, environment, application_name,
27
27
  - application_name (str): Name of the LlamaIndex application.
28
28
  - tracer (opentelemetry.trace.Tracer): The tracer object used for OpenTelemetry tracing.
29
29
  - pricing_info (dict): Information about the pricing for internal metrics (currently not used).
30
- - trace_content (bool): Flag indicating whether to trace the content of the response.
30
+ - capture_message_content (bool): Flag indicating whether to trace the content of the response.
31
31
 
32
32
  Returns:
33
33
  - function: A higher-order function that takes a function 'wrapped' and returns
@@ -59,7 +59,7 @@ class Mem0Instrumentor(BaseInstrumentor):
59
59
  environment = kwargs.get("environment")
60
60
  tracer = kwargs.get("tracer")
61
61
  pricing_info = kwargs.get("pricing_info")
62
- trace_content = kwargs.get("trace_content")
62
+ capture_message_content = kwargs.get("capture_message_content")
63
63
  version = importlib.metadata.version("mem0ai")
64
64
 
65
65
  for wrapped_method in WRAPPED_METHODS:
@@ -71,7 +71,7 @@ class Mem0Instrumentor(BaseInstrumentor):
71
71
  wrap_package,
72
72
  wrap_object,
73
73
  wrapper(gen_ai_endpoint, version, environment, application_name,
74
- tracer, pricing_info, trace_content),
74
+ tracer, pricing_info, capture_message_content),
75
75
  )
76
76
 
77
77
  @staticmethod
@@ -13,7 +13,7 @@ from openlit.semcov import SemanticConvetion
13
13
  logger = logging.getLogger(__name__)
14
14
 
15
15
  def mem0_wrap(gen_ai_endpoint, version, environment, application_name,
16
- tracer, pricing_info, trace_content):
16
+ tracer, pricing_info, capture_message_content):
17
17
  """
18
18
  Creates a wrapper around a function call to trace and log its execution metrics.
19
19
 
@@ -27,7 +27,7 @@ def mem0_wrap(gen_ai_endpoint, version, environment, application_name,
27
27
  - application_name (str): Name of the mem0 application.
28
28
  - tracer (opentelemetry.trace.Tracer): The tracer object used for OpenTelemetry tracing.
29
29
  - pricing_info (dict): Information about the pricing for internal metrics (currently not used).
30
- - trace_content (bool): Flag indicating whether to trace the content of the response.
30
+ - capture_message_content (bool): Flag indicating whether to trace the content of the response.
31
31
 
32
32
  Returns:
33
33
  - function: A higher-order function that takes a function 'wrapped' and returns
@@ -72,7 +72,7 @@ class MilvusInstrumentor(BaseInstrumentor):
72
72
  tracer = kwargs.get("tracer")
73
73
  metrics = kwargs.get("metrics_dict")
74
74
  pricing_info = kwargs.get("pricing_info")
75
- trace_content = kwargs.get("trace_content")
75
+ capture_message_content = kwargs.get("capture_message_content")
76
76
  disable_metrics = kwargs.get("disable_metrics")
77
77
  version = importlib.metadata.version("pymilvus")
78
78
 
@@ -85,7 +85,7 @@ class MilvusInstrumentor(BaseInstrumentor):
85
85
  wrap_package,
86
86
  wrap_object,
87
87
  wrapper(gen_ai_endpoint, version, environment, application_name,
88
- tracer, pricing_info, trace_content, metrics, disable_metrics),
88
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
89
89
  )
90
90
 
91
91
 
@@ -25,7 +25,7 @@ def object_count(obj):
25
25
  return cnt
26
26
 
27
27
  def general_wrap(gen_ai_endpoint, 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
  Creates a wrapper around a function call to trace and log its execution metrics.
31
31
 
@@ -39,7 +39,7 @@ def general_wrap(gen_ai_endpoint, version, environment, application_name,
39
39
  - application_name (str): Name of the Langchain application.
40
40
  - tracer (opentelemetry.trace.Tracer): The tracer object used for OpenTelemetry tracing.
41
41
  - pricing_info (dict): Information about the pricing for internal metrics (currently not used).
42
- - trace_content (bool): Flag indicating whether to trace the content of the response.
42
+ - capture_message_content (bool): Flag indicating whether to trace the content of the response.
43
43
 
44
44
  Returns:
45
45
  - function: A higher-order function that takes a function 'wrapped' and returns
@@ -23,7 +23,7 @@ class MistralInstrumentor(BaseInstrumentor):
23
23
  tracer = kwargs.get("tracer")
24
24
  metrics = kwargs.get("metrics_dict")
25
25
  pricing_info = kwargs.get("pricing_info")
26
- trace_content = kwargs.get("trace_content")
26
+ capture_message_content = kwargs.get("capture_message_content")
27
27
  disable_metrics = kwargs.get("disable_metrics")
28
28
  version = importlib.metadata.version("mistralai")
29
29
 
@@ -32,7 +32,7 @@ class MistralInstrumentor(BaseInstrumentor):
32
32
  "mistralai.chat",
33
33
  "Chat.complete",
34
34
  chat(version, environment, application_name,
35
- tracer, pricing_info, trace_content, metrics, disable_metrics),
35
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
36
36
  )
37
37
 
38
38
  # sync
@@ -40,7 +40,7 @@ class MistralInstrumentor(BaseInstrumentor):
40
40
  "mistralai.chat",
41
41
  "Chat.stream",
42
42
  chat_stream(version, environment, application_name,
43
- tracer, pricing_info, trace_content, metrics, disable_metrics),
43
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
44
44
  )
45
45
 
46
46
  # sync
@@ -48,7 +48,7 @@ class MistralInstrumentor(BaseInstrumentor):
48
48
  "mistralai.embeddings",
49
49
  "Embeddings.create",
50
50
  embeddings(version, environment, application_name,
51
- tracer, pricing_info, trace_content, metrics, disable_metrics),
51
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
52
52
  )
53
53
 
54
54
  # Async
@@ -56,7 +56,7 @@ class MistralInstrumentor(BaseInstrumentor):
56
56
  "mistralai.chat",
57
57
  "Chat.complete_async",
58
58
  async_chat(version, environment, application_name,
59
- tracer, pricing_info, trace_content, metrics, disable_metrics),
59
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
60
60
  )
61
61
 
62
62
  # Async
@@ -64,7 +64,7 @@ class MistralInstrumentor(BaseInstrumentor):
64
64
  "mistralai.chat",
65
65
  "Chat.stream_async",
66
66
  async_chat_stream(version, environment, application_name,
67
- tracer, pricing_info, trace_content, metrics, disable_metrics),
67
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
68
68
  )
69
69
 
70
70
  #sync
@@ -72,7 +72,7 @@ class MistralInstrumentor(BaseInstrumentor):
72
72
  "mistralai.embeddings",
73
73
  "Embeddings.create_async",
74
74
  async_embeddings(version, environment, application_name,
75
- tracer, pricing_info, trace_content, metrics, disable_metrics),
75
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
76
76
  )
77
77
 
78
78
  @staticmethod
@@ -22,7 +22,7 @@ from openlit.semcov import SemanticConvetion
22
22
  logger = logging.getLogger(__name__)
23
23
 
24
24
  def async_chat(version, environment, application_name, tracer,
25
- pricing_info, trace_content, metrics, disable_metrics):
25
+ pricing_info, capture_message_content, metrics, disable_metrics):
26
26
  """
27
27
  Generates a telemetry wrapper for chat to collect metrics.
28
28
 
@@ -32,7 +32,7 @@ def async_chat(version, environment, application_name, tracer,
32
32
  application_name: Name of the application using the Mistral API.
33
33
  tracer: OpenTelemetry tracer for creating spans.
34
34
  pricing_info: Information used for calculating the cost of Mistral usage.
35
- trace_content: Flag indicating whether to trace the actual content.
35
+ capture_message_content: Flag indicating whether to trace the actual content.
36
36
 
37
37
  Returns:
38
38
  A function that wraps the chat method to add telemetry.
@@ -144,7 +144,7 @@ def async_chat(version, environment, application_name, tracer,
144
144
  end_time - start_time)
145
145
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
146
146
  version)
147
- if trace_content:
147
+ if capture_message_content:
148
148
  span.add_event(
149
149
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
150
150
  attributes={
@@ -155,7 +155,7 @@ def async_chat(version, environment, application_name, tracer,
155
155
  for i in range(kwargs.get('n',1)):
156
156
  span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
157
157
  [response_dict.get('choices')[i].get('finish_reason')])
158
- if trace_content:
158
+ if capture_message_content:
159
159
  span.add_event(
160
160
  name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
161
161
  attributes={
@@ -215,7 +215,7 @@ def async_chat(version, environment, application_name, tracer,
215
215
  return wrapper
216
216
 
217
217
  def async_chat_stream(version, environment, application_name,
218
- tracer, pricing_info, trace_content, metrics, disable_metrics):
218
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
219
219
  """
220
220
  Generates a telemetry wrapper for chat_stream to collect metrics.
221
221
 
@@ -225,7 +225,7 @@ def async_chat_stream(version, environment, application_name,
225
225
  application_name: Name of the application using the Mistral API.
226
226
  tracer: OpenTelemetry tracer for creating spans.
227
227
  pricing_info: Information used for calculating the cost of Mistral usage.
228
- trace_content: Flag indicating whether to trace the actual content.
228
+ capture_message_content: Flag indicating whether to trace the actual content.
229
229
 
230
230
  Returns:
231
231
  A function that wraps the chat method to add telemetry.
@@ -422,7 +422,7 @@ def async_chat_stream(version, environment, application_name,
422
422
  self._ttft)
423
423
  self._span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
424
424
  version)
425
- if trace_content:
425
+ if capture_message_content:
426
426
  self._span.add_event(
427
427
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
428
428
  attributes={
@@ -485,7 +485,7 @@ def async_chat_stream(version, environment, application_name,
485
485
  return wrapper
486
486
 
487
487
  def async_embeddings(version, environment, application_name,
488
- tracer, pricing_info, trace_content, metrics, disable_metrics):
488
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
489
489
  """
490
490
  Generates a telemetry wrapper for embeddings to collect metrics.
491
491
 
@@ -495,7 +495,7 @@ def async_embeddings(version, environment, application_name,
495
495
  application_name: Name of the application using the Mistral API.
496
496
  tracer: OpenTelemetry tracer for creating spans.
497
497
  pricing_info: Information used for calculating the cost of Mistral usage.
498
- trace_content: Flag indicating whether to trace the actual content.
498
+ capture_message_content: Flag indicating whether to trace the actual content.
499
499
 
500
500
  Returns:
501
501
  A function that wraps the embeddings method to add telemetry.
@@ -567,7 +567,7 @@ def async_embeddings(version, environment, application_name,
567
567
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
568
568
  version)
569
569
 
570
- if trace_content:
570
+ if capture_message_content:
571
571
  span.add_event(
572
572
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
573
573
  attributes={
@@ -22,7 +22,7 @@ from openlit.semcov import SemanticConvetion
22
22
  logger = logging.getLogger(__name__)
23
23
 
24
24
  def chat(version, environment, application_name, tracer,
25
- pricing_info, trace_content, metrics, disable_metrics):
25
+ pricing_info, capture_message_content, metrics, disable_metrics):
26
26
  """
27
27
  Generates a telemetry wrapper for chat to collect metrics.
28
28
 
@@ -32,7 +32,7 @@ def chat(version, environment, application_name, tracer,
32
32
  application_name: Name of the application using the Mistral API.
33
33
  tracer: OpenTelemetry tracer for creating spans.
34
34
  pricing_info: Information used for calculating the cost of Mistral usage.
35
- trace_content: Flag indicating whether to trace the actual content.
35
+ capture_message_content: Flag indicating whether to trace the actual content.
36
36
 
37
37
  Returns:
38
38
  A function that wraps the chat method to add telemetry.
@@ -144,7 +144,7 @@ def chat(version, environment, application_name, tracer,
144
144
  end_time - start_time)
145
145
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
146
146
  version)
147
- if trace_content:
147
+ if capture_message_content:
148
148
  span.add_event(
149
149
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
150
150
  attributes={
@@ -155,7 +155,7 @@ def chat(version, environment, application_name, tracer,
155
155
  for i in range(kwargs.get('n',1)):
156
156
  span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_FINISH_REASON,
157
157
  [response_dict.get('choices')[i].get('finish_reason')])
158
- if trace_content:
158
+ if capture_message_content:
159
159
  span.add_event(
160
160
  name=SemanticConvetion.GEN_AI_CONTENT_COMPLETION_EVENT,
161
161
  attributes={
@@ -215,7 +215,7 @@ def chat(version, environment, application_name, tracer,
215
215
  return wrapper
216
216
 
217
217
  def chat_stream(version, environment, application_name,
218
- tracer, pricing_info, trace_content, metrics, disable_metrics):
218
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
219
219
  """
220
220
  Generates a telemetry wrapper for chat_stream to collect metrics.
221
221
 
@@ -225,7 +225,7 @@ def chat_stream(version, environment, application_name,
225
225
  application_name: Name of the application using the Mistral API.
226
226
  tracer: OpenTelemetry tracer for creating spans.
227
227
  pricing_info: Information used for calculating the cost of Mistral usage.
228
- trace_content: Flag indicating whether to trace the actual content.
228
+ capture_message_content: Flag indicating whether to trace the actual content.
229
229
 
230
230
  Returns:
231
231
  A function that wraps the chat method to add telemetry.
@@ -422,7 +422,7 @@ def chat_stream(version, environment, application_name,
422
422
  self._ttft)
423
423
  self._span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
424
424
  version)
425
- if trace_content:
425
+ if capture_message_content:
426
426
  self._span.add_event(
427
427
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
428
428
  attributes={
@@ -485,7 +485,7 @@ def chat_stream(version, environment, application_name,
485
485
  return wrapper
486
486
 
487
487
  def embeddings(version, environment, application_name,
488
- tracer, pricing_info, trace_content, metrics, disable_metrics):
488
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics):
489
489
  """
490
490
  Generates a telemetry wrapper for embeddings to collect metrics.
491
491
 
@@ -495,7 +495,7 @@ def embeddings(version, environment, application_name,
495
495
  application_name: Name of the application using the Mistral API.
496
496
  tracer: OpenTelemetry tracer for creating spans.
497
497
  pricing_info: Information used for calculating the cost of Mistral usage.
498
- trace_content: Flag indicating whether to trace the actual content.
498
+ capture_message_content: Flag indicating whether to trace the actual content.
499
499
 
500
500
  Returns:
501
501
  A function that wraps the embeddings method to add telemetry.
@@ -567,7 +567,7 @@ def embeddings(version, environment, application_name,
567
567
  span.set_attribute(SemanticConvetion.GEN_AI_SDK_VERSION,
568
568
  version)
569
569
 
570
- if trace_content:
570
+ if capture_message_content:
571
571
  span.add_event(
572
572
  name=SemanticConvetion.GEN_AI_CONTENT_PROMPT_EVENT,
573
573
  attributes={
@@ -30,7 +30,7 @@ class MultiOnInstrumentor(BaseInstrumentor):
30
30
  tracer = kwargs.get("tracer")
31
31
  metrics = kwargs.get("metrics_dict")
32
32
  pricing_info = kwargs.get("pricing_info", {})
33
- trace_content = kwargs.get("trace_content", False)
33
+ capture_message_content = kwargs.get("capture_message_content", False)
34
34
  disable_metrics = kwargs.get("disable_metrics")
35
35
  version = importlib.metadata.version("multion")
36
36
 
@@ -39,19 +39,19 @@ class MultiOnInstrumentor(BaseInstrumentor):
39
39
  "multion.client",
40
40
  "MultiOn.browse",
41
41
  multion_wrap("multion.browse", version, environment, application_name,
42
- tracer, pricing_info, trace_content, metrics, disable_metrics),
42
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
43
43
  )
44
44
  wrap_function_wrapper(
45
45
  "multion.client",
46
46
  "MultiOn.retrieve",
47
47
  multion_wrap("multion.retrieve", version, environment, application_name,
48
- tracer, pricing_info, trace_content, metrics, disable_metrics),
48
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
49
49
  )
50
50
  wrap_function_wrapper(
51
51
  "multion.sessions.client",
52
52
  "SessionsClient.create",
53
53
  multion_wrap("multion.sessions.create", version, environment, application_name,
54
- tracer, pricing_info, trace_content, metrics, disable_metrics),
54
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
55
55
  )
56
56
 
57
57
  # Asynchronus
@@ -59,19 +59,19 @@ class MultiOnInstrumentor(BaseInstrumentor):
59
59
  "multion.client",
60
60
  "AsyncMultiOn.browse",
61
61
  async_multion_wrap("multion.browse", version, environment, application_name,
62
- tracer, pricing_info, trace_content, metrics, disable_metrics),
62
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
63
63
  )
64
64
  wrap_function_wrapper(
65
65
  "multion.client",
66
66
  "AsyncMultiOn.retrieve",
67
67
  async_multion_wrap("multion.retrieve", version, environment, application_name,
68
- tracer, pricing_info, trace_content, metrics, disable_metrics),
68
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
69
69
  )
70
70
  wrap_function_wrapper(
71
71
  "multion.sessions.client",
72
72
  "AsyncSessionsClient.create",
73
73
  async_multion_wrap("multion.sessions.create", version, environment, application_name,
74
- tracer, pricing_info, trace_content, metrics, disable_metrics),
74
+ tracer, pricing_info, capture_message_content, metrics, disable_metrics),
75
75
  )
76
76
 
77
77