opentelemetry-instrumentation-openai 0.33.3__tar.gz → 0.33.5__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.33.3 → opentelemetry_instrumentation_openai-0.33.5}/PKG-INFO +2 -2
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/opentelemetry/instrumentation/openai/shared/chat_wrappers.py +2 -2
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/opentelemetry/instrumentation/openai/utils.py +16 -0
- opentelemetry_instrumentation_openai-0.33.5/opentelemetry/instrumentation/openai/version.py +1 -0
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/pyproject.toml +2 -2
- opentelemetry_instrumentation_openai-0.33.3/opentelemetry/instrumentation/openai/version.py +0 -1
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/README.md +0 -0
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/opentelemetry/instrumentation/openai/__init__.py +0 -0
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/opentelemetry/instrumentation/openai/shared/__init__.py +0 -0
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/opentelemetry/instrumentation/openai/shared/completion_wrappers.py +0 -0
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/opentelemetry/instrumentation/openai/shared/config.py +0 -0
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/opentelemetry/instrumentation/openai/shared/embeddings_wrappers.py +0 -0
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/opentelemetry/instrumentation/openai/shared/image_gen_wrappers.py +0 -0
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/opentelemetry/instrumentation/openai/v0/__init__.py +0 -0
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/opentelemetry/instrumentation/openai/v1/__init__.py +0 -0
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/opentelemetry/instrumentation/openai/v1/assistant_wrappers.py +0 -0
- {opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py +0 -0
{opentelemetry_instrumentation_openai-0.33.3 → opentelemetry_instrumentation_openai-0.33.5}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: opentelemetry-instrumentation-openai
|
|
3
|
-
Version: 0.33.
|
|
3
|
+
Version: 0.33.5
|
|
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
|
|
@@ -18,7 +18,7 @@ Provides-Extra: instruments
|
|
|
18
18
|
Requires-Dist: opentelemetry-api (>=1.27.0,<2.0.0)
|
|
19
19
|
Requires-Dist: opentelemetry-instrumentation (>=0.48b0,<0.49)
|
|
20
20
|
Requires-Dist: opentelemetry-semantic-conventions (>=0.48b0,<0.49)
|
|
21
|
-
Requires-Dist: opentelemetry-semantic-conventions-ai (==0.4.
|
|
21
|
+
Requires-Dist: opentelemetry-semantic-conventions-ai (==0.4.2)
|
|
22
22
|
Requires-Dist: tiktoken (>=0.6.0,<1)
|
|
23
23
|
Project-URL: Repository, https://github.com/traceloop/openllmetry/tree/main/packages/opentelemetry-instrumentation-openai
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import asyncio
|
|
2
1
|
import copy
|
|
3
2
|
import json
|
|
4
3
|
import logging
|
|
@@ -19,6 +18,7 @@ from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
|
|
19
18
|
from opentelemetry.instrumentation.openai.utils import (
|
|
20
19
|
_with_chat_telemetry_wrapper,
|
|
21
20
|
dont_throw,
|
|
21
|
+
run_async,
|
|
22
22
|
)
|
|
23
23
|
from opentelemetry.instrumentation.openai.shared import (
|
|
24
24
|
metric_shared_attributes,
|
|
@@ -78,7 +78,7 @@ def chat_wrapper(
|
|
|
78
78
|
attributes={SpanAttributes.LLM_REQUEST_TYPE: LLM_REQUEST_TYPE.value},
|
|
79
79
|
)
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
run_async(_handle_request(span, kwargs, instance))
|
|
82
82
|
|
|
83
83
|
try:
|
|
84
84
|
start_time = time.time()
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import asyncio
|
|
1
2
|
from importlib.metadata import version
|
|
2
3
|
from contextlib import asynccontextmanager
|
|
3
4
|
import logging
|
|
4
5
|
import os
|
|
6
|
+
import threading
|
|
5
7
|
import traceback
|
|
6
8
|
|
|
7
9
|
import openai
|
|
@@ -133,3 +135,17 @@ def dont_throw(func):
|
|
|
133
135
|
Config.exception_logger(e)
|
|
134
136
|
|
|
135
137
|
return wrapper
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def run_async(method):
|
|
141
|
+
try:
|
|
142
|
+
loop = asyncio.get_running_loop()
|
|
143
|
+
except RuntimeError:
|
|
144
|
+
loop = None
|
|
145
|
+
|
|
146
|
+
if loop and loop.is_running():
|
|
147
|
+
thread = threading.Thread(target=lambda: asyncio.run(method))
|
|
148
|
+
thread.start()
|
|
149
|
+
thread.join()
|
|
150
|
+
else:
|
|
151
|
+
asyncio.run(method)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.33.5"
|
|
@@ -8,7 +8,7 @@ show_missing = true
|
|
|
8
8
|
|
|
9
9
|
[tool.poetry]
|
|
10
10
|
name = "opentelemetry-instrumentation-openai"
|
|
11
|
-
version = "0.33.
|
|
11
|
+
version = "0.33.5"
|
|
12
12
|
description = "OpenTelemetry OpenAI instrumentation"
|
|
13
13
|
authors = [
|
|
14
14
|
"Gal Kleinman <gal@traceloop.com>",
|
|
@@ -27,7 +27,7 @@ python = ">=3.9,<4"
|
|
|
27
27
|
opentelemetry-api = "^1.27.0"
|
|
28
28
|
opentelemetry-instrumentation = "^0.48b0"
|
|
29
29
|
opentelemetry-semantic-conventions = "^0.48b0"
|
|
30
|
-
opentelemetry-semantic-conventions-ai = "0.4.
|
|
30
|
+
opentelemetry-semantic-conventions-ai = "0.4.2"
|
|
31
31
|
tiktoken = ">=0.6.0, <1"
|
|
32
32
|
|
|
33
33
|
[tool.poetry.group.dev.dependencies]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.33.3"
|
|
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
|