Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/openai/lib/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def _build_request(
model = options.json_data.get("model")
if model is not None and "/deployments" not in str(self.base_url.path):
options.url = f"/deployments/{model}{options.url}"
# Remove model from request body for Azure deployments
# Azure uses URL-based routing, not body-based model specification
del options.json_data["model"]

return super()._build_request(options, retries_taken=retries_taken)

Expand Down
2 changes: 1 addition & 1 deletion src/openai/types/chat/completion_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class CompletionCreateParamsBase(TypedDict, total=False):
[Learn more](https://platform.openai.com/docs/guides/prompt-caching).
"""

prompt_cache_retention: Optional[Literal["in-memory", "24h"]]
prompt_cache_retention: Optional[Literal["in_memory", "24h"]]
"""The retention policy for the prompt cache.

Set to `24h` to enable extended prompt caching, which keeps cached prefixes
Expand Down
2 changes: 1 addition & 1 deletion src/openai/types/responses/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class Response(BaseModel):
[Learn more](https://platform.openai.com/docs/guides/prompt-caching).
"""

prompt_cache_retention: Optional[Literal["in-memory", "24h"]] = None
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] = None
"""The retention policy for the prompt cache.

Set to `24h` to enable extended prompt caching, which keeps cached prefixes
Expand Down
2 changes: 1 addition & 1 deletion src/openai/types/responses/response_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class ResponseCreateParamsBase(TypedDict, total=False):
[Learn more](https://platform.openai.com/docs/guides/prompt-caching).
"""

prompt_cache_retention: Optional[Literal["in-memory", "24h"]]
prompt_cache_retention: Optional[Literal["in_memory", "24h"]]
"""The retention policy for the prompt cache.

Set to `24h` to enable extended prompt caching, which keeps cached prefixes
Expand Down
2 changes: 1 addition & 1 deletion src/openai/types/responses/responses_client_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class ResponsesClientEvent(BaseModel):
[Learn more](https://platform.openai.com/docs/guides/prompt-caching).
"""

prompt_cache_retention: Optional[Literal["in-memory", "24h"]] = None
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] = None
"""The retention policy for the prompt cache.

Set to `24h` to enable extended prompt caching, which keeps cached prefixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class ResponsesClientEventParam(TypedDict, total=False):
[Learn more](https://platform.openai.com/docs/guides/prompt-caching).
"""

prompt_cache_retention: Optional[Literal["in-memory", "24h"]]
prompt_cache_retention: Optional[Literal["in_memory", "24h"]]
"""The retention policy for the prompt cache.

Set to `24h` to enable extended prompt caching, which keeps cached prefixes
Expand Down