Skip to content

Commit 3c50399

Browse files
feat(api): support image URLs and detailed safety alert explanations (#4061)
## Summary Document HTTP(S) image URLs for Decisions inputs and expose detailed safety alert explanations. ## Changes - Document publicly accessible HTTP(S) image URLs alongside base64 data URLs in Decisions inputs. - Add optional detailed_explanation to safety alerts when an explanation is available for an eligible zero data retention alert.
1 parent 9eb83fe commit 3c50399

7 files changed

Lines changed: 49 additions & 31 deletions

File tree

‎.castiron.stats.yml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
schema_version: 1
2-
generation_id: c318dee1-e92a-4e04-9998-0ee35c0a25ef
3-
openapi_spec_hash: 134c119262ce50017727a300b0106882
4-
openapi_transformed_spec_hash: b5602cf76f35aea5b689f2439368863b
2+
generation_id: e09f4b55-082a-4437-ab5e-51440961a3a9
3+
openapi_spec_hash: fd66f1b55a7b5e3f8e7331bb0bd0febb
4+
openapi_transformed_spec_hash: 79a17820b39aac110d9207c90d19966c
55
config_hash: adfe6b936328bd198d9442c21c42383b
6-
codegen_sha: 31c1e56b53ee76699d430b69a7b64f1ee4fd6e86
7-
codegen_hash: 15181a0a3c25ad88c8574f8671807274f5fc0d5fd06b7f844944a0c617182ea3
8-
public_codegen_sha: 66bc7260d20b924da975399a929978381379b561
6+
codegen_sha: 45643f6d6f5e5d6c915d405c01b1b67038be8e64
7+
codegen_hash: 196804e1a61fbde8c27b6b8ea5de4d04a67aa9313905059f4552bb18ad8ac44d
8+
public_codegen_sha: 594c0136760596aee538a20f6e9abb830caee222

‎api_reference/openapi.transformed.yml‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30102,7 +30102,7 @@ paths:
3010230102
description: |-
3010330103
Use this endpoint to ask classification or scoring questions about the same input. You’ll get the answers back in the order you asked the questions.
3010430104

30105-
For text, you can pass a string. You can also send user messages containing `input_text` and `input_image` parts, with up to 128 images per request. Images must be data URLs; external URLs and file IDs aren’t accepted. Other message roles, function calls, files, audio, and item references aren’t supported.
30105+
For text, you can pass a string. You can also send user messages containing `input_text` and `input_image` parts, with up to 128 images per request. Images can be base64 data URLs or publicly accessible HTTP(S) URLs. File IDs aren’t accepted. Other message roles, function calls, files, audio, and item references aren’t supported.
3010630106

3010730107
Sometimes a question returns a refusal instead of an answer. The result has type `refusal` and includes the question’s name, or `null` if you didn’t give it one.
3010830108
tags:
@@ -78416,6 +78416,11 @@ components:
7841678416
- type: string
7841778417
description: A customer-safe description derived from error_type, or null for zero data retention requests.
7841878418
- type: 'null'
78419+
detailed_explanation:
78420+
anyOf:
78421+
- type: string
78422+
description: A generated explanation, temporarily available for eligible zero data retention alerts. Omitted when unavailable.
78423+
- type: 'null'
7841978424
type: object
7842078425
required:
7842178426
- id
@@ -80903,8 +80908,8 @@ components:
8090380908
type: string
8090480909
minLength: 0
8090580910
maxLength: 1073741824
80906-
pattern: '^data:'
80907-
description: A base64-encoded image in a data URL.
80911+
pattern: ^(data:|https?://)
80912+
description: A base64-encoded image in a data URL or a publicly accessible HTTP(S) image URL.
8090880913
detail:
8090980914
anyOf:
8091080915
- $ref: '#/components/schemas/ImageDetailParam'
@@ -80921,7 +80926,7 @@ components:
8092180926
- image_url
8092280927
- type
8092380928
additionalProperties: false
80924-
description: An inline image. External URLs and file IDs are not supported.
80929+
description: An image provided as a base64 data URL or a publicly accessible HTTP(S) URL. File IDs are not supported.
8092580930
DecisionInputContentParts:
8092680931
type: array
8092780932
items:
@@ -80939,7 +80944,7 @@ components:
8093980944
minItems: 0
8094080945
maxItems: 16384
8094180946
DecisionInputContent:
80942-
description: Text evidence or an ordered list of text and inline image parts.
80947+
description: Text evidence or an ordered list of text and image parts.
8094380948
anyOf:
8094480949
- type: string
8094580950
minLength: 0
@@ -80967,9 +80972,9 @@ components:
8096780972
- role
8096880973
- content
8096980974
additionalProperties: false
80970-
description: A user message containing text or inline images.
80975+
description: A user message containing text or images.
8097180976
DecisionInput:
80972-
description: The text or images to evaluate for every question. Provide a text string or user messages containing text and inline images. Images must be inline data URLs; at most 128 images are allowed across all messages in one request. External URLs, files, audio, tools, and item references are not supported.
80977+
description: The text or images to evaluate for every question. Provide a text string or user messages containing text and images. Images can be base64 data URLs or publicly accessible HTTP(S) URLs; at most 128 images are allowed across all messages in one request. Files, audio, tools, and item references are not supported.
8097380978
anyOf:
8097480979
- type: string
8097580980
minLength: 0

‎src/openai/resources/decisions.py‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,18 @@ def create(
6060
6161
For text, you can pass a string. You can also send user messages containing
6262
`input_text` and `input_image` parts, with up to 128 images per request. Images
63-
must be data URLs; external URLs and file IDs aren’t accepted. Other message
64-
roles, function calls, files, audio, and item references aren’t supported.
63+
can be base64 data URLs or publicly accessible HTTP(S) URLs. File IDs aren’t
64+
accepted. Other message roles, function calls, files, audio, and item references
65+
aren’t supported.
6566
6667
Sometimes a question returns a refusal instead of an answer. The result has type
6768
`refusal` and includes the question’s name, or `null` if you didn’t give it one.
6869
6970
Args:
7071
input: The text or images to evaluate for every question. Provide a text string or user
71-
messages containing text and inline images. Images must be inline data URLs; at
72-
most 128 images are allowed across all messages in one request. External URLs,
73-
files, audio, tools, and item references are not supported.
72+
messages containing text and images. Images can be base64 data URLs or publicly
73+
accessible HTTP(S) URLs; at most 128 images are allowed across all messages in
74+
one request. Files, audio, tools, and item references are not supported.
7475
7576
safety_identifier: Opaque caller-provided end-user identifier, scoped by the verified org. Match
7677
Responses' limit; this is never the authenticated user identity.
@@ -145,17 +146,18 @@ async def create(
145146
146147
For text, you can pass a string. You can also send user messages containing
147148
`input_text` and `input_image` parts, with up to 128 images per request. Images
148-
must be data URLs; external URLs and file IDs aren’t accepted. Other message
149-
roles, function calls, files, audio, and item references aren’t supported.
149+
can be base64 data URLs or publicly accessible HTTP(S) URLs. File IDs aren’t
150+
accepted. Other message roles, function calls, files, audio, and item references
151+
aren’t supported.
150152
151153
Sometimes a question returns a refusal instead of an answer. The result has type
152154
`refusal` and includes the question’s name, or `null` if you didn’t give it one.
153155
154156
Args:
155157
input: The text or images to evaluate for every question. Provide a text string or user
156-
messages containing text and inline images. Images must be inline data URLs; at
157-
most 128 images are allowed across all messages in one request. External URLs,
158-
files, audio, tools, and item references are not supported.
158+
messages containing text and images. Images can be base64 data URLs or publicly
159+
accessible HTTP(S) URLs; at most 128 images are allowed across all messages in
160+
one request. Files, audio, tools, and item references are not supported.
159161
160162
safety_identifier: Opaque caller-provided end-user identifier, scoped by the verified org. Match
161163
Responses' limit; this is never the authenticated user identity.

‎src/openai/types/decision_create_params.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ class DecisionCreateParams(TypedDict, total=False):
2222
input: Required[Union[str, Iterable[DecisionInputMessageParam]]]
2323
"""The text or images to evaluate for every question.
2424
25-
Provide a text string or user messages containing text and inline images. Images
26-
must be inline data URLs; at most 128 images are allowed across all messages in
27-
one request. External URLs, files, audio, tools, and item references are not
28-
supported.
25+
Provide a text string or user messages containing text and images. Images can be
26+
base64 data URLs or publicly accessible HTTP(S) URLs; at most 128 images are
27+
allowed across all messages in one request. Files, audio, tools, and item
28+
references are not supported.
2929
"""
3030

3131
model: Required[str]

‎src/openai/types/decision_input_image_param.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@
99

1010

1111
class DecisionInputImageParam(TypedDict, total=False):
12-
"""An inline image. External URLs and file IDs are not supported."""
12+
"""An image provided as a base64 data URL or a publicly accessible HTTP(S) URL.
13+
14+
File IDs are not supported.
15+
"""
1316

1417
image_url: Required[str]
15-
"""A base64-encoded image in a data URL."""
18+
"""
19+
A base64-encoded image in a data URL or a publicly accessible HTTP(S) image URL.
20+
"""
1621

1722
type: Required[Literal["input_image"]]
1823

‎src/openai/types/decision_input_message_param.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212

1313
class DecisionInputMessageParam(TypedDict, total=False):
14-
"""A user message containing text or inline images."""
14+
"""A user message containing text or images."""
1515

1616
content: Required[Union[str, Iterable[DecisionInputPartUnionParam]]]
17-
"""Text evidence or an ordered list of text and inline image parts."""
17+
"""Text evidence or an ordered list of text and image parts."""
1818

1919
role: Required[Literal["user"]]
2020

‎src/openai/types/safety/safety_alert.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,9 @@ class SafetyAlert(BaseModel):
3939
"""
4040

4141
response_id: str
42+
43+
detailed_explanation: Optional[str] = None
44+
"""
45+
A generated explanation, temporarily available for eligible zero data retention
46+
alerts. Omitted when unavailable.
47+
"""

0 commit comments

Comments
 (0)