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

@@ -5,8 +5,6 @@ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
5
5
 
6
6
  from opentelemetry.instrumentation.openai.shared.config import Config
7
7
  from opentelemetry.instrumentation.openai.utils import is_openai_v1
8
- from opentelemetry.instrumentation.openai.v0 import OpenAIV0Instrumentor
9
- from opentelemetry.instrumentation.openai.v1 import OpenAIV1Instrumentor
10
8
 
11
9
  _instruments = ("openai >= 0.27.0",)
12
10
 
@@ -38,12 +36,20 @@ class OpenAIInstrumentor(BaseInstrumentor):
38
36
 
39
37
  def _instrument(self, **kwargs):
40
38
  if is_openai_v1():
39
+ from opentelemetry.instrumentation.openai.v1 import OpenAIV1Instrumentor
40
+
41
41
  OpenAIV1Instrumentor().instrument(**kwargs)
42
42
  else:
43
+ from opentelemetry.instrumentation.openai.v0 import OpenAIV0Instrumentor
44
+
43
45
  OpenAIV0Instrumentor().instrument(**kwargs)
44
46
 
45
47
  def _uninstrument(self, **kwargs):
46
48
  if is_openai_v1():
49
+ from opentelemetry.instrumentation.openai.v1 import OpenAIV1Instrumentor
50
+
47
51
  OpenAIV1Instrumentor().uninstrument(**kwargs)
48
52
  else:
53
+ from opentelemetry.instrumentation.openai.v0 import OpenAIV0Instrumentor
54
+
49
55
  OpenAIV0Instrumentor().uninstrument(**kwargs)
@@ -11,7 +11,9 @@ from opentelemetry.trace.propagation import set_span_in_context
11
11
  from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator
12
12
 
13
13
  from opentelemetry.instrumentation.openai.shared.config import Config
14
- from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import GEN_AI_RESPONSE_ID
14
+ from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import (
15
+ GEN_AI_RESPONSE_ID,
16
+ )
15
17
  from opentelemetry.semconv_ai import SpanAttributes
16
18
  from opentelemetry.instrumentation.openai.utils import (
17
19
  dont_throw,
@@ -38,8 +40,13 @@ def should_send_prompts():
38
40
 
39
41
 
40
42
  def _set_span_attribute(span, name, value):
41
- if value is not None and value != "" and value != openai.NOT_GIVEN:
42
- span.set_attribute(name, value)
43
+ if value is None or value == "":
44
+ return
45
+
46
+ if hasattr(openai, "NOT_GIVEN") and value == openai.NOT_GIVEN:
47
+ return
48
+
49
+ span.set_attribute(name, value)
43
50
 
44
51
 
45
52
  def _set_client_attributes(span, instance):
@@ -1 +1 @@
1
- __version__ = "0.38.0"
1
+ __version__ = "0.38.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: opentelemetry-instrumentation-openai
3
- Version: 0.38.0
3
+ Version: 0.38.2
4
4
  Summary: OpenTelemetry OpenAI instrumentation
5
5
  License: Apache-2.0
6
6
  Author: Gal Kleinman
@@ -1,5 +1,5 @@
1
- opentelemetry/instrumentation/openai/__init__.py,sha256=ly0ZPoOTAVRo1f0EeKfyTWj8_HLna3kZfIo9GWgUJk4,1888
2
- opentelemetry/instrumentation/openai/shared/__init__.py,sha256=Ha5oEgK0VrdTu10wdxs-Dqwcv2fbqw1mqlXlsngH7kg,9493
1
+ opentelemetry/instrumentation/openai/__init__.py,sha256=g_RyqxN0DEaPegyaFfoZVskxnaPMGx6Yrc9wZvkx7r8,2086
2
+ opentelemetry/instrumentation/openai/shared/__init__.py,sha256=AyUsCiNvqx5L6z8Vkn0xx07cASA-L9GYbvMzG9JaPfc,9562
3
3
  opentelemetry/instrumentation/openai/shared/chat_wrappers.py,sha256=YYEYBSyqcOSlb5VNORs3LL-J749sk9ZZbOpCn8JikIU,28306
4
4
  opentelemetry/instrumentation/openai/shared/completion_wrappers.py,sha256=de35aM1Bjsk3GsfNAdu009OF_mdeFB7H_jBsc4LOKY0,7101
5
5
  opentelemetry/instrumentation/openai/shared/config.py,sha256=dCQviJ1a5cpFlrP0HcKgE7lpiXB98ssnumLy_CIMibQ,355
@@ -10,8 +10,8 @@ opentelemetry/instrumentation/openai/v0/__init__.py,sha256=02-bXv0aZbscMYO2W3jsH
10
10
  opentelemetry/instrumentation/openai/v1/__init__.py,sha256=B2Ut0X14KQS5in_0jLBMCvXQK73SqBy2rBFIDk5ZRkc,8688
11
11
  opentelemetry/instrumentation/openai/v1/assistant_wrappers.py,sha256=08ZB03chvpzF-v2dtpHKCToJmm5ztYSwKhBq3pbpPlI,7191
12
12
  opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py,sha256=4HsnPwR450NA5w-KDgMfQjK8U4do_M-sMMPU4LjXyiQ,3444
13
- opentelemetry/instrumentation/openai/version.py,sha256=GJwyrcH1eJOX_p_9H-LSIMO2ADxtxl7estBuQ7PgzCM,23
14
- opentelemetry_instrumentation_openai-0.38.0.dist-info/METADATA,sha256=qEvV3MsmEgcjTd9F4I4bk0dNRLrgYkeACMdUTxq9NBY,2186
15
- opentelemetry_instrumentation_openai-0.38.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
16
- opentelemetry_instrumentation_openai-0.38.0.dist-info/entry_points.txt,sha256=vTBfiX5yXji5YHikuJHEOoBZ1TFdPQ1EI4ctd2pZSeE,93
17
- opentelemetry_instrumentation_openai-0.38.0.dist-info/RECORD,,
13
+ opentelemetry/instrumentation/openai/version.py,sha256=Vx3X3hEReOZPCKiGkar2nBiTrf3fCoaKKNz1t5h9gdY,23
14
+ opentelemetry_instrumentation_openai-0.38.2.dist-info/METADATA,sha256=awGbBda7ElRB8MJIAUCSR02TtQB54CFqc_5L9lZNeQg,2186
15
+ opentelemetry_instrumentation_openai-0.38.2.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
16
+ opentelemetry_instrumentation_openai-0.38.2.dist-info/entry_points.txt,sha256=vTBfiX5yXji5YHikuJHEOoBZ1TFdPQ1EI4ctd2pZSeE,93
17
+ opentelemetry_instrumentation_openai-0.38.2.dist-info/RECORD,,