Commit e6892165
Changed files (8)
src
openai
tests
api_resources
src/openai/resources/responses/responses.py
@@ -10,7 +10,7 @@ import httpx
from ... import _legacy_response
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
-from ..._utils import is_given, required_args, maybe_transform, async_maybe_transform
+from ..._utils import is_given, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
@@ -76,13 +76,13 @@ class Responses(SyncAPIResource):
def create(
self,
*,
- input: Union[str, ResponseInputParam],
- model: ResponsesModel,
background: Optional[bool] | NotGiven = NOT_GIVEN,
include: Optional[List[ResponseIncludable]] | NotGiven = NOT_GIVEN,
+ input: Union[str, ResponseInputParam] | NotGiven = NOT_GIVEN,
instructions: Optional[str] | NotGiven = NOT_GIVEN,
max_output_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
+ model: ResponsesModel | NotGiven = NOT_GIVEN,
parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN,
previous_response_id: Optional[str] | NotGiven = NOT_GIVEN,
prompt: Optional[ResponsePromptParam] | NotGiven = NOT_GIVEN,
@@ -119,22 +119,6 @@ class Responses(SyncAPIResource):
your own data as input for the model's response.
Args:
- input: Text, image, or file inputs to the model, used to generate a response.
-
- Learn more:
-
- - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
- - [Image inputs](https://platform.openai.com/docs/guides/images)
- - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
- - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
- - [Function calling](https://platform.openai.com/docs/guides/function-calling)
-
- model: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
- wide range of models with different capabilities, performance characteristics,
- and price points. Refer to the
- [model guide](https://platform.openai.com/docs/models) to browse and compare
- available models.
-
background: Whether to run the model response in the background.
[Learn more](https://platform.openai.com/docs/guides/background).
@@ -154,6 +138,16 @@ class Responses(SyncAPIResource):
- `code_interpreter_call.outputs`: Includes the outputs of python code execution
in code interpreter tool call items.
+ input: Text, image, or file inputs to the model, used to generate a response.
+
+ Learn more:
+
+ - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+ - [Image inputs](https://platform.openai.com/docs/guides/images)
+ - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
+ - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
+ - [Function calling](https://platform.openai.com/docs/guides/function-calling)
+
instructions: A system (or developer) message inserted into the model's context.
When using along with `previous_response_id`, the instructions from a previous
@@ -171,6 +165,12 @@ class Responses(SyncAPIResource):
Keys are strings with a maximum length of 64 characters. Values are strings with
a maximum length of 512 characters.
+ model: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
+ wide range of models with different capabilities, performance characteristics,
+ and price points. Refer to the
+ [model guide](https://platform.openai.com/docs/models) to browse and compare
+ available models.
+
parallel_tool_calls: Whether to allow the model to run tool calls in parallel.
previous_response_id: The unique ID of the previous response to the model. Use this to create
@@ -274,14 +274,14 @@ class Responses(SyncAPIResource):
def create(
self,
*,
- input: Union[str, ResponseInputParam],
- model: ResponsesModel,
stream: Literal[True],
background: Optional[bool] | NotGiven = NOT_GIVEN,
include: Optional[List[ResponseIncludable]] | NotGiven = NOT_GIVEN,
+ input: Union[str, ResponseInputParam] | NotGiven = NOT_GIVEN,
instructions: Optional[str] | NotGiven = NOT_GIVEN,
max_output_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
+ model: ResponsesModel | NotGiven = NOT_GIVEN,
parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN,
previous_response_id: Optional[str] | NotGiven = NOT_GIVEN,
prompt: Optional[ResponsePromptParam] | NotGiven = NOT_GIVEN,
@@ -317,22 +317,6 @@ class Responses(SyncAPIResource):
your own data as input for the model's response.
Args:
- input: Text, image, or file inputs to the model, used to generate a response.
-
- Learn more:
-
- - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
- - [Image inputs](https://platform.openai.com/docs/guides/images)
- - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
- - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
- - [Function calling](https://platform.openai.com/docs/guides/function-calling)
-
- model: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
- wide range of models with different capabilities, performance characteristics,
- and price points. Refer to the
- [model guide](https://platform.openai.com/docs/models) to browse and compare
- available models.
-
stream: If set to true, the model response data will be streamed to the client as it is
generated using
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
@@ -359,6 +343,16 @@ class Responses(SyncAPIResource):
- `code_interpreter_call.outputs`: Includes the outputs of python code execution
in code interpreter tool call items.
+ input: Text, image, or file inputs to the model, used to generate a response.
+
+ Learn more:
+
+ - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+ - [Image inputs](https://platform.openai.com/docs/guides/images)
+ - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
+ - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
+ - [Function calling](https://platform.openai.com/docs/guides/function-calling)
+
instructions: A system (or developer) message inserted into the model's context.
When using along with `previous_response_id`, the instructions from a previous
@@ -376,6 +370,12 @@ class Responses(SyncAPIResource):
Keys are strings with a maximum length of 64 characters. Values are strings with
a maximum length of 512 characters.
+ model: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
+ wide range of models with different capabilities, performance characteristics,
+ and price points. Refer to the
+ [model guide](https://platform.openai.com/docs/models) to browse and compare
+ available models.
+
parallel_tool_calls: Whether to allow the model to run tool calls in parallel.
previous_response_id: The unique ID of the previous response to the model. Use this to create
@@ -472,14 +472,14 @@ class Responses(SyncAPIResource):
def create(
self,
*,
- input: Union[str, ResponseInputParam],
- model: ResponsesModel,
stream: bool,
background: Optional[bool] | NotGiven = NOT_GIVEN,
include: Optional[List[ResponseIncludable]] | NotGiven = NOT_GIVEN,
+ input: Union[str, ResponseInputParam] | NotGiven = NOT_GIVEN,
instructions: Optional[str] | NotGiven = NOT_GIVEN,
max_output_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
+ model: ResponsesModel | NotGiven = NOT_GIVEN,
parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN,
previous_response_id: Optional[str] | NotGiven = NOT_GIVEN,
prompt: Optional[ResponsePromptParam] | NotGiven = NOT_GIVEN,
@@ -515,22 +515,6 @@ class Responses(SyncAPIResource):
your own data as input for the model's response.
Args:
- input: Text, image, or file inputs to the model, used to generate a response.
-
- Learn more:
-
- - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
- - [Image inputs](https://platform.openai.com/docs/guides/images)
- - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
- - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
- - [Function calling](https://platform.openai.com/docs/guides/function-calling)
-
- model: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
- wide range of models with different capabilities, performance characteristics,
- and price points. Refer to the
- [model guide](https://platform.openai.com/docs/models) to browse and compare
- available models.
-
stream: If set to true, the model response data will be streamed to the client as it is
generated using
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
@@ -557,6 +541,16 @@ class Responses(SyncAPIResource):
- `code_interpreter_call.outputs`: Includes the outputs of python code execution
in code interpreter tool call items.
+ input: Text, image, or file inputs to the model, used to generate a response.
+
+ Learn more:
+
+ - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+ - [Image inputs](https://platform.openai.com/docs/guides/images)
+ - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
+ - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
+ - [Function calling](https://platform.openai.com/docs/guides/function-calling)
+
instructions: A system (or developer) message inserted into the model's context.
When using along with `previous_response_id`, the instructions from a previous
@@ -574,6 +568,12 @@ class Responses(SyncAPIResource):
Keys are strings with a maximum length of 64 characters. Values are strings with
a maximum length of 512 characters.
+ model: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
+ wide range of models with different capabilities, performance characteristics,
+ and price points. Refer to the
+ [model guide](https://platform.openai.com/docs/models) to browse and compare
+ available models.
+
parallel_tool_calls: Whether to allow the model to run tool calls in parallel.
previous_response_id: The unique ID of the previous response to the model. Use this to create
@@ -666,17 +666,16 @@ class Responses(SyncAPIResource):
"""
...
- @required_args(["input", "model"], ["input", "model", "stream"])
def create(
self,
*,
- input: Union[str, ResponseInputParam],
- model: ResponsesModel,
background: Optional[bool] | NotGiven = NOT_GIVEN,
include: Optional[List[ResponseIncludable]] | NotGiven = NOT_GIVEN,
+ input: Union[str, ResponseInputParam] | NotGiven = NOT_GIVEN,
instructions: Optional[str] | NotGiven = NOT_GIVEN,
max_output_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
+ model: ResponsesModel | NotGiven = NOT_GIVEN,
parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN,
previous_response_id: Optional[str] | NotGiven = NOT_GIVEN,
prompt: Optional[ResponsePromptParam] | NotGiven = NOT_GIVEN,
@@ -702,13 +701,13 @@ class Responses(SyncAPIResource):
"/responses",
body=maybe_transform(
{
- "input": input,
- "model": model,
"background": background,
"include": include,
+ "input": input,
"instructions": instructions,
"max_output_tokens": max_output_tokens,
"metadata": metadata,
+ "model": model,
"parallel_tool_calls": parallel_tool_calls,
"previous_response_id": previous_response_id,
"prompt": prompt,
@@ -1295,13 +1294,13 @@ class AsyncResponses(AsyncAPIResource):
async def create(
self,
*,
- input: Union[str, ResponseInputParam],
- model: ResponsesModel,
background: Optional[bool] | NotGiven = NOT_GIVEN,
include: Optional[List[ResponseIncludable]] | NotGiven = NOT_GIVEN,
+ input: Union[str, ResponseInputParam] | NotGiven = NOT_GIVEN,
instructions: Optional[str] | NotGiven = NOT_GIVEN,
max_output_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
+ model: ResponsesModel | NotGiven = NOT_GIVEN,
parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN,
previous_response_id: Optional[str] | NotGiven = NOT_GIVEN,
prompt: Optional[ResponsePromptParam] | NotGiven = NOT_GIVEN,
@@ -1338,22 +1337,6 @@ class AsyncResponses(AsyncAPIResource):
your own data as input for the model's response.
Args:
- input: Text, image, or file inputs to the model, used to generate a response.
-
- Learn more:
-
- - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
- - [Image inputs](https://platform.openai.com/docs/guides/images)
- - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
- - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
- - [Function calling](https://platform.openai.com/docs/guides/function-calling)
-
- model: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
- wide range of models with different capabilities, performance characteristics,
- and price points. Refer to the
- [model guide](https://platform.openai.com/docs/models) to browse and compare
- available models.
-
background: Whether to run the model response in the background.
[Learn more](https://platform.openai.com/docs/guides/background).
@@ -1373,6 +1356,16 @@ class AsyncResponses(AsyncAPIResource):
- `code_interpreter_call.outputs`: Includes the outputs of python code execution
in code interpreter tool call items.
+ input: Text, image, or file inputs to the model, used to generate a response.
+
+ Learn more:
+
+ - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+ - [Image inputs](https://platform.openai.com/docs/guides/images)
+ - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
+ - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
+ - [Function calling](https://platform.openai.com/docs/guides/function-calling)
+
instructions: A system (or developer) message inserted into the model's context.
When using along with `previous_response_id`, the instructions from a previous
@@ -1390,6 +1383,12 @@ class AsyncResponses(AsyncAPIResource):
Keys are strings with a maximum length of 64 characters. Values are strings with
a maximum length of 512 characters.
+ model: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
+ wide range of models with different capabilities, performance characteristics,
+ and price points. Refer to the
+ [model guide](https://platform.openai.com/docs/models) to browse and compare
+ available models.
+
parallel_tool_calls: Whether to allow the model to run tool calls in parallel.
previous_response_id: The unique ID of the previous response to the model. Use this to create
@@ -1493,14 +1492,14 @@ class AsyncResponses(AsyncAPIResource):
async def create(
self,
*,
- input: Union[str, ResponseInputParam],
- model: ResponsesModel,
stream: Literal[True],
background: Optional[bool] | NotGiven = NOT_GIVEN,
include: Optional[List[ResponseIncludable]] | NotGiven = NOT_GIVEN,
+ input: Union[str, ResponseInputParam] | NotGiven = NOT_GIVEN,
instructions: Optional[str] | NotGiven = NOT_GIVEN,
max_output_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
+ model: ResponsesModel | NotGiven = NOT_GIVEN,
parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN,
previous_response_id: Optional[str] | NotGiven = NOT_GIVEN,
prompt: Optional[ResponsePromptParam] | NotGiven = NOT_GIVEN,
@@ -1536,22 +1535,6 @@ class AsyncResponses(AsyncAPIResource):
your own data as input for the model's response.
Args:
- input: Text, image, or file inputs to the model, used to generate a response.
-
- Learn more:
-
- - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
- - [Image inputs](https://platform.openai.com/docs/guides/images)
- - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
- - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
- - [Function calling](https://platform.openai.com/docs/guides/function-calling)
-
- model: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
- wide range of models with different capabilities, performance characteristics,
- and price points. Refer to the
- [model guide](https://platform.openai.com/docs/models) to browse and compare
- available models.
-
stream: If set to true, the model response data will be streamed to the client as it is
generated using
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
@@ -1578,6 +1561,16 @@ class AsyncResponses(AsyncAPIResource):
- `code_interpreter_call.outputs`: Includes the outputs of python code execution
in code interpreter tool call items.
+ input: Text, image, or file inputs to the model, used to generate a response.
+
+ Learn more:
+
+ - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+ - [Image inputs](https://platform.openai.com/docs/guides/images)
+ - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
+ - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
+ - [Function calling](https://platform.openai.com/docs/guides/function-calling)
+
instructions: A system (or developer) message inserted into the model's context.
When using along with `previous_response_id`, the instructions from a previous
@@ -1595,6 +1588,12 @@ class AsyncResponses(AsyncAPIResource):
Keys are strings with a maximum length of 64 characters. Values are strings with
a maximum length of 512 characters.
+ model: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
+ wide range of models with different capabilities, performance characteristics,
+ and price points. Refer to the
+ [model guide](https://platform.openai.com/docs/models) to browse and compare
+ available models.
+
parallel_tool_calls: Whether to allow the model to run tool calls in parallel.
previous_response_id: The unique ID of the previous response to the model. Use this to create
@@ -1691,14 +1690,14 @@ class AsyncResponses(AsyncAPIResource):
async def create(
self,
*,
- input: Union[str, ResponseInputParam],
- model: ResponsesModel,
stream: bool,
background: Optional[bool] | NotGiven = NOT_GIVEN,
include: Optional[List[ResponseIncludable]] | NotGiven = NOT_GIVEN,
+ input: Union[str, ResponseInputParam] | NotGiven = NOT_GIVEN,
instructions: Optional[str] | NotGiven = NOT_GIVEN,
max_output_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
+ model: ResponsesModel | NotGiven = NOT_GIVEN,
parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN,
previous_response_id: Optional[str] | NotGiven = NOT_GIVEN,
prompt: Optional[ResponsePromptParam] | NotGiven = NOT_GIVEN,
@@ -1734,22 +1733,6 @@ class AsyncResponses(AsyncAPIResource):
your own data as input for the model's response.
Args:
- input: Text, image, or file inputs to the model, used to generate a response.
-
- Learn more:
-
- - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
- - [Image inputs](https://platform.openai.com/docs/guides/images)
- - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
- - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
- - [Function calling](https://platform.openai.com/docs/guides/function-calling)
-
- model: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
- wide range of models with different capabilities, performance characteristics,
- and price points. Refer to the
- [model guide](https://platform.openai.com/docs/models) to browse and compare
- available models.
-
stream: If set to true, the model response data will be streamed to the client as it is
generated using
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
@@ -1776,6 +1759,16 @@ class AsyncResponses(AsyncAPIResource):
- `code_interpreter_call.outputs`: Includes the outputs of python code execution
in code interpreter tool call items.
+ input: Text, image, or file inputs to the model, used to generate a response.
+
+ Learn more:
+
+ - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+ - [Image inputs](https://platform.openai.com/docs/guides/images)
+ - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
+ - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
+ - [Function calling](https://platform.openai.com/docs/guides/function-calling)
+
instructions: A system (or developer) message inserted into the model's context.
When using along with `previous_response_id`, the instructions from a previous
@@ -1793,6 +1786,12 @@ class AsyncResponses(AsyncAPIResource):
Keys are strings with a maximum length of 64 characters. Values are strings with
a maximum length of 512 characters.
+ model: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
+ wide range of models with different capabilities, performance characteristics,
+ and price points. Refer to the
+ [model guide](https://platform.openai.com/docs/models) to browse and compare
+ available models.
+
parallel_tool_calls: Whether to allow the model to run tool calls in parallel.
previous_response_id: The unique ID of the previous response to the model. Use this to create
@@ -1885,17 +1884,16 @@ class AsyncResponses(AsyncAPIResource):
"""
...
- @required_args(["input", "model"], ["input", "model", "stream"])
async def create(
self,
*,
- input: Union[str, ResponseInputParam],
- model: ResponsesModel,
background: Optional[bool] | NotGiven = NOT_GIVEN,
include: Optional[List[ResponseIncludable]] | NotGiven = NOT_GIVEN,
+ input: Union[str, ResponseInputParam] | NotGiven = NOT_GIVEN,
instructions: Optional[str] | NotGiven = NOT_GIVEN,
max_output_tokens: Optional[int] | NotGiven = NOT_GIVEN,
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
+ model: ResponsesModel | NotGiven = NOT_GIVEN,
parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN,
previous_response_id: Optional[str] | NotGiven = NOT_GIVEN,
prompt: Optional[ResponsePromptParam] | NotGiven = NOT_GIVEN,
@@ -1921,13 +1919,13 @@ class AsyncResponses(AsyncAPIResource):
"/responses",
body=await async_maybe_transform(
{
- "input": input,
- "model": model,
"background": background,
"include": include,
+ "input": input,
"instructions": instructions,
"max_output_tokens": max_output_tokens,
"metadata": metadata,
+ "model": model,
"parallel_tool_calls": parallel_tool_calls,
"previous_response_id": previous_response_id,
"prompt": prompt,
src/openai/types/responses/response_create_params.py
@@ -26,27 +26,6 @@ __all__ = [
class ResponseCreateParamsBase(TypedDict, total=False):
- input: Required[Union[str, ResponseInputParam]]
- """Text, image, or file inputs to the model, used to generate a response.
-
- Learn more:
-
- - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
- - [Image inputs](https://platform.openai.com/docs/guides/images)
- - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
- - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
- - [Function calling](https://platform.openai.com/docs/guides/function-calling)
- """
-
- model: Required[ResponsesModel]
- """Model ID used to generate the response, like `gpt-4o` or `o3`.
-
- OpenAI offers a wide range of models with different capabilities, performance
- characteristics, and price points. Refer to the
- [model guide](https://platform.openai.com/docs/models) to browse and compare
- available models.
- """
-
background: Optional[bool]
"""Whether to run the model response in the background.
@@ -72,6 +51,18 @@ class ResponseCreateParamsBase(TypedDict, total=False):
in code interpreter tool call items.
"""
+ input: Union[str, ResponseInputParam]
+ """Text, image, or file inputs to the model, used to generate a response.
+
+ Learn more:
+
+ - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+ - [Image inputs](https://platform.openai.com/docs/guides/images)
+ - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
+ - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
+ - [Function calling](https://platform.openai.com/docs/guides/function-calling)
+ """
+
instructions: Optional[str]
"""A system (or developer) message inserted into the model's context.
@@ -97,6 +88,15 @@ class ResponseCreateParamsBase(TypedDict, total=False):
a maximum length of 512 characters.
"""
+ model: ResponsesModel
+ """Model ID used to generate the response, like `gpt-4o` or `o3`.
+
+ OpenAI offers a wide range of models with different capabilities, performance
+ characteristics, and price points. Refer to the
+ [model guide](https://platform.openai.com/docs/models) to browse and compare
+ available models.
+ """
+
parallel_tool_calls: Optional[bool]
"""Whether to allow the model to run tool calls in parallel."""
src/openai/_version.py
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "openai"
-__version__ = "1.89.0" # x-release-please-version
+__version__ = "1.90.0" # x-release-please-version
tests/api_resources/test_responses.py
@@ -21,22 +21,19 @@ class TestResponses:
@parametrize
def test_method_create_overload_1(self, client: OpenAI) -> None:
- response = client.responses.create(
- input="string",
- model="gpt-4o",
- )
+ response = client.responses.create()
assert_matches_type(Response, response, path=["response"])
@parametrize
def test_method_create_with_all_params_overload_1(self, client: OpenAI) -> None:
response = client.responses.create(
- input="string",
- model="gpt-4o",
background=True,
include=["file_search_call.results"],
+ input="string",
instructions="instructions",
max_output_tokens=0,
metadata={"foo": "string"},
+ model="gpt-4o",
parallel_tool_calls=True,
previous_response_id="previous_response_id",
prompt={
@@ -72,10 +69,7 @@ class TestResponses:
@parametrize
def test_raw_response_create_overload_1(self, client: OpenAI) -> None:
- http_response = client.responses.with_raw_response.create(
- input="string",
- model="gpt-4o",
- )
+ http_response = client.responses.with_raw_response.create()
assert http_response.is_closed is True
assert http_response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -84,10 +78,7 @@ class TestResponses:
@parametrize
def test_streaming_response_create_overload_1(self, client: OpenAI) -> None:
- with client.responses.with_streaming_response.create(
- input="string",
- model="gpt-4o",
- ) as http_response:
+ with client.responses.with_streaming_response.create() as http_response:
assert not http_response.is_closed
assert http_response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -99,8 +90,6 @@ class TestResponses:
@parametrize
def test_method_create_overload_2(self, client: OpenAI) -> None:
response_stream = client.responses.create(
- input="string",
- model="gpt-4o",
stream=True,
)
response_stream.response.close()
@@ -108,14 +97,14 @@ class TestResponses:
@parametrize
def test_method_create_with_all_params_overload_2(self, client: OpenAI) -> None:
response_stream = client.responses.create(
- input="string",
- model="gpt-4o",
stream=True,
background=True,
include=["file_search_call.results"],
+ input="string",
instructions="instructions",
max_output_tokens=0,
metadata={"foo": "string"},
+ model="gpt-4o",
parallel_tool_calls=True,
previous_response_id="previous_response_id",
prompt={
@@ -151,8 +140,6 @@ class TestResponses:
@parametrize
def test_raw_response_create_overload_2(self, client: OpenAI) -> None:
response = client.responses.with_raw_response.create(
- input="string",
- model="gpt-4o",
stream=True,
)
@@ -163,8 +150,6 @@ class TestResponses:
@parametrize
def test_streaming_response_create_overload_2(self, client: OpenAI) -> None:
with client.responses.with_streaming_response.create(
- input="string",
- model="gpt-4o",
stream=True,
) as response:
assert not response.is_closed
@@ -358,22 +343,19 @@ class TestAsyncResponses:
@parametrize
async def test_method_create_overload_1(self, async_client: AsyncOpenAI) -> None:
- response = await async_client.responses.create(
- input="string",
- model="gpt-4o",
- )
+ response = await async_client.responses.create()
assert_matches_type(Response, response, path=["response"])
@parametrize
async def test_method_create_with_all_params_overload_1(self, async_client: AsyncOpenAI) -> None:
response = await async_client.responses.create(
- input="string",
- model="gpt-4o",
background=True,
include=["file_search_call.results"],
+ input="string",
instructions="instructions",
max_output_tokens=0,
metadata={"foo": "string"},
+ model="gpt-4o",
parallel_tool_calls=True,
previous_response_id="previous_response_id",
prompt={
@@ -409,10 +391,7 @@ class TestAsyncResponses:
@parametrize
async def test_raw_response_create_overload_1(self, async_client: AsyncOpenAI) -> None:
- http_response = await async_client.responses.with_raw_response.create(
- input="string",
- model="gpt-4o",
- )
+ http_response = await async_client.responses.with_raw_response.create()
assert http_response.is_closed is True
assert http_response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -421,10 +400,7 @@ class TestAsyncResponses:
@parametrize
async def test_streaming_response_create_overload_1(self, async_client: AsyncOpenAI) -> None:
- async with async_client.responses.with_streaming_response.create(
- input="string",
- model="gpt-4o",
- ) as http_response:
+ async with async_client.responses.with_streaming_response.create() as http_response:
assert not http_response.is_closed
assert http_response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -436,8 +412,6 @@ class TestAsyncResponses:
@parametrize
async def test_method_create_overload_2(self, async_client: AsyncOpenAI) -> None:
response_stream = await async_client.responses.create(
- input="string",
- model="gpt-4o",
stream=True,
)
await response_stream.response.aclose()
@@ -445,14 +419,14 @@ class TestAsyncResponses:
@parametrize
async def test_method_create_with_all_params_overload_2(self, async_client: AsyncOpenAI) -> None:
response_stream = await async_client.responses.create(
- input="string",
- model="gpt-4o",
stream=True,
background=True,
include=["file_search_call.results"],
+ input="string",
instructions="instructions",
max_output_tokens=0,
metadata={"foo": "string"},
+ model="gpt-4o",
parallel_tool_calls=True,
previous_response_id="previous_response_id",
prompt={
@@ -488,8 +462,6 @@ class TestAsyncResponses:
@parametrize
async def test_raw_response_create_overload_2(self, async_client: AsyncOpenAI) -> None:
response = await async_client.responses.with_raw_response.create(
- input="string",
- model="gpt-4o",
stream=True,
)
@@ -500,8 +472,6 @@ class TestAsyncResponses:
@parametrize
async def test_streaming_response_create_overload_2(self, async_client: AsyncOpenAI) -> None:
async with async_client.responses.with_streaming_response.create(
- input="string",
- model="gpt-4o",
stream=True,
) as response:
assert not response.is_closed
.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "1.89.0"
+ ".": "1.90.0"
}
\ No newline at end of file
.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 111
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-9e41d2d5471d2c28bff0d616f4476f5b0e6c541ef4cb51bdaaef5fdf5e13c8b2.yml
-openapi_spec_hash: 86f765e18d00e32cf2ce9db7ab84d946
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f411a68f272b8be0ab0c266043da33228687b9b2d76896724e3cef797de9563d.yml
+openapi_spec_hash: 89bf866ea95ecfb3d76c8833237047d6
config_hash: dc5515e257676a27cb1ace1784aa92b3
CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 1.90.0 (2025-06-20)
+
+Full Changelog: [v1.89.0...v1.90.0](https://github.com/openai/openai-python/compare/v1.89.0...v1.90.0)
+
+### Features
+
+* **api:** make model and inputs not required to create response ([11bd62e](https://github.com/openai/openai-python/commit/11bd62eb7e46eec748edaf2e0cecf253ffc1202c))
+
## 1.89.0 (2025-06-20)
Full Changelog: [v1.88.0...v1.89.0](https://github.com/openai/openai-python/compare/v1.88.0...v1.89.0)
pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "openai"
-version = "1.89.0"
+version = "1.90.0"
description = "The official Python library for the openai API"
dynamic = ["readme"]
license = "Apache-2.0"