Skip to content

Commit 679b367

Browse files
committed
feat(openai): trace inline moderation metadata
OpenAI chat completions and streaming responses now preserve inline moderation results on span metadata when callers pass moderation={"model": "omni-moderation-latest"}. This gives users visibility into the provider's input and output safety classifications alongside the generated content. Bump the OpenAI latest matrix pin to 2.41.0 because that SDK version introduced the inline moderation API surface. The latest OpenAI cassettes were deleted and re-recorded against 2.41.0 so playback matches the newly pinned provider version across the OpenAI, HTTP/2, and BTX test sessions.
1 parent 82d86b1 commit 679b367

80 files changed

Lines changed: 5229 additions & 5238 deletions

File tree

Some content is hidden

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

py/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ conflicts = [
312312
[tool.braintrust.matrix]
313313

314314
[tool.braintrust.matrix.openai]
315-
latest = "openai==2.38.0"
315+
latest = "openai==2.41.0"
316316
"1.92.0" = "openai==1.92.0"
317317
"1.77.0" = "openai==1.77.0"
318318
"1.71.0" = "openai==1.71.0"

py/src/braintrust/integrations/openai/cassettes/latest/TestOpenAIIntegrationSetupAsyncSpans.test_setup_async_creates_spans.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interactions:
1515
Host:
1616
- api.openai.com
1717
User-Agent:
18-
- AsyncOpenAI/Python 2.38.0
18+
- AsyncOpenAI/Python 2.41.0
1919
X-Stainless-Arch:
2020
- arm64
2121
X-Stainless-Async:
@@ -25,7 +25,7 @@ interactions:
2525
X-Stainless-OS:
2626
- MacOS
2727
X-Stainless-Package-Version:
28-
- 2.38.0
28+
- 2.41.0
2929
X-Stainless-Runtime:
3030
- CPython
3131
X-Stainless-Runtime-Version:
@@ -38,30 +38,30 @@ interactions:
3838
uri: https://api.openai.com/v1/chat/completions
3939
response:
4040
body:
41-
string: "{\n \"id\": \"chatcmpl-DjU7eES37yYEfrGVaLKcMHKeZh0hX\",\n \"object\":
42-
\"chat.completion\",\n \"created\": 1779732922,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n
41+
string: "{\n \"id\": \"chatcmpl-DpaXP42Z53czV6GZRfObS1MUO2mLZ\",\n \"object\":
42+
\"chat.completion\",\n \"created\": 1781187551,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n
4343
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
44-
\"assistant\",\n \"content\": \"Hi there! How can I assist you today?\",\n
44+
\"assistant\",\n \"content\": \"Hi! How can I assist you today?\",\n
4545
\ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\":
4646
null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\":
47-
10,\n \"completion_tokens\": 10,\n \"total_tokens\": 20,\n \"prompt_tokens_details\":
47+
10,\n \"completion_tokens\": 9,\n \"total_tokens\": 19,\n \"prompt_tokens_details\":
4848
{\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\":
4949
{\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
5050
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
51-
\"default\",\n \"system_fingerprint\": \"fp_d681c52869\"\n}\n"
51+
\"default\",\n \"system_fingerprint\": \"fp_8a6a29ba59\"\n}\n"
5252
headers:
5353
Access-Control-Expose-Headers:
5454
- CF-Ray
5555
CF-Cache-Status:
5656
- DYNAMIC
5757
CF-Ray:
58-
- a016866a6d3f36eb-YYZ
58+
- a0a13fd47826aeb6-YYZ
5959
Connection:
6060
- keep-alive
6161
Content-Type:
6262
- application/json
6363
Date:
64-
- Mon, 25 May 2026 18:15:22 GMT
64+
- Thu, 11 Jun 2026 14:19:12 GMT
6565
Server:
6666
- cloudflare
6767
Strict-Transport-Security:
@@ -73,19 +73,19 @@ interactions:
7373
alt-svc:
7474
- h3=":443"; ma=86400
7575
content-length:
76-
- '844'
76+
- '837'
7777
openai-organization:
7878
- braintrust-data
7979
openai-processing-ms:
80-
- '314'
80+
- '517'
8181
openai-project:
8282
- proj_vsCSXafhhByzWOThMrJcZiw9
8383
openai-version:
8484
- '2020-10-01'
8585
set-cookie:
86-
- __cf_bm=IbwQKxQbp5fYV9CfzBGGBqBk8Cteen3srDB95KyEDBo-1779732921.987224-1.0.1.1-ZU7GlqAZ1LfNUw7HxxQ8i_Kz0tMFZeaVR6yR7Xp.7boJuAMUep_QHIiISpPOqQV78891Bmy1gDxQOitkVZ68eMCKBS.FKt91yMvF5NUt.lfASE5NFxT6f2FMuHwN5Acu;
87-
HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com; Expires=Mon,
88-
25 May 2026 18:45:22 GMT
86+
- __cf_bm=G1Uo_TxgmE1nso5WanuwLhV8..NBwvsOVi53ce3n0FQ-1781187551.437338-1.0.1.1-Tm.pnoDamjJmlkxy_a36.4oX8UgwznMCM02zZwOHOHuBJGliixJJNc_cHyjUxCLbSc6f8Zxl0Kd.dHkee4QVfk4G6deJC.xO3Eplb2bUx2dafHMrCs965Py1Ug4uQc0b;
87+
HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com; Expires=Thu,
88+
11 Jun 2026 14:49:12 GMT
8989
x-openai-proxy-wasm:
9090
- v0.1
9191
x-ratelimit-limit-requests:
@@ -101,7 +101,7 @@ interactions:
101101
x-ratelimit-reset-tokens:
102102
- 0s
103103
x-request-id:
104-
- req_4a23bee4131845eebbc92dd898f7e052
104+
- req_8c70b5311a1f490b9881aa307acfdf44
105105
status:
106106
code: 200
107107
message: OK

py/src/braintrust/integrations/openai/cassettes/latest/TestOpenAIIntegrationSetupSpans.test_setup_creates_spans.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interactions:
1515
Host:
1616
- api.openai.com
1717
User-Agent:
18-
- OpenAI/Python 2.38.0
18+
- OpenAI/Python 2.41.0
1919
X-Stainless-Arch:
2020
- arm64
2121
X-Stainless-Async:
@@ -25,7 +25,7 @@ interactions:
2525
X-Stainless-OS:
2626
- MacOS
2727
X-Stainless-Package-Version:
28-
- 2.38.0
28+
- 2.41.0
2929
X-Stainless-Runtime:
3030
- CPython
3131
X-Stainless-Runtime-Version:
@@ -38,8 +38,8 @@ interactions:
3838
uri: https://api.openai.com/v1/chat/completions
3939
response:
4040
body:
41-
string: "{\n \"id\": \"chatcmpl-DjU7cgYjNsMg0HU3jey5gbwskddVD\",\n \"object\":
42-
\"chat.completion\",\n \"created\": 1779732920,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n
41+
string: "{\n \"id\": \"chatcmpl-DpaXOWVaLbHzw5zJ8tGEq1uQkApaR\",\n \"object\":
42+
\"chat.completion\",\n \"created\": 1781187550,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n
4343
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
4444
\"assistant\",\n \"content\": \"Hi there! How can I assist you today?\",\n
4545
\ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\":
@@ -48,20 +48,20 @@ interactions:
4848
{\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\":
4949
{\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
5050
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
51-
\"default\",\n \"system_fingerprint\": \"fp_6e71a9f378\"\n}\n"
51+
\"default\",\n \"system_fingerprint\": \"fp_c05d1d0fdd\"\n}\n"
5252
headers:
5353
Access-Control-Expose-Headers:
5454
- CF-Ray
5555
CF-Cache-Status:
5656
- DYNAMIC
5757
CF-Ray:
58-
- a016865f3fe1ac6c-YYZ
58+
- a0a13fc9c970e7e3-YYZ
5959
Connection:
6060
- keep-alive
6161
Content-Type:
6262
- application/json
6363
Date:
64-
- Mon, 25 May 2026 18:15:21 GMT
64+
- Thu, 11 Jun 2026 14:19:10 GMT
6565
Server:
6666
- cloudflare
6767
Strict-Transport-Security:
@@ -77,15 +77,15 @@ interactions:
7777
openai-organization:
7878
- braintrust-data
7979
openai-processing-ms:
80-
- '907'
80+
- '680'
8181
openai-project:
8282
- proj_vsCSXafhhByzWOThMrJcZiw9
8383
openai-version:
8484
- '2020-10-01'
8585
set-cookie:
86-
- __cf_bm=Aom82Vc_F7OzYXaIK8BWEaIUIdfEQyUX3SqurTRUMJs-1779732920.196738-1.0.1.1-ZoUSpE8J_SX_hemycj.8l6520R2Pm5TkRzT3m1.qbyC3P817tVYqKjV_RORYRd7HwxjtPf_weXGinxVM.dP4VLll07JgDApkMu1OFyxiHlTbBpM2d9ihMnzNlWdsjFF6;
87-
HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com; Expires=Mon,
88-
25 May 2026 18:45:21 GMT
86+
- __cf_bm=61wOt3YXBds9SjuatAZPzbICqmICF2FLXqGrla.xXN8-1781187549.722929-1.0.1.1-PPhNYy5g5A68xK.TUVaJoz7X4p2ok3gtbIpgw8DUsDgTU49VO1Eg61tHZ.exzsDpN58v0Mma5w5FPfyhaYdjHn_MStSvj6ozP4jFiEITOKXARoRF086WgOiA_j5WGkEt;
87+
HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com; Expires=Thu,
88+
11 Jun 2026 14:49:10 GMT
8989
x-openai-proxy-wasm:
9090
- v0.1
9191
x-ratelimit-limit-requests:
@@ -101,7 +101,7 @@ interactions:
101101
x-ratelimit-reset-tokens:
102102
- 0s
103103
x-request-id:
104-
- req_47065360adf542f38821301e054eb6a3
104+
- req_9bd9b4dc74e8450a839b642efb06a791
105105
status:
106106
code: 200
107107
message: OK

0 commit comments

Comments
 (0)