openlit 1.34.4__py3-none-any.whl → 1.34.7__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,4 +1,3 @@
1
- # pylint: disable=useless-return, bad-staticmethod-argument, disable=duplicate-code
2
1
  """Initializer of Auto Instrumentation of Google AI Studio Functions"""
3
2
 
4
3
  from typing import Collection
@@ -25,8 +24,8 @@ class GoogleAIStudioInstrumentor(BaseInstrumentor):
25
24
  return _instruments
26
25
 
27
26
  def _instrument(self, **kwargs):
28
- application_name = kwargs.get("application_name", "default_application")
29
- environment = kwargs.get("environment", "default_environment")
27
+ application_name = kwargs.get("application_name", "default")
28
+ environment = kwargs.get("environment", "default")
30
29
  tracer = kwargs.get("tracer")
31
30
  metrics = kwargs.get("metrics_dict")
32
31
  pricing_info = kwargs.get("pricing_info", {})
@@ -67,5 +66,4 @@ class GoogleAIStudioInstrumentor(BaseInstrumentor):
67
66
  )
68
67
 
69
68
  def _uninstrument(self, **kwargs):
70
- # Proper uninstrumentation logic to revert patched methods
71
69
  pass
@@ -2,7 +2,6 @@
2
2
  Module for monitoring Google AI Studio API calls.
3
3
  """
4
4
 
5
- import logging
6
5
  import time
7
6
  from opentelemetry.trace import SpanKind
8
7
  from openlit.__helpers import (
@@ -16,9 +15,6 @@ from openlit.instrumentation.google_ai_studio.utils import (
16
15
  )
17
16
  from openlit.semcov import SemanticConvention
18
17
 
19
- # Initialize logger for logging potential issues and operations
20
- logger = logging.getLogger(__name__)
21
-
22
18
  def async_generate(version, environment, application_name,
23
19
  tracer, pricing_info, capture_message_content, metrics, disable_metrics):
24
20
  """
@@ -61,7 +57,6 @@ def async_generate(version, environment, application_name,
61
57
 
62
58
  except Exception as e:
63
59
  handle_exception(span, e)
64
- logger.error("Error in trace creation: %s", e)
65
60
 
66
61
  # Return original response
67
62
  return response
@@ -144,7 +139,6 @@ def async_generate_stream(version, environment, application_name,
144
139
 
145
140
  except Exception as e:
146
141
  handle_exception(self._span, e)
147
- logger.error("Error in trace creation: %s", e)
148
142
  raise
149
143
 
150
144
  async def wrapper(wrapped, instance, args, kwargs):
@@ -2,7 +2,6 @@
2
2
  Module for monitoring Google AI Studio API calls.
3
3
  """
4
4
 
5
- import logging
6
5
  import time
7
6
  from opentelemetry.trace import SpanKind
8
7
  from openlit.__helpers import (
@@ -16,9 +15,6 @@ from openlit.instrumentation.google_ai_studio.utils import (
16
15
  )
17
16
  from openlit.semcov import SemanticConvention
18
17
 
19
- # Initialize logger for logging potential issues and operations
20
- logger = logging.getLogger(__name__)
21
-
22
18
  def generate(version, environment, application_name,
23
19
  tracer, pricing_info, capture_message_content, metrics, disable_metrics):
24
20
  """
@@ -61,7 +57,6 @@ def generate(version, environment, application_name,
61
57
 
62
58
  except Exception as e:
63
59
  handle_exception(span, e)
64
- logger.error("Error in trace creation: %s", e)
65
60
 
66
61
  # Return original response
67
62
  return response
@@ -144,7 +139,6 @@ def generate_stream(version, environment, application_name,
144
139
 
145
140
  except Exception as e:
146
141
  handle_exception(self._span, e)
147
- logger.error("Error in trace creation: %s", e)
148
142
  raise
149
143
 
150
144
  def wrapper(wrapped, instance, args, kwargs):
@@ -15,8 +15,7 @@ from openlit.semcov import SemanticConvention
15
15
 
16
16
  def format_content(messages):
17
17
  """
18
- Process a list of messages to extract content, categorize them by role,
19
- and concatenate all 'content' fields into a single string with role: content format.
18
+ Process a list of messages to extract content.
20
19
  """
21
20
 
22
21
  formatted_messages = []
@@ -733,7 +733,7 @@ def async_chat_completions(version, environment, application_name,
733
733
  formatted_messages = []
734
734
  for message in message_prompt:
735
735
  role = message["role"]
736
- content = message["content"]
736
+ content = message.get("content", "")
737
737
 
738
738
  if isinstance(content, list):
739
739
  content_str = ", ".join(
@@ -1,4 +1,3 @@
1
- # pylint: disable=useless-return, bad-staticmethod-argument, disable=duplicate-code
2
1
  """Initializer of Auto Instrumentation of Prem AI Functions"""
3
2
 
4
3
  from typing import Collection