openlit 1.20.0__py3-none-any.whl → 1.21.0__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,6 +1,6 @@
1
1
  # pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, possibly-used-before-assignment, protected-access
2
2
  """
3
- Module for monitoring Ollama API calls.
3
+ Module for monitoring Google AI Studio API calls.
4
4
  """
5
5
 
6
6
  import logging
@@ -24,9 +24,9 @@ def async_generate(gen_ai_endpoint, version, environment, application_name,
24
24
  gen_ai_endpoint: Endpoint identifier for logging and tracing.
25
25
  version: Version of the monitoring package.
26
26
  environment: Deployment environment (e.g., production, staging).
27
- application_name: Name of the application using the Ollama API.
27
+ application_name: Name of the application using the Google AI Studio API.
28
28
  tracer: OpenTelemetry tracer for creating spans.
29
- pricing_info: Information used for calculating the cost of Ollama usage.
29
+ pricing_info: Information used for calculating the cost of Google AI Studio usage.
30
30
  trace_content: Flag indicating whether to trace the actual content.
31
31
 
32
32
  Returns:
@@ -81,10 +81,12 @@ def async_generate(gen_ai_endpoint, version, environment, application_name,
81
81
  model = instance._model_id
82
82
  if hasattr(instance, "_model_name"):
83
83
  model = instance._model_name.replace("publishers/google/models/", "")
84
+ if model.startswith("models/"):
85
+ model = model[len("models/"):]
84
86
 
85
87
  total_tokens = input_tokens + output_tokens
86
88
  # Calculate cost of the operation
87
- cost = get_chat_model_cost(kwargs.get("model", "gpt-3.5-turbo"),
89
+ cost = get_chat_model_cost(model,
88
90
  pricing_info, input_tokens,
89
91
  output_tokens)
90
92
 
@@ -174,6 +176,8 @@ def async_generate(gen_ai_endpoint, version, environment, application_name,
174
176
  model = instance._model_id
175
177
  if hasattr(instance, "_model_name"):
176
178
  model = instance._model_name.replace("publishers/google/models/", "")
179
+ if model.startswith("models/"):
180
+ model = model[len("models/"):]
177
181
 
178
182
  # Set base span attribues
179
183
  span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
@@ -210,7 +214,7 @@ def async_generate(gen_ai_endpoint, version, environment, application_name,
210
214
  completion_tokens = response.usage_metadata.candidates_token_count
211
215
  total_tokens = response.usage_metadata.total_token_count
212
216
  # Calculate cost of the operation
213
- cost = get_chat_model_cost(kwargs.get("model", "llama3"),
217
+ cost = get_chat_model_cost(model,
214
218
  pricing_info, prompt_tokens, completion_tokens)
215
219
 
216
220
  span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
@@ -231,13 +235,13 @@ def async_generate(gen_ai_endpoint, version, environment, application_name,
231
235
  SemanticConvetion.GEN_AI_APPLICATION_NAME:
232
236
  application_name,
233
237
  SemanticConvetion.GEN_AI_SYSTEM:
234
- SemanticConvetion.GEN_AI_SYSTEM_OLLAMA,
238
+ SemanticConvetion.GEN_AI_SYSTEM_GOOGLE_AI_STUDIO,
235
239
  SemanticConvetion.GEN_AI_ENVIRONMENT:
236
240
  environment,
237
241
  SemanticConvetion.GEN_AI_TYPE:
238
242
  SemanticConvetion.GEN_AI_TYPE_CHAT,
239
243
  SemanticConvetion.GEN_AI_REQUEST_MODEL:
240
- kwargs.get("model", "llama3")
244
+ model
241
245
  }
242
246
 
243
247
  metrics["genai_requests"].add(1, attributes)
@@ -1,6 +1,6 @@
1
1
  # pylint: disable=duplicate-code, broad-exception-caught, too-many-statements, unused-argument, possibly-used-before-assignment, protected-access
2
2
  """
3
- Module for monitoring Ollama API calls.
3
+ Module for monitoring Google AI Studio API calls.
4
4
  """
5
5
 
6
6
  import logging
@@ -24,9 +24,9 @@ def generate(gen_ai_endpoint, version, environment, application_name,
24
24
  gen_ai_endpoint: Endpoint identifier for logging and tracing.
25
25
  version: Version of the monitoring package.
26
26
  environment: Deployment environment (e.g., production, staging).
27
- application_name: Name of the application using the Ollama API.
27
+ application_name: Name of the application using the Google AI Studio API.
28
28
  tracer: OpenTelemetry tracer for creating spans.
29
- pricing_info: Information used for calculating the cost of Ollama usage.
29
+ pricing_info: Information used for calculating the cost of Google AI Studio usage.
30
30
  trace_content: Flag indicating whether to trace the actual content.
31
31
 
32
32
  Returns:
@@ -81,10 +81,12 @@ def generate(gen_ai_endpoint, version, environment, application_name,
81
81
  model = instance._model_id
82
82
  if hasattr(instance, "_model_name"):
83
83
  model = instance._model_name.replace("publishers/google/models/", "")
84
+ if model.startswith("models/"):
85
+ model = model[len("models/"):]
84
86
 
85
87
  total_tokens = input_tokens + output_tokens
86
88
  # Calculate cost of the operation
87
- cost = get_chat_model_cost(kwargs.get("model", "gpt-3.5-turbo"),
89
+ cost = get_chat_model_cost(model,
88
90
  pricing_info, input_tokens,
89
91
  output_tokens)
90
92
 
@@ -176,6 +178,8 @@ def generate(gen_ai_endpoint, version, environment, application_name,
176
178
  model = instance._model_id
177
179
  if hasattr(instance, "_model_name"):
178
180
  model = instance._model_name.replace("publishers/google/models/", "")
181
+ if model.startswith("models/"):
182
+ model = model[len("models/"):]
179
183
 
180
184
  # Set base span attribues
181
185
  span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
@@ -212,7 +216,7 @@ def generate(gen_ai_endpoint, version, environment, application_name,
212
216
  completion_tokens = response.usage_metadata.candidates_token_count
213
217
  total_tokens = response.usage_metadata.total_token_count
214
218
  # Calculate cost of the operation
215
- cost = get_chat_model_cost(kwargs.get("model", "llama3"),
219
+ cost = get_chat_model_cost(model,
216
220
  pricing_info, prompt_tokens, completion_tokens)
217
221
 
218
222
  span.set_attribute(SemanticConvetion.GEN_AI_USAGE_PROMPT_TOKENS,
@@ -233,13 +237,13 @@ def generate(gen_ai_endpoint, version, environment, application_name,
233
237
  SemanticConvetion.GEN_AI_APPLICATION_NAME:
234
238
  application_name,
235
239
  SemanticConvetion.GEN_AI_SYSTEM:
236
- SemanticConvetion.GEN_AI_SYSTEM_OLLAMA,
240
+ SemanticConvetion.GEN_AI_SYSTEM_GOOGLE_AI_STUDIO,
237
241
  SemanticConvetion.GEN_AI_ENVIRONMENT:
238
242
  environment,
239
243
  SemanticConvetion.GEN_AI_TYPE:
240
244
  SemanticConvetion.GEN_AI_TYPE_CHAT,
241
245
  SemanticConvetion.GEN_AI_REQUEST_MODEL:
242
- kwargs.get("model", "llama3")
246
+ model
243
247
  }
244
248
 
245
249
  metrics["genai_requests"].add(1, attributes)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openlit
3
- Version: 1.20.0
3
+ Version: 1.21.0
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,8 +15,8 @@ openlit/instrumentation/elevenlabs/elevenlabs.py,sha256=mFnD7sgT47OxaXJz0Vc1nrNj
15
15
  openlit/instrumentation/embedchain/__init__.py,sha256=8TYk1OEbz46yF19dr-gB_x80VZMagU3kJ8-QihPXTeA,1929
16
16
  openlit/instrumentation/embedchain/embedchain.py,sha256=SLlr7qieT3kp4M6OYSRy8FaVCXQ2t3oPyIiE99ioNE4,7892
17
17
  openlit/instrumentation/google_ai_studio/__init__.py,sha256=vG4WzaavOiiwI3r5stDMotM5TSBxdcxQhC3W4XjJIG8,2146
18
- openlit/instrumentation/google_ai_studio/async_google_ai_studio.py,sha256=cEy5FNu92gvdmsKKVDrUcY5LpY4hHzWwJl9yezxN-Zo,13404
19
- openlit/instrumentation/google_ai_studio/google_ai_studio.py,sha256=mLABvD756GEgVfAjiYsfLYWATT1AxPuWDuElwpX4voo,13453
18
+ openlit/instrumentation/google_ai_studio/async_google_ai_studio.py,sha256=20MHsp-tAONxOtmCFg5WDvktTdRce5CyH3_9w0b_AqI,13587
19
+ openlit/instrumentation/google_ai_studio/google_ai_studio.py,sha256=vIJjzl5Fkgsf3vfaqmxhtSFvOpXK-wGC-JFhEXGP50M,13636
20
20
  openlit/instrumentation/gpt4all/__init__.py,sha256=-59CP2B3-HGZJ_vC-fI9Dt-0BuQXRhSCWCjnaGeU15Q,1802
21
21
  openlit/instrumentation/gpt4all/gpt4all.py,sha256=dbxqZeuTrv_y6wyDOIEmC8-Dc4iCGgLpj3l5JiodLMI,18787
22
22
  openlit/instrumentation/gpu/__init__.py,sha256=Dj2MLar0DB20-t6W3pfR-3jfR_mwg4SYwhzIrH_n9sU,5596
@@ -56,7 +56,7 @@ openlit/instrumentation/vllm/vllm.py,sha256=lDzM7F5pgxvh8nKL0dcKB4TD0Mc9wXOWeXOs
56
56
  openlit/otel/metrics.py,sha256=O7NoaDz0bY19mqpE4-0PcKwEe-B-iJFRgOCaanAuZAc,4291
57
57
  openlit/otel/tracing.py,sha256=vL1ifMbARPBpqK--yXYsCM6y5dSu5LFIKqkhZXtYmUc,3712
58
58
  openlit/semcov/__init__.py,sha256=56daxsJtWFqp87TTT3R5OxSeMH7eOZqb4k-7AELirTI,7554
59
- openlit-1.20.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
60
- openlit-1.20.0.dist-info/METADATA,sha256=DvK9Dt8ZvBBvdPc_Fdbi7HxkCu9Kp-Z4IkzCOuynkg4,14934
61
- openlit-1.20.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
62
- openlit-1.20.0.dist-info/RECORD,,
59
+ openlit-1.21.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
60
+ openlit-1.21.0.dist-info/METADATA,sha256=1zrrmnjPv-UMLhm5DARcS9FylVEbOSUjvJpj1flSDAc,14934
61
+ openlit-1.21.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
62
+ openlit-1.21.0.dist-info/RECORD,,