Skip to content

Commit 88a8036

Browse files
feat(api): manual updates
1 parent 48188cc commit 88a8036

File tree

12 files changed

+360
-52
lines changed

12 files changed

+360
-52
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 111
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-b2a451656ca64d30d174391ebfd94806b4de3ab76dc55b92843cfb7f1a54ecb6.yml
3-
openapi_spec_hash: 27d9691b400f28c17ef063a1374048b0
4-
config_hash: e822d0c9082c8b312264403949243179
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-721e6ccaa72205ee14c71f8163129920464fb814b95d3df9567a9476bbd9b7fb.yml
3+
openapi_spec_hash: 2115413a21df8b5bf9e4552a74df4312
4+
config_hash: 9606bb315a193bfd8da0459040143242

src/openai/resources/chat/completions/completions.py

Lines changed: 110 additions & 18 deletions
Large diffs are not rendered by default.

src/openai/resources/responses/responses.py

Lines changed: 110 additions & 18 deletions
Large diffs are not rendered by default.

src/openai/types/chat/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
from .chat_completion_store_message import ChatCompletionStoreMessage as ChatCompletionStoreMessage
2929
from .chat_completion_token_logprob import ChatCompletionTokenLogprob as ChatCompletionTokenLogprob
3030
from .chat_completion_reasoning_effort import ChatCompletionReasoningEffort as ChatCompletionReasoningEffort
31+
from .chat_completion_content_part_text import ChatCompletionContentPartText as ChatCompletionContentPartText
3132
from .chat_completion_message_tool_call import ChatCompletionMessageToolCall as ChatCompletionMessageToolCall
33+
from .chat_completion_content_part_image import ChatCompletionContentPartImage as ChatCompletionContentPartImage
3234
from .chat_completion_content_part_param import ChatCompletionContentPartParam as ChatCompletionContentPartParam
3335
from .chat_completion_tool_message_param import ChatCompletionToolMessageParam as ChatCompletionToolMessageParam
3436
from .chat_completion_user_message_param import ChatCompletionUserMessageParam as ChatCompletionUserMessageParam
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from typing_extensions import Literal
5+
6+
from ..._models import BaseModel
7+
8+
__all__ = ["ChatCompletionContentPartImage", "ImageURL"]
9+
10+
11+
class ImageURL(BaseModel):
12+
url: str
13+
"""Either a URL of the image or the base64 encoded image data."""
14+
15+
detail: Optional[Literal["auto", "low", "high"]] = None
16+
"""Specifies the detail level of the image.
17+
18+
Learn more in the
19+
[Vision guide](https://platform.openai.com/docs/guides/vision#low-or-high-fidelity-image-understanding).
20+
"""
21+
22+
23+
class ChatCompletionContentPartImage(BaseModel):
24+
image_url: ImageURL
25+
26+
type: Literal["image_url"]
27+
"""The type of the content part."""
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing_extensions import Literal
4+
5+
from ..._models import BaseModel
6+
7+
__all__ = ["ChatCompletionContentPartText"]
8+
9+
10+
class ChatCompletionContentPartText(BaseModel):
11+
text: str
12+
"""The text content."""
13+
14+
type: Literal["text"]
15+
"""The type of the content part."""
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from typing import List, Union, Optional
4+
from typing_extensions import TypeAlias
5+
36
from .chat_completion_message import ChatCompletionMessage
7+
from .chat_completion_content_part_text import ChatCompletionContentPartText
8+
from .chat_completion_content_part_image import ChatCompletionContentPartImage
9+
10+
__all__ = ["ChatCompletionStoreMessage", "ChatCompletionStoreMessageContentPart"]
411

5-
__all__ = ["ChatCompletionStoreMessage"]
12+
ChatCompletionStoreMessageContentPart: TypeAlias = Union[ChatCompletionContentPartText, ChatCompletionContentPartImage]
613

714

815
class ChatCompletionStoreMessage(ChatCompletionMessage):
916
id: str
1017
"""The identifier of the chat message."""
18+
19+
content_parts: Optional[List[ChatCompletionStoreMessageContentPart]] = None
20+
"""
21+
If a content parts array was provided, this is an array of `text` and
22+
`image_url` parts. Otherwise, null.
23+
"""

src/openai/types/chat/completion_create_params.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ class CompletionCreateParamsBase(TypedDict, total=False):
177177
far, increasing the model's likelihood to talk about new topics.
178178
"""
179179

180+
prompt_cache_key: str
181+
"""
182+
Used by OpenAI to cache responses for similar requests to optimize your cache
183+
hit rates. Replaces the `user` field.
184+
[Learn more](https://platform.openai.com/docs/guides/prompt-caching).
185+
"""
186+
180187
reasoning_effort: Optional[ReasoningEffort]
181188
"""**o-series models only**
182189
@@ -199,6 +206,15 @@ class CompletionCreateParamsBase(TypedDict, total=False):
199206
preferred for models that support it.
200207
"""
201208

209+
safety_identifier: str
210+
"""
211+
A stable identifier used to help detect users of your application that may be
212+
violating OpenAI's usage policies. The IDs should be a string that uniquely
213+
identifies each user. We recommend hashing their username or email address, in
214+
order to avoid sending us any identifying information.
215+
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
216+
"""
217+
202218
seed: Optional[int]
203219
"""
204220
This feature is in Beta. If specified, our system will make a best effort to
@@ -293,11 +309,12 @@ class CompletionCreateParamsBase(TypedDict, total=False):
293309
"""
294310

295311
user: str
296-
"""A stable identifier for your end-users.
312+
"""This field is being replaced by `safety_identifier` and `prompt_cache_key`.
297313
298-
Used to boost cache hit rates by better bucketing similar requests and to help
299-
OpenAI detect and prevent abuse.
300-
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
314+
Use `prompt_cache_key` instead to maintain caching optimizations. A stable
315+
identifier for your end-users. Used to boost cache hit rates by better bucketing
316+
similar requests and to help OpenAI detect and prevent abuse.
317+
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
301318
"""
302319

303320
web_search_options: WebSearchOptions

src/openai/types/responses/response.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,29 @@ class Response(BaseModel):
163163
[Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
164164
"""
165165

166+
prompt_cache_key: Optional[str] = None
167+
"""
168+
Used by OpenAI to cache responses for similar requests to optimize your cache
169+
hit rates. Replaces the `user` field.
170+
[Learn more](https://platform.openai.com/docs/guides/prompt-caching).
171+
"""
172+
166173
reasoning: Optional[Reasoning] = None
167174
"""**o-series models only**
168175
169176
Configuration options for
170177
[reasoning models](https://platform.openai.com/docs/guides/reasoning).
171178
"""
172179

180+
safety_identifier: Optional[str] = None
181+
"""
182+
A stable identifier used to help detect users of your application that may be
183+
violating OpenAI's usage policies. The IDs should be a string that uniquely
184+
identifies each user. We recommend hashing their username or email address, in
185+
order to avoid sending us any identifying information.
186+
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
187+
"""
188+
173189
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] = None
174190
"""Specifies the processing type used for serving the request.
175191
@@ -229,11 +245,12 @@ class Response(BaseModel):
229245
"""
230246

231247
user: Optional[str] = None
232-
"""A stable identifier for your end-users.
248+
"""This field is being replaced by `safety_identifier` and `prompt_cache_key`.
233249
234-
Used to boost cache hit rates by better bucketing similar requests and to help
235-
OpenAI detect and prevent abuse.
236-
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
250+
Use `prompt_cache_key` instead to maintain caching optimizations. A stable
251+
identifier for your end-users. Used to boost cache hit rates by better bucketing
252+
similar requests and to help OpenAI detect and prevent abuse.
253+
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
237254
"""
238255

239256
@property

src/openai/types/responses/response_create_params.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,29 @@ class ResponseCreateParamsBase(TypedDict, total=False):
123123
[Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
124124
"""
125125

126+
prompt_cache_key: str
127+
"""
128+
Used by OpenAI to cache responses for similar requests to optimize your cache
129+
hit rates. Replaces the `user` field.
130+
[Learn more](https://platform.openai.com/docs/guides/prompt-caching).
131+
"""
132+
126133
reasoning: Optional[Reasoning]
127134
"""**o-series models only**
128135
129136
Configuration options for
130137
[reasoning models](https://platform.openai.com/docs/guides/reasoning).
131138
"""
132139

140+
safety_identifier: str
141+
"""
142+
A stable identifier used to help detect users of your application that may be
143+
violating OpenAI's usage policies. The IDs should be a string that uniquely
144+
identifies each user. We recommend hashing their username or email address, in
145+
order to avoid sending us any identifying information.
146+
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
147+
"""
148+
133149
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]]
134150
"""Specifies the processing type used for serving the request.
135151
@@ -221,11 +237,12 @@ class ResponseCreateParamsBase(TypedDict, total=False):
221237
"""
222238

223239
user: str
224-
"""A stable identifier for your end-users.
240+
"""This field is being replaced by `safety_identifier` and `prompt_cache_key`.
225241
226-
Used to boost cache hit rates by better bucketing similar requests and to help
227-
OpenAI detect and prevent abuse.
228-
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
242+
Use `prompt_cache_key` instead to maintain caching optimizations. A stable
243+
identifier for your end-users. Used to boost cache hit rates by better bucketing
244+
similar requests and to help OpenAI detect and prevent abuse.
245+
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
229246
"""
230247

231248

0 commit comments

Comments
 (0)