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
24 changes: 12 additions & 12 deletions src/openai/resources/chat/completions/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def parse(
prediction: Optional[ChatCompletionPredictionContentParam] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning_effort: Optional[ReasoningEffort] | Omit = omit,
safety_identifier: str | Omit = omit,
seed: Optional[int] | Omit = omit,
Expand Down Expand Up @@ -257,7 +257,7 @@ def create(
prediction: Optional[ChatCompletionPredictionContentParam] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning_effort: Optional[ReasoningEffort] | Omit = omit,
response_format: completion_create_params.ResponseFormat | Omit = omit,
safety_identifier: str | Omit = omit,
Expand Down Expand Up @@ -564,7 +564,7 @@ def create(
prediction: Optional[ChatCompletionPredictionContentParam] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning_effort: Optional[ReasoningEffort] | Omit = omit,
response_format: completion_create_params.ResponseFormat | Omit = omit,
safety_identifier: str | Omit = omit,
Expand Down Expand Up @@ -870,7 +870,7 @@ def create(
prediction: Optional[ChatCompletionPredictionContentParam] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning_effort: Optional[ReasoningEffort] | Omit = omit,
response_format: completion_create_params.ResponseFormat | Omit = omit,
safety_identifier: str | Omit = omit,
Expand Down Expand Up @@ -1175,7 +1175,7 @@ def create(
prediction: Optional[ChatCompletionPredictionContentParam] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning_effort: Optional[ReasoningEffort] | Omit = omit,
response_format: completion_create_params.ResponseFormat | Omit = omit,
safety_identifier: str | Omit = omit,
Expand Down Expand Up @@ -1454,7 +1454,7 @@ def stream(
prediction: Optional[ChatCompletionPredictionContentParam] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning_effort: Optional[ReasoningEffort] | Omit = omit,
safety_identifier: str | Omit = omit,
seed: Optional[int] | Omit = omit,
Expand Down Expand Up @@ -1598,7 +1598,7 @@ async def parse(
prediction: Optional[ChatCompletionPredictionContentParam] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning_effort: Optional[ReasoningEffort] | Omit = omit,
safety_identifier: str | Omit = omit,
seed: Optional[int] | Omit = omit,
Expand Down Expand Up @@ -1753,7 +1753,7 @@ async def create(
prediction: Optional[ChatCompletionPredictionContentParam] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning_effort: Optional[ReasoningEffort] | Omit = omit,
response_format: completion_create_params.ResponseFormat | Omit = omit,
safety_identifier: str | Omit = omit,
Expand Down Expand Up @@ -2060,7 +2060,7 @@ async def create(
prediction: Optional[ChatCompletionPredictionContentParam] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning_effort: Optional[ReasoningEffort] | Omit = omit,
response_format: completion_create_params.ResponseFormat | Omit = omit,
safety_identifier: str | Omit = omit,
Expand Down Expand Up @@ -2366,7 +2366,7 @@ async def create(
prediction: Optional[ChatCompletionPredictionContentParam] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning_effort: Optional[ReasoningEffort] | Omit = omit,
response_format: completion_create_params.ResponseFormat | Omit = omit,
safety_identifier: str | Omit = omit,
Expand Down Expand Up @@ -2671,7 +2671,7 @@ async def create(
prediction: Optional[ChatCompletionPredictionContentParam] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning_effort: Optional[ReasoningEffort] | Omit = omit,
response_format: completion_create_params.ResponseFormat | Omit = omit,
safety_identifier: str | Omit = omit,
Expand Down Expand Up @@ -2950,7 +2950,7 @@ def stream(
prediction: Optional[ChatCompletionPredictionContentParam] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning_effort: Optional[ReasoningEffort] | Omit = omit,
safety_identifier: str | Omit = omit,
seed: Optional[int] | Omit = omit,
Expand Down
32 changes: 16 additions & 16 deletions src/openai/resources/responses/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def create(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -377,7 +377,7 @@ def create(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -626,7 +626,7 @@ def create(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -873,7 +873,7 @@ def create(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -976,7 +976,7 @@ def stream(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -1017,7 +1017,7 @@ def stream(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -1168,7 +1168,7 @@ def parse(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -1788,7 +1788,7 @@ async def create(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -2038,7 +2038,7 @@ async def create(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -2287,7 +2287,7 @@ async def create(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -2534,7 +2534,7 @@ async def create(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -2637,7 +2637,7 @@ def stream(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -2678,7 +2678,7 @@ def stream(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -2833,7 +2833,7 @@ async def parse(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -3918,7 +3918,7 @@ def create(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
Expand Down Expand Up @@ -3998,7 +3998,7 @@ async def create(
previous_response_id: Optional[str] | Omit = omit,
prompt: Optional[ResponsePromptParam] | Omit = omit,
prompt_cache_key: str | Omit = omit,
prompt_cache_retention: Optional[Literal["in-memory", "24h"]] | Omit = omit,
prompt_cache_retention: Optional[Literal["in_memory", "24h"]] | Omit = omit,
reasoning: Optional[Reasoning] | Omit = omit,
safety_identifier: str | Omit = omit,
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
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
8 changes: 4 additions & 4 deletions tests/api_resources/chat/test_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_method_create_with_all_params_overload_1(self, client: OpenAI) -> None:
},
presence_penalty=-2,
prompt_cache_key="prompt-cache-key-1234",
prompt_cache_retention="in-memory",
prompt_cache_retention="in_memory",
reasoning_effort="none",
response_format={"type": "text"},
safety_identifier="safety-identifier-1234",
Expand Down Expand Up @@ -207,7 +207,7 @@ def test_method_create_with_all_params_overload_2(self, client: OpenAI) -> None:
},
presence_penalty=-2,
prompt_cache_key="prompt-cache-key-1234",
prompt_cache_retention="in-memory",
prompt_cache_retention="in_memory",
reasoning_effort="none",
response_format={"type": "text"},
safety_identifier="safety-identifier-1234",
Expand Down Expand Up @@ -516,7 +516,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
},
presence_penalty=-2,
prompt_cache_key="prompt-cache-key-1234",
prompt_cache_retention="in-memory",
prompt_cache_retention="in_memory",
reasoning_effort="none",
response_format={"type": "text"},
safety_identifier="safety-identifier-1234",
Expand Down Expand Up @@ -650,7 +650,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
},
presence_penalty=-2,
prompt_cache_key="prompt-cache-key-1234",
prompt_cache_retention="in-memory",
prompt_cache_retention="in_memory",
reasoning_effort="none",
response_format={"type": "text"},
safety_identifier="safety-identifier-1234",
Expand Down
Loading