Skip to content

Commit

Permalink
feat(api): add support for predicted outputs (#1172)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Nov 4, 2024
1 parent e0b675f commit 08a7bb4
Show file tree
Hide file tree
Showing 26 changed files with 133 additions and 80 deletions.
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-7b0a5d715d94f75ac7795bd4d2175a0e3243af9b935a86c273f371e45583140f.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-2f8ca92b9b1879fd535b685e4767338413fcd533d42f3baac13a9c41da3fce35.yml
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Types:
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionMessageToolCall</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionModality</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionNamedToolChoice</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionPredictionContent</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionRole</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionStreamOptions</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionSystemMessageParam</a></code>
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import {
ChatCompletionMessageToolCall,
ChatCompletionModality,
ChatCompletionNamedToolChoice,
ChatCompletionPredictionContent,
ChatCompletionRole,
ChatCompletionStreamOptions,
ChatCompletionSystemMessageParam,
Expand Down Expand Up @@ -379,6 +380,7 @@ export declare namespace OpenAI {
type ChatCompletionMessageToolCall as ChatCompletionMessageToolCall,
type ChatCompletionModality as ChatCompletionModality,
type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice,
type ChatCompletionPredictionContent as ChatCompletionPredictionContent,
type ChatCompletionRole as ChatCompletionRole,
type ChatCompletionStreamOptions as ChatCompletionStreamOptions,
type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam,
Expand Down
4 changes: 2 additions & 2 deletions src/resources/audio/speech.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface SpeechCreateParams {
input: string;

/**
* One of the available [TTS models](https://platform.openai.com/docs/models/tts):
* One of the available [TTS models](https://platform.openai.com/docs/models#tts):
* `tts-1` or `tts-1-hd`
*/
model: (string & {}) | SpeechModel;
Expand All @@ -31,7 +31,7 @@ export interface SpeechCreateParams {
* The voice to use when generating the audio. Supported voices are `alloy`,
* `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are
* available in the
* [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech/voice-options).
* [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
*/
voice: 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer';

Expand Down
2 changes: 1 addition & 1 deletion src/resources/audio/transcriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export interface TranscriptionCreateParams<
/**
* An optional text to guide the model's style or continue a previous audio
* segment. The
* [prompt](https://platform.openai.com/docs/guides/speech-to-text/prompting)
* [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
* should match the audio language.
*/
prompt?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/resources/audio/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export interface TranslationCreateParams<
/**
* An optional text to guide the model's style or continue a previous audio
* segment. The
* [prompt](https://platform.openai.com/docs/guides/speech-to-text/prompting)
* [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
* should be in English.
*/
prompt?: string;
Expand Down
36 changes: 18 additions & 18 deletions src/resources/beta/assistants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ export interface Assistant {
* ID of the model to use. You can use the
* [List models](https://platform.openai.com/docs/api-reference/models/list) API to
* see all of your available models, or see our
* [Model overview](https://platform.openai.com/docs/models/overview) for
* descriptions of them.
* [Model overview](https://platform.openai.com/docs/models) for descriptions of
* them.
*/
model: string;

Expand All @@ -145,8 +145,8 @@ export interface Assistant {

/**
* Specifies the format that the model must output. Compatible with
* [GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
* [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
* [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
Expand Down Expand Up @@ -620,7 +620,7 @@ export namespace AssistantStreamEvent {

/**
* Occurs when an
* [error](https://platform.openai.com/docs/guides/error-codes/api-errors) occurs.
* [error](https://platform.openai.com/docs/guides/error-codes#api-errors) occurs.
* This can happen due to an internal server error or a timeout.
*/
export interface ErrorEvent {
Expand Down Expand Up @@ -663,7 +663,7 @@ export namespace FileSearchTool {
*
* Note that the file search tool may output fewer than `max_num_results` results.
* See the
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
* for more information.
*/
max_num_results?: number;
Expand All @@ -673,7 +673,7 @@ export namespace FileSearchTool {
* will use the `auto` ranker and a score_threshold of 0.
*
* See the
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
* for more information.
*/
ranking_options?: FileSearch.RankingOptions;
Expand All @@ -685,7 +685,7 @@ export namespace FileSearchTool {
* will use the `auto` ranker and a score_threshold of 0.
*
* See the
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
* for more information.
*/
export interface RankingOptions {
Expand Down Expand Up @@ -1100,8 +1100,8 @@ export interface AssistantCreateParams {
* ID of the model to use. You can use the
* [List models](https://platform.openai.com/docs/api-reference/models/list) API to
* see all of your available models, or see our
* [Model overview](https://platform.openai.com/docs/models/overview) for
* descriptions of them.
* [Model overview](https://platform.openai.com/docs/models) for descriptions of
* them.
*/
model: (string & {}) | ChatAPI.ChatModel;

Expand Down Expand Up @@ -1131,8 +1131,8 @@ export interface AssistantCreateParams {

/**
* Specifies the format that the model must output. Compatible with
* [GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
* [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
* [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
Expand Down Expand Up @@ -1277,8 +1277,8 @@ export interface AssistantUpdateParams {
* ID of the model to use. You can use the
* [List models](https://platform.openai.com/docs/api-reference/models/list) API to
* see all of your available models, or see our
* [Model overview](https://platform.openai.com/docs/models/overview) for
* descriptions of them.
* [Model overview](https://platform.openai.com/docs/models) for descriptions of
* them.
*/
model?: string;

Expand All @@ -1289,8 +1289,8 @@ export interface AssistantUpdateParams {

/**
* Specifies the format that the model must output. Compatible with
* [GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
* [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
* [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
Expand Down Expand Up @@ -1383,8 +1383,8 @@ export interface AssistantListParams extends CursorPageParams {
/**
* A cursor for use in pagination. `before` is an object ID that defines your place
* in the list. For instance, if you make a list request and receive 100 objects,
* ending with obj_foo, your subsequent call can include before=obj_foo in order to
* fetch the previous page of the list.
* starting with obj_foo, your subsequent call can include before=obj_foo in order
* to fetch the previous page of the list.
*/
before?: string;

Expand Down
4 changes: 2 additions & 2 deletions src/resources/beta/threads/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,8 @@ export interface MessageListParams extends CursorPageParams {
/**
* A cursor for use in pagination. `before` is an object ID that defines your place
* in the list. For instance, if you make a list request and receive 100 objects,
* ending with obj_foo, your subsequent call can include before=obj_foo in order to
* fetch the previous page of the list.
* starting with obj_foo, your subsequent call can include before=obj_foo in order
* to fetch the previous page of the list.
*/
before?: string;

Expand Down
18 changes: 9 additions & 9 deletions src/resources/beta/threads/runs/runs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ export interface Run {

/**
* Whether to enable
* [parallel function calling](https://platform.openai.com/docs/guides/function-calling/parallel-function-calling)
* [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
* during tool use.
*/
parallel_tool_calls: boolean;
Expand All @@ -448,8 +448,8 @@ export interface Run {

/**
* Specifies the format that the model must output. Compatible with
* [GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
* [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
* [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
Expand Down Expand Up @@ -660,7 +660,7 @@ export interface RunCreateParamsBase {
* search result content.
*
* See the
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
* for more information.
*/
include?: Array<StepsAPI.RunStepInclude>;
Expand Down Expand Up @@ -721,15 +721,15 @@ export interface RunCreateParamsBase {

/**
* Body param: Whether to enable
* [parallel function calling](https://platform.openai.com/docs/guides/function-calling/parallel-function-calling)
* [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
* during tool use.
*/
parallel_tool_calls?: boolean;

/**
* Body param: Specifies the format that the model must output. Compatible with
* [GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
* [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
* [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
Expand Down Expand Up @@ -909,8 +909,8 @@ export interface RunListParams extends CursorPageParams {
/**
* A cursor for use in pagination. `before` is an object ID that defines your place
* in the list. For instance, if you make a list request and receive 100 objects,
* ending with obj_foo, your subsequent call can include before=obj_foo in order to
* fetch the previous page of the list.
* starting with obj_foo, your subsequent call can include before=obj_foo in order
* to fetch the previous page of the list.
*/
before?: string;

Expand Down
8 changes: 4 additions & 4 deletions src/resources/beta/threads/runs/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ export interface StepRetrieveParams {
* to fetch the file search result content.
*
* See the
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
* for more information.
*/
include?: Array<RunStepInclude>;
Expand All @@ -715,8 +715,8 @@ export interface StepListParams extends CursorPageParams {
/**
* A cursor for use in pagination. `before` is an object ID that defines your place
* in the list. For instance, if you make a list request and receive 100 objects,
* ending with obj_foo, your subsequent call can include before=obj_foo in order to
* fetch the previous page of the list.
* starting with obj_foo, your subsequent call can include before=obj_foo in order
* to fetch the previous page of the list.
*/
before?: string;

Expand All @@ -726,7 +726,7 @@ export interface StepListParams extends CursorPageParams {
* to fetch the file search result content.
*
* See the
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
* for more information.
*/
include?: Array<RunStepInclude>;
Expand Down
10 changes: 5 additions & 5 deletions src/resources/beta/threads/threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ export class Threads extends APIResource {

/**
* Specifies the format that the model must output. Compatible with
* [GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
* [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
* [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
Expand Down Expand Up @@ -565,15 +565,15 @@ export interface ThreadCreateAndRunParamsBase {

/**
* Whether to enable
* [parallel function calling](https://platform.openai.com/docs/guides/function-calling/parallel-function-calling)
* [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
* during tool use.
*/
parallel_tool_calls?: boolean;

/**
* Specifies the format that the model must output. Compatible with
* [GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
* [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
* [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
Expand Down
4 changes: 2 additions & 2 deletions src/resources/beta/vector-stores/file-batches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ export interface FileBatchListFilesParams extends CursorPageParams {
/**
* A cursor for use in pagination. `before` is an object ID that defines your place
* in the list. For instance, if you make a list request and receive 100 objects,
* ending with obj_foo, your subsequent call can include before=obj_foo in order to
* fetch the previous page of the list.
* starting with obj_foo, your subsequent call can include before=obj_foo in order
* to fetch the previous page of the list.
*/
before?: string;

Expand Down
4 changes: 2 additions & 2 deletions src/resources/beta/vector-stores/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ export interface FileListParams extends CursorPageParams {
/**
* A cursor for use in pagination. `before` is an object ID that defines your place
* in the list. For instance, if you make a list request and receive 100 objects,
* ending with obj_foo, your subsequent call can include before=obj_foo in order to
* fetch the previous page of the list.
* starting with obj_foo, your subsequent call can include before=obj_foo in order
* to fetch the previous page of the list.
*/
before?: string;

Expand Down
4 changes: 2 additions & 2 deletions src/resources/beta/vector-stores/vector-stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ export interface VectorStoreListParams extends CursorPageParams {
/**
* A cursor for use in pagination. `before` is an object ID that defines your place
* in the list. For instance, if you make a list request and receive 100 objects,
* ending with obj_foo, your subsequent call can include before=obj_foo in order to
* fetch the previous page of the list.
* starting with obj_foo, your subsequent call can include before=obj_foo in order
* to fetch the previous page of the list.
*/
before?: string;

Expand Down
2 changes: 2 additions & 0 deletions src/resources/chat/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
ChatCompletionMessageToolCall,
ChatCompletionModality,
ChatCompletionNamedToolChoice,
ChatCompletionPredictionContent,
ChatCompletionRole,
ChatCompletionStreamOptions,
ChatCompletionSystemMessageParam,
Expand Down Expand Up @@ -101,6 +102,7 @@ export declare namespace Chat {
type ChatCompletionMessageToolCall as ChatCompletionMessageToolCall,
type ChatCompletionModality as ChatCompletionModality,
type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice,
type ChatCompletionPredictionContent as ChatCompletionPredictionContent,
type ChatCompletionRole as ChatCompletionRole,
type ChatCompletionStreamOptions as ChatCompletionStreamOptions,
type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam,
Expand Down
Loading

0 comments on commit 08a7bb4

Please sign in to comment.