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
48 changes: 48 additions & 0 deletions src/openai/resources/responses/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ def create(
store: Optional[bool] | Omit = omit,
stream: Optional[Literal[False]] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -403,6 +405,8 @@ def create(
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
store: Optional[bool] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -653,6 +657,8 @@ def create(
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
store: Optional[bool] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -902,6 +908,8 @@ def create(
store: Optional[bool] | Omit = omit,
stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -942,6 +950,8 @@ def create(
"store": store,
"stream": stream,
"stream_options": stream_options,
"frequency_penalty": frequency_penalty,
"presence_penalty": presence_penalty,
"temperature": temperature,
"text": text,
"tool_choice": tool_choice,
Expand Down Expand Up @@ -1008,6 +1018,8 @@ def stream(
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
store: Optional[bool] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -1049,6 +1061,8 @@ def stream(
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
store: Optional[bool] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -1084,6 +1098,8 @@ def stream(
"service_tier": service_tier,
"store": store,
"stream_options": stream_options,
"frequency_penalty": frequency_penalty,
"presence_penalty": presence_penalty,
"temperature": temperature,
"text": text,
"tool_choice": tool_choice,
Expand Down Expand Up @@ -1201,6 +1217,8 @@ def parse(
store: Optional[bool] | Omit = omit,
stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -1260,6 +1278,8 @@ def parser(raw_response: Response) -> ParsedResponse[TextFormatT]:
"store": store,
"stream": stream,
"stream_options": stream_options,
"frequency_penalty": frequency_penalty,
"presence_penalty": presence_penalty,
"temperature": temperature,
"text": text,
"tool_choice": tool_choice,
Expand Down Expand Up @@ -1859,6 +1879,8 @@ async def create(
store: Optional[bool] | Omit = omit,
stream: Optional[Literal[False]] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -2109,6 +2131,8 @@ async def create(
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
store: Optional[bool] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -2359,6 +2383,8 @@ async def create(
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
store: Optional[bool] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -2608,6 +2634,8 @@ async def create(
store: Optional[bool] | Omit = omit,
stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -2648,6 +2676,8 @@ async def create(
"store": store,
"stream": stream,
"stream_options": stream_options,
"frequency_penalty": frequency_penalty,
"presence_penalty": presence_penalty,
"temperature": temperature,
"text": text,
"tool_choice": tool_choice,
Expand Down Expand Up @@ -2714,6 +2744,8 @@ def stream(
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
store: Optional[bool] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -2755,6 +2787,8 @@ def stream(
service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] | Omit = omit,
store: Optional[bool] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -2790,6 +2824,8 @@ def stream(
"service_tier": service_tier,
"store": store,
"stream_options": stream_options,
"frequency_penalty": frequency_penalty,
"presence_penalty": presence_penalty,
"temperature": temperature,
"text": text,
"tool_choice": tool_choice,
Expand Down Expand Up @@ -2911,6 +2947,8 @@ async def parse(
store: Optional[bool] | Omit = omit,
stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
stream_options: Optional[response_create_params.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: response_create_params.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -2970,6 +3008,8 @@ def parser(raw_response: Response) -> ParsedResponse[TextFormatT]:
"store": store,
"stream": stream,
"stream_options": stream_options,
"frequency_penalty": frequency_penalty,
"presence_penalty": presence_penalty,
"temperature": temperature,
"text": text,
"tool_choice": tool_choice,
Expand Down Expand Up @@ -4608,6 +4648,8 @@ def create(
store: Optional[bool] | Omit = omit,
stream: Optional[bool] | Omit = omit,
stream_options: Optional[responses_client_event_param.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: responses_client_event_param.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -4644,6 +4686,8 @@ def create(
"store": store,
"stream": stream,
"stream_options": stream_options,
"frequency_penalty": frequency_penalty,
"presence_penalty": presence_penalty,
"temperature": temperature,
"text": text,
"tool_choice": tool_choice,
Expand Down Expand Up @@ -4688,6 +4732,8 @@ async def create(
store: Optional[bool] | Omit = omit,
stream: Optional[bool] | Omit = omit,
stream_options: Optional[responses_client_event_param.StreamOptions] | Omit = omit,
frequency_penalty: Optional[float] | Omit = omit,
presence_penalty: Optional[float] | Omit = omit,
temperature: Optional[float] | Omit = omit,
text: ResponseTextConfigParam | Omit = omit,
tool_choice: responses_client_event_param.ToolChoice | Omit = omit,
Expand Down Expand Up @@ -4724,6 +4770,8 @@ async def create(
"store": store,
"stream": stream,
"stream_options": stream_options,
"frequency_penalty": frequency_penalty,
"presence_penalty": presence_penalty,
"temperature": temperature,
"text": text,
"tool_choice": tool_choice,
Expand Down
14 changes: 14 additions & 0 deletions src/openai/types/responses/response_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,20 @@ class ResponseCreateParamsBase(TypedDict, total=False):
stream_options: Optional[StreamOptions]
"""Options for streaming responses. Only set this when you set `stream: true`."""

frequency_penalty: Optional[float]
"""Number between -2.0 and 2.0.
Positive values penalize new tokens based on their existing frequency in the
text so far, decreasing the model's likelihood to repeat the same line verbatim.
"""

presence_penalty: Optional[float]
"""Number between -2.0 and 2.0.
Positive values penalize new tokens based on whether they appear in the text so
far, increasing the model's likelihood to talk about new topics.
"""

temperature: Optional[float]
"""What sampling temperature to use, between 0 and 2.
Expand Down
14 changes: 14 additions & 0 deletions src/openai/types/responses/responses_client_event_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,20 @@ class ResponsesClientEventParam(TypedDict, total=False):
stream_options: Optional[StreamOptions]
"""Options for streaming responses. Only set this when you set `stream: true`."""

frequency_penalty: Optional[float]
"""Number between -2.0 and 2.0.

Positive values penalize new tokens based on their existing frequency in the
text so far, decreasing the model's likelihood to repeat the same line verbatim.
"""

presence_penalty: Optional[float]
"""Number between -2.0 and 2.0.

Positive values penalize new tokens based on whether they appear in the text so
far, increasing the model's likelihood to talk about new topics.
"""

temperature: Optional[float]
"""What sampling temperature to use, between 0 and 2.

Expand Down
8 changes: 8 additions & 0 deletions tests/api_resources/test_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def test_method_create_with_all_params_overload_1(self, client: OpenAI) -> None:
store=True,
stream=False,
stream_options={"include_obfuscation": True},
frequency_penalty=-2,
presence_penalty=-2,
temperature=1,
text={
"format": {"type": "text"},
Expand Down Expand Up @@ -150,6 +152,8 @@ def test_method_create_with_all_params_overload_2(self, client: OpenAI) -> None:
service_tier="auto",
store=True,
stream_options={"include_obfuscation": True},
frequency_penalty=-2,
presence_penalty=-2,
temperature=1,
text={
"format": {"type": "text"},
Expand Down Expand Up @@ -476,6 +480,8 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
store=True,
stream=False,
stream_options={"include_obfuscation": True},
frequency_penalty=-2,
presence_penalty=-2,
temperature=1,
text={
"format": {"type": "text"},
Expand Down Expand Up @@ -563,6 +569,8 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
service_tier="auto",
store=True,
stream_options={"include_obfuscation": True},
frequency_penalty=-2,
presence_penalty=-2,
temperature=1,
text={
"format": {"type": "text"},
Expand Down