opentelemetry-instrumentation-openai 0.32.2__py3-none-any.whl → 0.33.1__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.

Potentially problematic release.


This version of opentelemetry-instrumentation-openai might be problematic. Click here for more details.

@@ -432,7 +432,11 @@ def _set_completions(span, choices):
432
432
  return
433
433
 
434
434
  _set_span_attribute(span, f"{prefix}.role", message.get("role"))
435
- _set_span_attribute(span, f"{prefix}.content", message.get("content"))
435
+
436
+ if message.get("refusal"):
437
+ _set_span_attribute(span, f"{prefix}.refusal", message.get("refusal"))
438
+ else:
439
+ _set_span_attribute(span, f"{prefix}.content", message.get("content"))
436
440
 
437
441
  function_call = message.get("function_call")
438
442
  if function_call:
@@ -197,6 +197,32 @@ class OpenAIV1Instrumentor(BaseInstrumentor):
197
197
  "Assistants.create",
198
198
  assistants_create_wrapper(tracer),
199
199
  )
200
+ wrap_function_wrapper(
201
+ "openai.resources.beta.chat.completions",
202
+ "Completions.parse",
203
+ chat_wrapper(
204
+ tracer,
205
+ tokens_histogram,
206
+ chat_choice_counter,
207
+ duration_histogram,
208
+ chat_exception_counter,
209
+ streaming_time_to_first_token,
210
+ streaming_time_to_generate,
211
+ ),
212
+ )
213
+ wrap_function_wrapper(
214
+ "openai.resources.beta.chat.completions",
215
+ "AsyncCompletions.parse",
216
+ achat_wrapper(
217
+ tracer,
218
+ tokens_histogram,
219
+ chat_choice_counter,
220
+ duration_histogram,
221
+ chat_exception_counter,
222
+ streaming_time_to_first_token,
223
+ streaming_time_to_generate,
224
+ ),
225
+ )
200
226
  wrap_function_wrapper(
201
227
  "openai.resources.beta.threads.runs",
202
228
  "Runs.create",
@@ -217,7 +243,7 @@ class OpenAIV1Instrumentor(BaseInstrumentor):
217
243
  "Messages.list",
218
244
  messages_list_wrapper(tracer),
219
245
  )
220
- except AttributeError:
246
+ except (AttributeError, ModuleNotFoundError):
221
247
  pass
222
248
 
223
249
  def _uninstrument(self, **kwargs):
@@ -1 +1 @@
1
- __version__ = "0.32.2"
1
+ __version__ = "0.33.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: opentelemetry-instrumentation-openai
3
- Version: 0.32.2
3
+ Version: 0.33.1
4
4
  Summary: OpenTelemetry OpenAI instrumentation
5
5
  Home-page: https://github.com/traceloop/openllmetry/tree/main/packages/opentelemetry-instrumentation-openai
6
6
  License: Apache-2.0
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
16
17
  Provides-Extra: instruments
17
18
  Requires-Dist: opentelemetry-api (>=1.27.0,<2.0.0)
18
19
  Requires-Dist: opentelemetry-instrumentation (>=0.48b0,<0.49)
@@ -1,17 +1,17 @@
1
1
  opentelemetry/instrumentation/openai/__init__.py,sha256=ZNytfy9PeGr-O4qkyCQLtANukfPlnOEynsXJ_5L75oU,1750
2
2
  opentelemetry/instrumentation/openai/shared/__init__.py,sha256=HcS1Ar6WX9DPtlJuiPji3u7XV_SwYerTf5O32Kfe1FQ,8839
3
- opentelemetry/instrumentation/openai/shared/chat_wrappers.py,sha256=YS1MLJEKmp_PFTl0cGBiX8dHBDrSdVZl6cN3VRvdA8E,27971
3
+ opentelemetry/instrumentation/openai/shared/chat_wrappers.py,sha256=35OPrU-2SOwyesfPtD2urK_Fqn4A5vH6zAMG4yo3bms,28108
4
4
  opentelemetry/instrumentation/openai/shared/completion_wrappers.py,sha256=CZngvHkGtLUh-Ne4uzM6VH8LiajZsKVOV1glhmSwij0,6843
5
5
  opentelemetry/instrumentation/openai/shared/config.py,sha256=86mItW37lxSAyD8LAx4RbYWTR_-XKLeGxQgMozD5eNY,305
6
6
  opentelemetry/instrumentation/openai/shared/embeddings_wrappers.py,sha256=YI0lFGulaE8N2F1hdTGHj52kHwUy6KQPIt7Lw9AWJHc,7069
7
7
  opentelemetry/instrumentation/openai/shared/image_gen_wrappers.py,sha256=A4qdJIeJdA45SfiLaFj3Vo0Ndcqqfuew1BDsGdnJU3E,2122
8
8
  opentelemetry/instrumentation/openai/utils.py,sha256=3ONjsia3xG4rRMOwjU91liOVpZxoRE39CxJ-C5HxIgQ,3464
9
9
  opentelemetry/instrumentation/openai/v0/__init__.py,sha256=02-bXv0aZbscMYO2W3jsHpjU521vkVK5RzdfSeGXBzg,5475
10
- opentelemetry/instrumentation/openai/v1/__init__.py,sha256=kqGsXkjyjIDNRfTSzJKjLdvvGUOViW2shZ73cM4PfS0,7693
10
+ opentelemetry/instrumentation/openai/v1/__init__.py,sha256=B2Ut0X14KQS5in_0jLBMCvXQK73SqBy2rBFIDk5ZRkc,8688
11
11
  opentelemetry/instrumentation/openai/v1/assistant_wrappers.py,sha256=BMiZykQ3u2xrWpo2g3qZOxTJqy317JXRGO4zCVu4bZ8,6277
12
12
  opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py,sha256=kXOuDAt7If23EhWpH2r6L0eUVFvVWQBYrWGu3qJNKR0,2779
13
- opentelemetry/instrumentation/openai/version.py,sha256=BTUzInDvYYVtu1urjegIX3l01RgGLU90i6JgObyPwDA,23
14
- opentelemetry_instrumentation_openai-0.32.2.dist-info/METADATA,sha256=n0FZfb0b85dWFHCuGIUJs3ItV5DnGXEEqYxEfJ2kD78,2255
15
- opentelemetry_instrumentation_openai-0.32.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
16
- opentelemetry_instrumentation_openai-0.32.2.dist-info/entry_points.txt,sha256=vTBfiX5yXji5YHikuJHEOoBZ1TFdPQ1EI4ctd2pZSeE,93
17
- opentelemetry_instrumentation_openai-0.32.2.dist-info/RECORD,,
13
+ opentelemetry/instrumentation/openai/version.py,sha256=NGQajgIUpsHZBmlrDBG3bxWb5zT8ur6HMm3aE6rnc7M,23
14
+ opentelemetry_instrumentation_openai-0.33.1.dist-info/METADATA,sha256=1E6KzxRS3kQW743kh-H3tpTF0cepZBGQUNhV_UrLHoc,2306
15
+ opentelemetry_instrumentation_openai-0.33.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
16
+ opentelemetry_instrumentation_openai-0.33.1.dist-info/entry_points.txt,sha256=vTBfiX5yXji5YHikuJHEOoBZ1TFdPQ1EI4ctd2pZSeE,93
17
+ opentelemetry_instrumentation_openai-0.33.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 1.9.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any