openlit 1.34.8__py3-none-any.whl → 1.34.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.
@@ -3,14 +3,14 @@ Reka OpenTelemetry instrumentation utility functions
3
3
  """
4
4
  import time
5
5
 
6
- from opentelemetry.sdk.resources import SERVICE_NAME, TELEMETRY_SDK_NAME, DEPLOYMENT_ENVIRONMENT
7
6
  from opentelemetry.trace import Status, StatusCode
8
7
 
9
8
  from openlit.__helpers import (
10
9
  response_as_dict,
11
10
  calculate_tbt,
12
11
  get_chat_model_cost,
13
- create_metrics_attributes,
12
+ common_span_attributes,
13
+ record_completion_metrics,
14
14
  )
15
15
  from openlit.semcov import SemanticConvention
16
16
 
@@ -36,54 +36,6 @@ def format_content(messages):
36
36
 
37
37
  return "\n".join(formatted_messages)
38
38
 
39
- def common_span_attributes(scope, gen_ai_operation, gen_ai_system, server_address, server_port,
40
- request_model, response_model, environment, application_name, is_stream, tbt, ttft, version):
41
- """
42
- Set common span attributes for both chat and RAG operations.
43
- """
44
-
45
- scope._span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
46
- scope._span.set_attribute(SemanticConvention.GEN_AI_OPERATION, gen_ai_operation)
47
- scope._span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, gen_ai_system)
48
- scope._span.set_attribute(SemanticConvention.SERVER_ADDRESS, server_address)
49
- scope._span.set_attribute(SemanticConvention.SERVER_PORT, server_port)
50
- scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL, request_model)
51
- scope._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, response_model)
52
- scope._span.set_attribute(DEPLOYMENT_ENVIRONMENT, environment)
53
- scope._span.set_attribute(SERVICE_NAME, application_name)
54
- scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, is_stream)
55
- scope._span.set_attribute(SemanticConvention.GEN_AI_SERVER_TBT, tbt)
56
- scope._span.set_attribute(SemanticConvention.GEN_AI_SERVER_TTFT, ttft)
57
- scope._span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION, version)
58
-
59
- def record_common_metrics(metrics, gen_ai_operation, gen_ai_system, server_address, server_port,
60
- request_model, response_model, environment, application_name, start_time, end_time,
61
- input_tokens, output_tokens, cost, tbt=None, ttft=None):
62
- """
63
- Record common metrics for the operation.
64
- """
65
-
66
- attributes = create_metrics_attributes(
67
- operation=gen_ai_operation,
68
- system=gen_ai_system,
69
- server_address=server_address,
70
- server_port=server_port,
71
- request_model=request_model,
72
- response_model=response_model,
73
- service_name=application_name,
74
- deployment_environment=environment,
75
- )
76
- metrics["genai_client_operation_duration"].record(end_time - start_time, attributes)
77
- metrics["genai_requests"].add(1, attributes)
78
- metrics["genai_prompt_tokens"].add(input_tokens, attributes)
79
- metrics["genai_completion_tokens"].add(output_tokens, attributes)
80
- metrics["genai_client_usage_tokens"].record(input_tokens + output_tokens, attributes)
81
- metrics["genai_cost"].record(cost, attributes)
82
- if tbt is not None:
83
- metrics["genai_server_tbt"].record(tbt, attributes)
84
- if ttft is not None:
85
- metrics["genai_server_ttft"].record(ttft, attributes)
86
-
87
39
  def common_chat_logic(scope, pricing_info, environment, application_name, metrics,
88
40
  capture_message_content, disable_metrics, version, is_stream):
89
41
  """
@@ -151,7 +103,7 @@ def common_chat_logic(scope, pricing_info, environment, application_name, metric
151
103
 
152
104
  # Metrics
153
105
  if not disable_metrics:
154
- record_common_metrics(metrics, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT, SemanticConvention.GEN_AI_SYSTEM_REKAAI,
106
+ record_completion_metrics(metrics, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT, SemanticConvention.GEN_AI_SYSTEM_REKAAI,
155
107
  scope._server_address, scope._server_port, request_model, scope._response_model, environment,
156
108
  application_name, scope._start_time, scope._end_time, scope._input_tokens, scope._output_tokens,
157
109
  cost, scope._tbt, scope._ttft)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openlit
3
- Version: 1.34.8
3
+ Version: 1.34.11
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
  License: Apache-2.0
6
6
  Keywords: OpenTelemetry,otel,otlp,llm,tracing,openai,anthropic,claude,cohere,llm monitoring,observability,monitoring,gpt,Generative AI,chatGPT,gpu
@@ -1,4 +1,4 @@
1
- openlit/__helpers.py,sha256=sg0EGJGC_OlZePR84cLK77l_lZRBPJwdjWjq_RuaYS0,11444
1
+ openlit/__helpers.py,sha256=gIFD6pDsj_zd4_D936aRptUq-TKUQ-0GgJBf6PoEDlo,14883
2
2
  openlit/__init__.py,sha256=ris6-GY0ePSbK_jvawHTXymGClVF7yeKdIT95IRBl18,24086
3
3
  openlit/evals/__init__.py,sha256=nJe99nuLo1b5rf7pt9U9BCdSDedzbVi2Fj96cgl7msM,380
4
4
  openlit/evals/all.py,sha256=oWrue3PotE-rB5WePG3MRYSA-ro6WivkclSHjYlAqGs,7154
@@ -22,8 +22,9 @@ openlit/instrumentation/anthropic/__init__.py,sha256=QEsiwdxcQDzzlVYR4_x7KTdf0-U
22
22
  openlit/instrumentation/anthropic/anthropic.py,sha256=NxJJjhsu9sSFIlBp322olGkPlLt9Bn5sndaugYA68dE,5149
23
23
  openlit/instrumentation/anthropic/async_anthropic.py,sha256=ivJGygKWVTS2hWWX12_g1tiq-5mpeHXETZsWoFZL3UE,5235
24
24
  openlit/instrumentation/anthropic/utils.py,sha256=g15QqkHdl2N5WsRCNvxWkMwOYpR_n-lrMcvlY71QbSs,11934
25
- openlit/instrumentation/assemblyai/__init__.py,sha256=vW5ifDgwprOSsr2Xa94T8Us0Gm6ynimAPeB3a8VQKZw,1551
26
- openlit/instrumentation/assemblyai/assemblyai.py,sha256=lFM6eZvhV6XkFjyPJypM-RbM3bk6cZr_XpZNBF_MYpE,6419
25
+ openlit/instrumentation/assemblyai/__init__.py,sha256=-pW7c5Vxa493yETQABbebx4be_sTx5VwkvQrIHbhRbI,1404
26
+ openlit/instrumentation/assemblyai/assemblyai.py,sha256=SJZ-O6k8adlRWJ2gMIP62vXobHJ3VI87PQOCFw9Ilng,2071
27
+ openlit/instrumentation/assemblyai/utils.py,sha256=driBfwWBveWTqHyPRtl1R8oEG6m07-GXycyCnDfZ9PM,6089
27
28
  openlit/instrumentation/astra/__init__.py,sha256=-JG3_YHQQaOQUr4XtFzqfaYiQKqviAAmikd3YS9H9XM,8252
28
29
  openlit/instrumentation/astra/astra.py,sha256=L_Yw980eEY0AzMqhNreKamlSplTlL8XiG5lx9Sj3D0c,1610
29
30
  openlit/instrumentation/astra/async_astra.py,sha256=87QFKnEQPHywuqMH0dOlnXZ2GqdYDZQgT4TfXB16fPI,1628
@@ -49,9 +50,10 @@ openlit/instrumentation/crewai/__init__.py,sha256=Yh-evzhxG-x3E2oRf71S1NIx_36JGu
49
50
  openlit/instrumentation/crewai/crewai.py,sha256=0MuubMHnnWeLhc5LnHtr74-hQaq8EAx-pIsocb4IIeE,7223
50
51
  openlit/instrumentation/dynamiq/__init__.py,sha256=LuIYSQpQH5Pk5Ngl_3Jy3bImGjZgh61La6sbVJfC1Io,2391
51
52
  openlit/instrumentation/dynamiq/dynamiq.py,sha256=0x-76VL5KG_HytmzAOi4ERPN0Wm5KLyMxHZmFbaWxxg,5309
52
- openlit/instrumentation/elevenlabs/__init__.py,sha256=LNbHWxnkq3ZPOnXKP01Wo0ger-YwC0G2rNzquivYMGQ,2691
53
- openlit/instrumentation/elevenlabs/async_elevenlabs.py,sha256=oX7A4xJ3FI8hd26r6O-Wojx8S5BUYjuF-wvf-UdjQQ4,6747
54
- openlit/instrumentation/elevenlabs/elevenlabs.py,sha256=GxkMApwSFezmNuH21z4iXo-iPIpKTVFWq_9gj37pvO8,6729
53
+ openlit/instrumentation/elevenlabs/__init__.py,sha256=YDOyrxdY9VACuHY5iZ3v3FaIPcNM7lAmUInJ6H-Cw-g,1897
54
+ openlit/instrumentation/elevenlabs/async_elevenlabs.py,sha256=IjcFay1Cgdrq4IGsE1ZRQemSDBsqAqVYRkzUm8LAaBs,1925
55
+ openlit/instrumentation/elevenlabs/elevenlabs.py,sha256=Y4zik8Ds4rv21258F-VEn8I4v1S39Vb__w8MI0lAzGw,1913
56
+ openlit/instrumentation/elevenlabs/utils.py,sha256=GpphFe5F9h4s8azj155IgywbenNoRYN2DtNyDT7HWKA,5876
55
57
  openlit/instrumentation/embedchain/__init__.py,sha256=x2_qvJTwWog_mH6IY987Bp9mWxHtasqX2nZ3rwA7mb4,1959
56
58
  openlit/instrumentation/embedchain/embedchain.py,sha256=f4hyOr1Xr0RC4PNHRu46aV-jmEh-lIeKN8XLjgY7aWM,7929
57
59
  openlit/instrumentation/firecrawl/__init__.py,sha256=kyVsAiDBC2djifqT2w1cPRAotiEyEabNvnBeSQxi9N8,1876
@@ -62,11 +64,12 @@ openlit/instrumentation/google_ai_studio/google_ai_studio.py,sha256=nanOoXz-1uJt
62
64
  openlit/instrumentation/google_ai_studio/utils.py,sha256=-X5sHk216ajJrl4cP35f5vT8YAZaIE4yLKI7nWEKHkQ,11140
63
65
  openlit/instrumentation/gpt4all/__init__.py,sha256=kXciJbQMZYnTeAYLCjriVYXV7XzUUQrwEZPmyv1WXxI,1627
64
66
  openlit/instrumentation/gpt4all/gpt4all.py,sha256=6VkJbaPIDv5sbFXFiadH4IB0KljljnOZ1HaGAPuyp_E,6704
65
- openlit/instrumentation/gpt4all/utils.py,sha256=VQaQAdAFLQp_5IOC8ioC6GUIpJ-iztJWfTSNRmazxag,12485
67
+ openlit/instrumentation/gpt4all/utils.py,sha256=clyoIy1_ib-1_keQFMvyzTOcbWHeWPRpDhV-w2CtIAU,12470
66
68
  openlit/instrumentation/gpu/__init__.py,sha256=QQCFVEbRfdeTjmdFe-UeEiy19vEEWSIBpj2B1wYGhUs,11036
67
- openlit/instrumentation/groq/__init__.py,sha256=RszPvlPMD1j_uRu9MweyO_F_BRIqEExuB6sVQB2py4o,1901
68
- openlit/instrumentation/groq/async_groq.py,sha256=BDiGSS1C5uradPLDyfPCqyLWw7f5Emwe4KA1Zd7nXU8,24770
69
- openlit/instrumentation/groq/groq.py,sha256=v_-F3yRuaAzAfPx7V-XK8d13omojN5Tu9UbFM-uo4ls,24684
69
+ openlit/instrumentation/groq/__init__.py,sha256=MEcks6t-YqTe4hZXrQ6uGI60vb3OY84d3XjHH_emAyM,1739
70
+ openlit/instrumentation/groq/async_groq.py,sha256=hp3AN8B98cUbX4C0GksTbNb6kpg31FJUlhW32Wo8CnI,5113
71
+ openlit/instrumentation/groq/groq.py,sha256=XfJakQCfEszvVJxzpemYBIVE73b5WVj8bAlDaeVKBMU,4994
72
+ openlit/instrumentation/groq/utils.py,sha256=0ttCMcKmyDrSnmQtM20U5Yo6OllUPW5iBNBE5qW0jGk,9072
70
73
  openlit/instrumentation/haystack/__init__.py,sha256=jZPAXRilKTD1vww_4_K4jhYWNrMXngcs5pI29NTnFvI,1788
71
74
  openlit/instrumentation/haystack/haystack.py,sha256=kPkuCJDrccNgAg3yDAHbvEytzyfMOee_LDBhzrcfpkc,3927
72
75
  openlit/instrumentation/julep/__init__.py,sha256=g-hwXjvXAb5IDs5DR_P8rKsnD4beB9tupAzuuviQT3k,3216
@@ -92,10 +95,10 @@ openlit/instrumentation/mistral/mistral.py,sha256=_2qM8v4RCL-S0Mm1vbW77m5vUm8aPD
92
95
  openlit/instrumentation/multion/__init__.py,sha256=Wr3lcDyG_YbOLkCUzBFhraAedF6E113tce8eSWlcz10,3149
93
96
  openlit/instrumentation/multion/async_multion.py,sha256=XutZnayCJOZ_NA9bvE1NUoej41KOGR7FRn2tpoGKMEU,6092
94
97
  openlit/instrumentation/multion/multion.py,sha256=-WqRAcu5qiEMY9XDmlJTQHuQiWfdwms9JDn127QCNb8,6074
95
- openlit/instrumentation/ollama/__init__.py,sha256=v7VhVxHw_c6QtMznxe6a7z6QrYHZsH_NSXfiXao83Ns,3707
96
- openlit/instrumentation/ollama/async_ollama.py,sha256=zJPDr2ROh1nvFGoxgdTbe04Zr1KhmgJUYFPeuRLQGLk,6667
97
- openlit/instrumentation/ollama/ollama.py,sha256=MNUltiP9XVT4azmO_-E2vjhFaoHQyJ0Z6c-HnB0_jCE,6563
98
- openlit/instrumentation/ollama/utils.py,sha256=41uvYaYkGwWfRyHYqhOOwrFy6cMzBlG1urJYUat9Q24,14819
98
+ openlit/instrumentation/ollama/__init__.py,sha256=WxjqjuR8ovMU5dR08OELNqClbuM7ns4hDRiwWg9NXJk,3587
99
+ openlit/instrumentation/ollama/async_ollama.py,sha256=ORXwem8lgSrhOcci55NkChIK9SNc3IYIpLjF_ogsGA8,6666
100
+ openlit/instrumentation/ollama/ollama.py,sha256=8mvrWfU1c5h1L7lxWo47YBJ7g2u7QZmSZuuP0URtTDo,6538
101
+ openlit/instrumentation/ollama/utils.py,sha256=TIE3_ur2U-iyCclna7TzwjDIFC9PZjRnZqNDV6NfG-0,11958
99
102
  openlit/instrumentation/openai/__init__.py,sha256=y9Ox5aYWTb2nAa_d0ic3Mkv4wEKmUGqslW9nHKg6NnY,6320
100
103
  openlit/instrumentation/openai/async_openai.py,sha256=JyA8MDxWCM38Te6mJzBdfonRgIIlo2ziLn7HOmzqxxo,81398
101
104
  openlit/instrumentation/openai/openai.py,sha256=5fgRyK5dUN2zUdrN0vBSZFnSEAXf2dKS0qnq_85-mQE,81175
@@ -107,7 +110,7 @@ openlit/instrumentation/pinecone/__init__.py,sha256=0guSEPmObaZiOF8yHExpOGY-qW_e
107
110
  openlit/instrumentation/pinecone/pinecone.py,sha256=7hVUlC0HOj0yQyvLasfdb6kS46hRJQdoSRzZQ4ixIkk,8850
108
111
  openlit/instrumentation/premai/__init__.py,sha256=3YlqyV-eNA_4aVUHDVUQUvGJRW8iVVcRtREw91yhbyw,1728
109
112
  openlit/instrumentation/premai/premai.py,sha256=rWRqfoIZUbTz-M7zgC2Z92gTVv9fCj1Z4iJcsG86YeI,6438
110
- openlit/instrumentation/premai/utils.py,sha256=v2DWazztCuwDMFW1IaWbWlyPLsBq9_2vTyU8zIle-ns,14942
113
+ openlit/instrumentation/premai/utils.py,sha256=K7EKGRDDh1X3OznG4z8H506zzFOHN6MH3oqtxM5eUyM,11409
111
114
  openlit/instrumentation/pydantic_ai/__init__.py,sha256=mq52QanFI4xDx6JK-qW5yzhFPXwznJqIYsuxRoBA2Xg,2023
112
115
  openlit/instrumentation/pydantic_ai/pydantic_ai.py,sha256=2F2hrowGqcPjTDLG9IeLY8OO-lXZKhLSU93XtZ3tt5A,1868
113
116
  openlit/instrumentation/pydantic_ai/utils.py,sha256=b0TqhSDnRqkPdM_qsOgMuXT3lwTvHzMYpaBv2qibiVo,4307
@@ -117,7 +120,7 @@ openlit/instrumentation/qdrant/qdrant.py,sha256=pafjlAzMPzYLRYFfTtWXsLKYVQls-grk
117
120
  openlit/instrumentation/reka/__init__.py,sha256=wI5KUYyTAD8ni4E98uziy9WPqoQqlzybDXanFOqDan0,1720
118
121
  openlit/instrumentation/reka/async_reka.py,sha256=CZk5rr7njThDkmrauRAJmNtMBgsLarTbQ54raPQb92A,1909
119
122
  openlit/instrumentation/reka/reka.py,sha256=wou7vVdN_1Y5UZd4tpkLpTPAtgmAl6gmh_onLn4k4GE,1908
120
- openlit/instrumentation/reka/utils.py,sha256=SmwP52XBcDkgLJrozHvNSqJQMSX_vQcmjpidavjNyq0,9211
123
+ openlit/instrumentation/reka/utils.py,sha256=qt1ZIsWkuFGX6iPMiUJ993dh1njvc81QJECD3BnSOpE,6632
121
124
  openlit/instrumentation/together/__init__.py,sha256=0UmUqQtppyK3oopb4lTjX2LITgVCR8VtH46IAV1rpA8,2484
122
125
  openlit/instrumentation/together/async_together.py,sha256=0-h5fKw6rIwN_fvWVpGuvVqizIuM9xFCzz8Z4oGgOj0,6822
123
126
  openlit/instrumentation/together/together.py,sha256=nY6mzHmHgoMbbnB_9eL0EBQjP0ltJVdkQj4pbamHAj0,6723
@@ -135,7 +138,7 @@ openlit/otel/events.py,sha256=VrMjTpvnLtYRBHCiFwJojTQqqNpRCxoD4yJYeQrtPsk,3560
135
138
  openlit/otel/metrics.py,sha256=GM2PDloBGRhBTkHHkYaqmOwIAQkY124ZhW4sEqW1Fgk,7086
136
139
  openlit/otel/tracing.py,sha256=tjV2bEbEDPUB1Z46gE-UsJsb04sRdFrfbhIDkxViZc0,3103
137
140
  openlit/semcov/__init__.py,sha256=ptyo37PY-FHDx_PShEvbdns71cD4YvvXw15bCRXKCKM,13461
138
- openlit-1.34.8.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
139
- openlit-1.34.8.dist-info/METADATA,sha256=eAza_iFpQukjA6yYb6qqkLQ9aTms9b7jFjx_5r6sz3U,23469
140
- openlit-1.34.8.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
141
- openlit-1.34.8.dist-info/RECORD,,
141
+ openlit-1.34.11.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
142
+ openlit-1.34.11.dist-info/METADATA,sha256=uupRffQvhiozgD4kGsKu_uQ3Sc7hrYyfX32l3EmiKSk,23470
143
+ openlit-1.34.11.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
144
+ openlit-1.34.11.dist-info/RECORD,,