Skip to content

feat(api): updates #1608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2024
Merged
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
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 68
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b04761ffd2adad3cc19a6dc6fc696ac445878219972f891881a967340fa9a6b0.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-4097c2f86beb3f3bb021775cd1dfa240e960caf842aeefc2e08da4dc0851ea79.yml
13 changes: 11 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Shared Types

```python
from openai.types import ErrorObject, FunctionDefinition, FunctionParameters
from openai.types import (
ErrorObject,
FunctionDefinition,
FunctionParameters,
ResponseFormatJSONObject,
ResponseFormatJSONSchema,
ResponseFormatText,
)
```

# Completions
Expand Down Expand Up @@ -35,6 +42,7 @@ from openai.types.chat import (
ChatCompletionChunk,
ChatCompletionContentPart,
ChatCompletionContentPartImage,
ChatCompletionContentPartRefusal,
ChatCompletionContentPartText,
ChatCompletionFunctionCallOption,
ChatCompletionFunctionMessageParam,
Expand Down Expand Up @@ -288,7 +296,6 @@ Types:

```python
from openai.types.beta import (
AssistantResponseFormat,
AssistantResponseFormatOption,
AssistantToolChoice,
AssistantToolChoiceFunction,
Expand Down Expand Up @@ -381,6 +388,8 @@ from openai.types.beta.threads import (
MessageDeleted,
MessageDelta,
MessageDeltaEvent,
RefusalContentBlock,
RefusalDeltaBlock,
Text,
TextContentBlock,
TextContentBlockParam,
Expand Down
4 changes: 2 additions & 2 deletions src/openai/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def __init__(
@property
@override
def qs(self) -> Querystring:
return Querystring(array_format="comma")
return Querystring(array_format="brackets")

@property
@override
Expand Down Expand Up @@ -365,7 +365,7 @@ def __init__(
@property
@override
def qs(self) -> Querystring:
return Querystring(array_format="comma")
return Querystring(array_format="brackets")

@property
@override
Expand Down
20 changes: 20 additions & 0 deletions src/openai/resources/beta/assistants.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ def create(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -233,6 +238,11 @@ def update(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -453,6 +463,11 @@ async def create(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -598,6 +613,11 @@ async def update(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down
30 changes: 30 additions & 0 deletions src/openai/resources/beta/threads/runs/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ def create(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -264,6 +269,11 @@ def create(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -390,6 +400,11 @@ def create(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -924,6 +939,11 @@ async def create(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -1054,6 +1074,11 @@ async def create(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -1180,6 +1205,11 @@ async def create(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down
30 changes: 30 additions & 0 deletions src/openai/resources/beta/threads/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ def create_and_run(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -443,6 +448,11 @@ def create_and_run(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -568,6 +578,11 @@ def create_and_run(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -942,6 +957,11 @@ async def create_and_run(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -1071,6 +1091,11 @@ async def create_and_run(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down Expand Up @@ -1196,6 +1221,11 @@ async def create_and_run(
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
Outputs which guarantees the model will match your supplied JSON schema. Learn
more in the
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
message the model generates is valid JSON.

Expand Down
12 changes: 12 additions & 0 deletions src/openai/resources/chat/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def create(
[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)

response_format: An object specifying the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
[GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini),
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.

Expand Down Expand Up @@ -338,6 +340,8 @@ def create(
[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)

response_format: An object specifying the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
[GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini),
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.

Expand Down Expand Up @@ -527,6 +531,8 @@ def create(
[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)

response_format: An object specifying the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
[GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini),
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.

Expand Down Expand Up @@ -791,6 +797,8 @@ async def create(
[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)

response_format: An object specifying the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
[GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini),
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.

Expand Down Expand Up @@ -987,6 +995,8 @@ async def create(
[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)

response_format: An object specifying the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
[GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini),
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.

Expand Down Expand Up @@ -1176,6 +1186,8 @@ async def create(
[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)

response_format: An object specifying the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
[GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini),
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.

Expand Down
12 changes: 6 additions & 6 deletions src/openai/resources/fine_tuning/jobs/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def with_streaming_response(self) -> JobsWithStreamingResponse:
def create(
self,
*,
model: Union[str, Literal["babbage-002", "davinci-002", "gpt-3.5-turbo"]],
model: Union[str, Literal["babbage-002", "davinci-002", "gpt-3.5-turbo", "gpt-4o-mini"]],
training_file: str,
hyperparameters: job_create_params.Hyperparameters | NotGiven = NOT_GIVEN,
integrations: Optional[Iterable[job_create_params.Integration]] | NotGiven = NOT_GIVEN,
Expand All @@ -74,7 +74,7 @@ def create(

Args:
model: The name of the model to fine-tune. You can select one of the
[supported models](https://platform.openai.com/docs/guides/fine-tuning/what-models-can-be-fine-tuned).
[supported models](https://platform.openai.com/docs/guides/fine-tuning/which-models-can-be-fine-tuned).

training_file: The ID of an uploaded file that contains training data.

Expand Down Expand Up @@ -104,7 +104,7 @@ def create(
name.

For example, a `suffix` of "custom-model-name" would produce a model name like
`ft:gpt-3.5-turbo:openai:custom-model-name:7p4lURel`.
`ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`.

validation_file: The ID of an uploaded file that contains validation data.

Expand Down Expand Up @@ -329,7 +329,7 @@ def with_streaming_response(self) -> AsyncJobsWithStreamingResponse:
async def create(
self,
*,
model: Union[str, Literal["babbage-002", "davinci-002", "gpt-3.5-turbo"]],
model: Union[str, Literal["babbage-002", "davinci-002", "gpt-3.5-turbo", "gpt-4o-mini"]],
training_file: str,
hyperparameters: job_create_params.Hyperparameters | NotGiven = NOT_GIVEN,
integrations: Optional[Iterable[job_create_params.Integration]] | NotGiven = NOT_GIVEN,
Expand All @@ -354,7 +354,7 @@ async def create(

Args:
model: The name of the model to fine-tune. You can select one of the
[supported models](https://platform.openai.com/docs/guides/fine-tuning/what-models-can-be-fine-tuned).
[supported models](https://platform.openai.com/docs/guides/fine-tuning/which-models-can-be-fine-tuned).

training_file: The ID of an uploaded file that contains training data.

Expand Down Expand Up @@ -384,7 +384,7 @@ async def create(
name.

For example, a `suffix` of "custom-model-name" would produce a model name like
`ft:gpt-3.5-turbo:openai:custom-model-name:7p4lURel`.
`ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`.

validation_file: The ID of an uploaded file that contains validation data.

Expand Down
3 changes: 3 additions & 0 deletions src/openai/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
ErrorObject as ErrorObject,
FunctionDefinition as FunctionDefinition,
FunctionParameters as FunctionParameters,
ResponseFormatText as ResponseFormatText,
ResponseFormatJSONObject as ResponseFormatJSONObject,
ResponseFormatJSONSchema as ResponseFormatJSONSchema,
)
from .upload import Upload as Upload
from .embedding import Embedding as Embedding
Expand Down
Loading