File tree 4 files changed +19
-13
lines changed
instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai
4 files changed +19
-13
lines changed Original file line number Diff line number Diff line change 43
43
44
44
from typing import Collection
45
45
46
+ from wrapt import wrap_function_wrapper
47
+
46
48
from opentelemetry .instrumentation .instrumentor import BaseInstrumentor
47
49
from opentelemetry .instrumentation .openai .package import _instruments
48
50
from opentelemetry .trace import get_tracer
49
- from wrapt import wrap_function_wrapper
51
+
50
52
from .patch import chat_completions_create
51
53
52
54
Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
15
15
16
- from opentelemetry .trace import SpanKind , Span
17
- from opentelemetry .trace .status import Status , StatusCode
18
- from .span_attributes import LLMSpanAttributes
19
- from opentelemetry .semconv .attributes import (
20
- error_attributes as ErrorAttributes ,
21
- )
16
+ import json
17
+
22
18
from opentelemetry .semconv ._incubating .attributes import (
23
19
gen_ai_attributes as GenAIAttributes ,
24
20
)
21
+ from opentelemetry .semconv .attributes import (
22
+ error_attributes as ErrorAttributes ,
23
+ )
24
+ from opentelemetry .trace import Span , SpanKind , Tracer
25
+ from opentelemetry .trace .status import Status , StatusCode
26
+
27
+ from .span_attributes import LLMSpanAttributes
25
28
from .utils import (
26
- silently_fail ,
27
29
extract_content ,
30
+ extract_tools_prompt ,
28
31
get_llm_request_attributes ,
29
32
is_streaming ,
30
- set_span_attribute ,
31
33
set_event_completion ,
32
- extract_tools_prompt ,
33
34
set_event_prompt ,
35
+ set_span_attribute ,
36
+ silently_fail ,
34
37
)
35
- from opentelemetry .trace import Tracer
36
- import json
37
38
38
39
39
40
def chat_completions_create (tracer : Tracer ):
Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
15
15
from __future__ import annotations
16
+
16
17
from typing import Dict , List , Optional
18
+
17
19
from pydantic import BaseModel , ConfigDict , Field
18
20
19
21
Original file line number Diff line number Diff line change 15
15
import json
16
16
import logging
17
17
from typing import Optional , Union
18
+
18
19
from openai import NOT_GIVEN
20
+
19
21
from opentelemetry .semconv ._incubating .attributes import (
20
22
gen_ai_attributes as GenAIAttributes ,
21
23
)
22
-
23
24
from opentelemetry .trace import Span
24
25
25
26
You can’t perform that action at this time.
0 commit comments