Skip to content

Commit 7f7f968

Browse files
XG-xinKyle-Verhoog
andauthored
feat(llmobs): [MLOB-2681] instrument openai responses with llm (#13715)
This PR add LLM tracing/instrumentation for the OpenAI Responses endpoint. For stream response, we will only get the response.completed chunk because it includes all metadata. Since there's only one response object that is present in each stream chunk, we append it as the first item in streamed_chunks. This PR only handles function tool, and we might want to support other type of tools (i.e file search) in the future. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) --------- Co-authored-by: Kyle Verhoog <kyle@verhoog.ca>
1 parent ca79351 commit 7f7f968

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1827
-587
lines changed

.riot/requirements/107d8f2.txt

Lines changed: 0 additions & 54 deletions
This file was deleted.

.riot/requirements/18de44f.txt renamed to .riot/requirements/1093ff3.txt

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,50 @@
22
# This file is autogenerated by pip-compile with Python 3.8
33
# by the following command:
44
#
5-
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/18de44f.in
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1093ff3.in
66
#
77
annotated-types==0.7.0
88
anyio==4.5.2
9-
attrs==24.3.0
10-
certifi==2024.12.14
11-
charset-normalizer==3.4.1
9+
attrs==25.3.0
10+
certifi==2025.6.15
11+
charset-normalizer==3.4.2
1212
coverage[toml]==7.6.1
1313
distro==1.9.0
14-
exceptiongroup==1.2.2
15-
h11==0.14.0
16-
httpcore==1.0.7
14+
exceptiongroup==1.3.0
15+
h11==0.16.0
16+
httpcore==1.0.9
1717
httpx==0.28.1
1818
hypothesis==6.45.0
1919
idna==3.10
2020
importlib-metadata==8.5.0
21-
iniconfig==2.0.0
22-
jiter==0.8.2
23-
mock==5.1.0
21+
iniconfig==2.1.0
22+
jiter==0.9.1
23+
mock==5.2.0
2424
multidict==6.1.0
25-
openai==1.60.0
25+
openai==1.91.0
2626
opentracing==2.4.0
27-
packaging==24.2
27+
packaging==25.0
2828
pillow==10.4.0
2929
pluggy==1.5.0
3030
propcache==0.2.0
31-
pydantic==2.10.5
31+
pydantic==2.10.6
3232
pydantic-core==2.27.2
33-
pytest==8.3.4
33+
pytest==8.3.5
3434
pytest-asyncio==0.21.1
3535
pytest-cov==5.0.0
36-
pytest-mock==3.14.0
36+
pytest-mock==3.14.1
3737
pytest-randomly==3.15.0
3838
pyyaml==6.0.2
3939
regex==2024.11.6
40-
requests==2.32.3
41-
six==1.17.0
40+
requests==2.32.4
4241
sniffio==1.3.1
4342
sortedcontainers==2.4.0
4443
tiktoken==0.7.0
4544
tomli==2.2.1
4645
tqdm==4.67.1
47-
typing-extensions==4.12.2
46+
typing-extensions==4.13.2
4847
urllib3==1.26.20
49-
vcrpy==4.2.1
48+
vcrpy==6.0.2
5049
wrapt==1.17.2
5150
yarl==1.15.2
5251
zipp==3.20.2

.riot/requirements/e648105.txt renamed to .riot/requirements/109d638.txt

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,51 @@
22
# This file is autogenerated by pip-compile with Python 3.11
33
# by the following command:
44
#
5-
# pip-compile --allow-unsafe --no-annotate .riot/requirements/e648105.in
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/109d638.in
66
#
77
annotated-types==0.7.0
88
anyio==3.7.1
9-
attrs==25.1.0
10-
certifi==2024.12.14
11-
coverage[toml]==7.6.10
9+
attrs==25.3.0
10+
certifi==2025.4.26
11+
coverage[toml]==7.9.1
1212
distro==1.9.0
13-
h11==0.14.0
14-
httpcore==1.0.7
13+
h11==0.16.0
14+
httpcore==1.0.9
1515
httpx==0.27.2
1616
hypothesis==6.45.0
1717
idna==3.10
18-
iniconfig==2.0.0
19-
mock==5.1.0
20-
multidict==6.1.0
21-
numpy==2.2.2
18+
iniconfig==2.1.0
19+
mock==5.2.0
20+
multidict==6.4.4
21+
numpy==2.3.0
2222
openai[datalib,embeddings]==1.0.0
2323
opentracing==2.4.0
24-
packaging==24.2
25-
pandas==2.2.3
26-
pandas-stubs==2.2.3.241126
24+
packaging==25.0
25+
pandas==2.3.0
26+
pandas-stubs==2.2.3.250527
2727
pillow==9.5.0
28-
pluggy==1.5.0
29-
propcache==0.2.1
30-
pydantic==2.10.6
31-
pydantic-core==2.27.2
32-
pytest==8.3.4
28+
pluggy==1.6.0
29+
propcache==0.3.2
30+
pydantic==2.11.6
31+
pydantic-core==2.33.2
32+
pygments==2.19.1
33+
pytest==8.4.0
3334
pytest-asyncio==0.21.1
34-
pytest-cov==6.0.0
35-
pytest-mock==3.14.0
35+
pytest-cov==6.2.1
36+
pytest-mock==3.14.1
3637
pytest-randomly==3.16.0
3738
python-dateutil==2.9.0.post0
38-
pytz==2024.2
39+
pytz==2025.2
3940
pyyaml==6.0.2
4041
six==1.17.0
4142
sniffio==1.3.1
4243
sortedcontainers==2.4.0
4344
tqdm==4.67.1
44-
types-pytz==2024.2.0.20241221
45-
typing-extensions==4.12.2
46-
tzdata==2025.1
45+
types-pytz==2025.2.0.20250516
46+
typing-extensions==4.14.0
47+
typing-inspection==0.4.1
48+
tzdata==2025.2
4749
urllib3==1.26.20
48-
vcrpy==4.2.1
50+
vcrpy==7.0.0
4951
wrapt==1.17.2
50-
yarl==1.18.3
52+
yarl==1.20.1

.riot/requirements/1106709.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.12
3+
# by the following command:
4+
#
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1106709.in
6+
#
7+
annotated-types==0.7.0
8+
anyio==4.9.0
9+
attrs==25.3.0
10+
certifi==2025.6.15
11+
charset-normalizer==3.4.2
12+
coverage[toml]==7.9.1
13+
distro==1.9.0
14+
h11==0.16.0
15+
httpcore==1.0.9
16+
httpx==0.28.1
17+
hypothesis==6.45.0
18+
idna==3.10
19+
iniconfig==2.1.0
20+
jiter==0.10.0
21+
mock==5.2.0
22+
multidict==6.5.0
23+
openai==1.91.0
24+
opentracing==2.4.0
25+
packaging==25.0
26+
pillow==11.2.1
27+
pluggy==1.6.0
28+
propcache==0.3.2
29+
pydantic==2.11.7
30+
pydantic-core==2.33.2
31+
pygments==2.19.2
32+
pytest==8.4.1
33+
pytest-asyncio==0.21.1
34+
pytest-cov==6.2.1
35+
pytest-mock==3.14.1
36+
pytest-randomly==3.16.0
37+
pyyaml==6.0.2
38+
regex==2024.11.6
39+
requests==2.32.4
40+
sniffio==1.3.1
41+
sortedcontainers==2.4.0
42+
tiktoken==0.9.0
43+
tqdm==4.67.1
44+
typing-extensions==4.14.0
45+
typing-inspection==0.4.1
46+
urllib3==1.26.20
47+
vcrpy==7.0.0
48+
wrapt==1.17.2
49+
yarl==1.20.1

.riot/requirements/130158f.txt

Lines changed: 0 additions & 48 deletions
This file was deleted.

.riot/requirements/1e6bd37.txt renamed to .riot/requirements/13c42e3.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,53 @@
22
# This file is autogenerated by pip-compile with Python 3.8
33
# by the following command:
44
#
5-
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/1e6bd37.in
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/13c42e3.in
66
#
77
annotated-types==0.7.0
88
anyio==4.5.2
9-
attrs==24.3.0
10-
certifi==2024.12.14
9+
attrs==25.3.0
10+
certifi==2025.4.26
1111
coverage[toml]==7.6.1
1212
distro==1.9.0
13-
exceptiongroup==1.2.2
14-
h11==0.14.0
15-
httpcore==1.0.7
13+
exceptiongroup==1.3.0
14+
h11==0.16.0
15+
httpcore==1.0.9
1616
httpx==0.27.2
1717
hypothesis==6.45.0
1818
idna==3.10
1919
importlib-metadata==8.5.0
20-
iniconfig==2.0.0
21-
mock==5.1.0
20+
iniconfig==2.1.0
21+
mock==5.2.0
2222
multidict==6.1.0
2323
numpy==1.24.4
2424
openai[datalib,embeddings]==1.30.1
2525
opentracing==2.4.0
26-
packaging==24.2
26+
packaging==25.0
2727
pandas==2.0.3
2828
pandas-stubs==2.0.3.230814
2929
pillow==9.5.0
3030
pluggy==1.5.0
3131
propcache==0.2.0
32-
pydantic==2.10.5
32+
pydantic==2.10.6
3333
pydantic-core==2.27.2
34-
pytest==8.3.4
34+
pytest==8.3.5
3535
pytest-asyncio==0.21.1
3636
pytest-cov==5.0.0
37-
pytest-mock==3.14.0
37+
pytest-mock==3.14.1
3838
pytest-randomly==3.15.0
3939
python-dateutil==2.9.0.post0
40-
pytz==2024.2
40+
pytz==2025.2
4141
pyyaml==6.0.2
4242
six==1.17.0
4343
sniffio==1.3.1
4444
sortedcontainers==2.4.0
4545
tomli==2.2.1
4646
tqdm==4.67.1
4747
types-pytz==2024.2.0.20241221
48-
typing-extensions==4.12.2
49-
tzdata==2025.1
48+
typing-extensions==4.13.2
49+
tzdata==2025.2
5050
urllib3==1.26.20
51-
vcrpy==4.2.1
51+
vcrpy==6.0.2
5252
wrapt==1.17.2
5353
yarl==1.15.2
5454
zipp==3.20.2

0 commit comments

Comments
 (0)