opentelemetry-instrumentation-openai 0.38.12__tar.gz → 0.39.0__tar.gz
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.
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/PKG-INFO +1 -1
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/opentelemetry/instrumentation/openai/v1/assistant_wrappers.py +22 -14
- opentelemetry_instrumentation_openai-0.39.0/opentelemetry/instrumentation/openai/version.py +1 -0
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/pyproject.toml +1 -1
- opentelemetry_instrumentation_openai-0.38.12/opentelemetry/instrumentation/openai/version.py +0 -1
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/README.md +0 -0
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/opentelemetry/instrumentation/openai/__init__.py +0 -0
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/opentelemetry/instrumentation/openai/shared/__init__.py +0 -0
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/opentelemetry/instrumentation/openai/shared/chat_wrappers.py +0 -0
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/opentelemetry/instrumentation/openai/shared/completion_wrappers.py +0 -0
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/opentelemetry/instrumentation/openai/shared/config.py +0 -0
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/opentelemetry/instrumentation/openai/shared/embeddings_wrappers.py +0 -0
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/opentelemetry/instrumentation/openai/shared/image_gen_wrappers.py +0 -0
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/opentelemetry/instrumentation/openai/utils.py +0 -0
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/opentelemetry/instrumentation/openai/v0/__init__.py +0 -0
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/opentelemetry/instrumentation/openai/v1/__init__.py +0 -0
- {opentelemetry_instrumentation_openai-0.38.12 → opentelemetry_instrumentation_openai-0.39.0}/opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py +0 -0
|
@@ -106,7 +106,7 @@ def messages_list_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
|
106
106
|
start_time=run.get("start_time"),
|
|
107
107
|
)
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
prompt_index = 0
|
|
110
110
|
if assistants.get(run["assistant_id"]) is not None or Config.enrich_assistant:
|
|
111
111
|
if Config.enrich_assistant:
|
|
112
112
|
assistant = model_as_dict(
|
|
@@ -131,27 +131,35 @@ def messages_list_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
|
131
131
|
SpanAttributes.LLM_RESPONSE_MODEL,
|
|
132
132
|
assistant["model"],
|
|
133
133
|
)
|
|
134
|
-
_set_span_attribute(span, f"{SpanAttributes.LLM_PROMPTS}.{
|
|
134
|
+
_set_span_attribute(span, f"{SpanAttributes.LLM_PROMPTS}.{prompt_index}.role", "system")
|
|
135
135
|
_set_span_attribute(
|
|
136
136
|
span,
|
|
137
|
-
f"{SpanAttributes.LLM_PROMPTS}.{
|
|
137
|
+
f"{SpanAttributes.LLM_PROMPTS}.{prompt_index}.content",
|
|
138
138
|
assistant["instructions"],
|
|
139
139
|
)
|
|
140
|
-
|
|
141
|
-
_set_span_attribute(span, f"{SpanAttributes.LLM_PROMPTS}.{
|
|
140
|
+
prompt_index += 1
|
|
141
|
+
_set_span_attribute(span, f"{SpanAttributes.LLM_PROMPTS}.{prompt_index}.role", "system")
|
|
142
142
|
_set_span_attribute(
|
|
143
|
-
span, f"{SpanAttributes.LLM_PROMPTS}.{
|
|
143
|
+
span, f"{SpanAttributes.LLM_PROMPTS}.{prompt_index}.content", run["instructions"]
|
|
144
144
|
)
|
|
145
|
+
prompt_index += 1
|
|
145
146
|
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
completion_index = 0
|
|
148
|
+
for msg in messages:
|
|
149
|
+
prefix = f"{SpanAttributes.LLM_COMPLETIONS}.{completion_index}"
|
|
148
150
|
content = msg.get("content")
|
|
149
151
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
message_content = content[0].get("text").get("value")
|
|
153
|
+
message_role = msg.get("role")
|
|
154
|
+
if message_role in ["user", "system"]:
|
|
155
|
+
_set_span_attribute(span, f"{SpanAttributes.LLM_PROMPTS}.{prompt_index}.role", message_role)
|
|
156
|
+
_set_span_attribute(span, f"{SpanAttributes.LLM_PROMPTS}.{prompt_index}.content", message_content)
|
|
157
|
+
prompt_index += 1
|
|
158
|
+
else:
|
|
159
|
+
_set_span_attribute(span, f"{prefix}.role", msg.get("role"))
|
|
160
|
+
_set_span_attribute(span, f"{prefix}.content", message_content)
|
|
161
|
+
_set_span_attribute(span, f"gen_ai.response.{completion_index}.id", msg.get("id"))
|
|
162
|
+
completion_index += 1
|
|
155
163
|
|
|
156
164
|
if run.get("usage"):
|
|
157
165
|
usage_dict = model_as_dict(run.get("usage"))
|
|
@@ -223,7 +231,7 @@ def runs_create_and_stream_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
|
223
231
|
)
|
|
224
232
|
|
|
225
233
|
kwargs["event_handler"] = EventHandleWrapper(
|
|
226
|
-
original_handler=kwargs["event_handler"], span=span
|
|
234
|
+
original_handler=kwargs["event_handler"], span=span,
|
|
227
235
|
)
|
|
228
236
|
|
|
229
237
|
response = wrapped(*args, **kwargs)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.39.0"
|
opentelemetry_instrumentation_openai-0.38.12/opentelemetry/instrumentation/openai/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.38.12"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|