@ai-sdk/openai 4.0.0-beta.2 → 4.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +234 -22
- package/README.md +2 -0
- package/dist/index.d.mts +134 -35
- package/dist/index.d.ts +134 -35
- package/dist/index.js +1700 -1139
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1697 -1117
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +107 -41
- package/dist/internal/index.d.ts +107 -41
- package/dist/internal/index.js +1380 -939
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1371 -917
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +274 -9
- package/package.json +3 -5
- package/src/chat/convert-openai-chat-usage.ts +2 -2
- package/src/chat/convert-to-openai-chat-messages.ts +26 -15
- package/src/chat/map-openai-finish-reason.ts +2 -2
- package/src/chat/openai-chat-language-model.ts +32 -24
- package/src/chat/openai-chat-options.ts +5 -0
- package/src/chat/openai-chat-prepare-tools.ts +6 -6
- package/src/completion/convert-openai-completion-usage.ts +2 -2
- package/src/completion/convert-to-openai-completion-prompt.ts +2 -2
- package/src/completion/map-openai-finish-reason.ts +2 -2
- package/src/completion/openai-completion-language-model.ts +20 -20
- package/src/embedding/openai-embedding-model.ts +5 -5
- package/src/files/openai-files-api.ts +17 -0
- package/src/files/openai-files-options.ts +18 -0
- package/src/files/openai-files.ts +102 -0
- package/src/image/openai-image-model.ts +9 -9
- package/src/index.ts +2 -0
- package/src/openai-config.ts +5 -5
- package/src/openai-language-model-capabilities.ts +3 -2
- package/src/openai-provider.ts +39 -21
- package/src/openai-tools.ts +12 -1
- package/src/responses/convert-openai-responses-usage.ts +2 -2
- package/src/responses/convert-to-openai-responses-input.ts +188 -14
- package/src/responses/map-openai-responses-finish-reason.ts +2 -2
- package/src/responses/openai-responses-api.ts +136 -2
- package/src/responses/openai-responses-language-model.ts +233 -37
- package/src/responses/openai-responses-options.ts +24 -2
- package/src/responses/openai-responses-prepare-tools.ts +34 -9
- package/src/responses/openai-responses-provider-metadata.ts +10 -0
- package/src/speech/openai-speech-model.ts +7 -7
- package/src/tool/custom.ts +0 -6
- package/src/tool/tool-search.ts +98 -0
- package/src/transcription/openai-transcription-model.ts +8 -8
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as _ai_sdk_provider from '@ai-sdk/provider';
|
|
2
|
-
import {
|
|
2
|
+
import { JSONValue, ProviderV4, LanguageModelV4, EmbeddingModelV4, ImageModelV4, TranscriptionModelV4, SpeechModelV4, FilesV4 } from '@ai-sdk/provider';
|
|
3
3
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
4
4
|
import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
|
|
5
5
|
|
|
6
|
-
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | (string & {});
|
|
6
|
+
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | (string & {});
|
|
7
7
|
declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
8
8
|
logitBias?: Record<number, number> | undefined;
|
|
9
9
|
logprobs?: number | boolean | undefined;
|
|
@@ -141,7 +141,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWi
|
|
|
141
141
|
*/
|
|
142
142
|
timezone?: string;
|
|
143
143
|
};
|
|
144
|
-
}>;
|
|
144
|
+
}, {}>;
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* A filter used to compare a specified attribute key to a given value using a defined comparison operation.
|
|
@@ -206,6 +206,28 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
206
206
|
} | null | undefined;
|
|
207
207
|
service_tier?: string | null | undefined;
|
|
208
208
|
};
|
|
209
|
+
} | {
|
|
210
|
+
type: "response.failed";
|
|
211
|
+
response: {
|
|
212
|
+
error?: {
|
|
213
|
+
message: string;
|
|
214
|
+
code?: string | null | undefined;
|
|
215
|
+
} | null | undefined;
|
|
216
|
+
incomplete_details?: {
|
|
217
|
+
reason: string;
|
|
218
|
+
} | null | undefined;
|
|
219
|
+
usage?: {
|
|
220
|
+
input_tokens: number;
|
|
221
|
+
output_tokens: number;
|
|
222
|
+
input_tokens_details?: {
|
|
223
|
+
cached_tokens?: number | null | undefined;
|
|
224
|
+
} | null | undefined;
|
|
225
|
+
output_tokens_details?: {
|
|
226
|
+
reasoning_tokens?: number | null | undefined;
|
|
227
|
+
} | null | undefined;
|
|
228
|
+
} | null | undefined;
|
|
229
|
+
service_tier?: string | null | undefined;
|
|
230
|
+
};
|
|
209
231
|
} | {
|
|
210
232
|
type: "response.created";
|
|
211
233
|
response: {
|
|
@@ -300,6 +322,10 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
300
322
|
action: {
|
|
301
323
|
commands: string[];
|
|
302
324
|
};
|
|
325
|
+
} | {
|
|
326
|
+
type: "compaction";
|
|
327
|
+
id: string;
|
|
328
|
+
encrypted_content?: string | null | undefined;
|
|
303
329
|
} | {
|
|
304
330
|
type: "shell_call_output";
|
|
305
331
|
id: string;
|
|
@@ -315,6 +341,20 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
315
341
|
exit_code: number;
|
|
316
342
|
};
|
|
317
343
|
}[];
|
|
344
|
+
} | {
|
|
345
|
+
type: "tool_search_call";
|
|
346
|
+
id: string;
|
|
347
|
+
execution: "server" | "client";
|
|
348
|
+
call_id: string | null;
|
|
349
|
+
status: "completed" | "in_progress" | "incomplete";
|
|
350
|
+
arguments: unknown;
|
|
351
|
+
} | {
|
|
352
|
+
type: "tool_search_output";
|
|
353
|
+
id: string;
|
|
354
|
+
execution: "server" | "client";
|
|
355
|
+
call_id: string | null;
|
|
356
|
+
status: "completed" | "in_progress" | "incomplete";
|
|
357
|
+
tools: Record<string, JSONValue | undefined>[];
|
|
318
358
|
};
|
|
319
359
|
} | {
|
|
320
360
|
type: "response.output_item.done";
|
|
@@ -469,6 +509,10 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
469
509
|
action: {
|
|
470
510
|
commands: string[];
|
|
471
511
|
};
|
|
512
|
+
} | {
|
|
513
|
+
type: "compaction";
|
|
514
|
+
id: string;
|
|
515
|
+
encrypted_content: string;
|
|
472
516
|
} | {
|
|
473
517
|
type: "shell_call_output";
|
|
474
518
|
id: string;
|
|
@@ -484,6 +528,20 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
484
528
|
exit_code: number;
|
|
485
529
|
};
|
|
486
530
|
}[];
|
|
531
|
+
} | {
|
|
532
|
+
type: "tool_search_call";
|
|
533
|
+
id: string;
|
|
534
|
+
execution: "server" | "client";
|
|
535
|
+
call_id: string | null;
|
|
536
|
+
status: "completed" | "in_progress" | "incomplete";
|
|
537
|
+
arguments: unknown;
|
|
538
|
+
} | {
|
|
539
|
+
type: "tool_search_output";
|
|
540
|
+
id: string;
|
|
541
|
+
execution: "server" | "client";
|
|
542
|
+
call_id: string | null;
|
|
543
|
+
status: "completed" | "in_progress" | "incomplete";
|
|
544
|
+
tools: Record<string, JSONValue | undefined>[];
|
|
487
545
|
};
|
|
488
546
|
} | {
|
|
489
547
|
type: "response.function_call_arguments.delta";
|
|
@@ -575,10 +633,6 @@ type OpenAIResponsesLogprobs = NonNullable<(OpenAIResponsesChunk & {
|
|
|
575
633
|
})['logprobs']> | null;
|
|
576
634
|
|
|
577
635
|
declare const customToolFactory: _ai_sdk_provider_utils.ProviderToolFactory<string, {
|
|
578
|
-
/**
|
|
579
|
-
* The name of the custom tool, used to identify it in the API.
|
|
580
|
-
*/
|
|
581
|
-
name: string;
|
|
582
636
|
/**
|
|
583
637
|
* An optional description of what the tool does.
|
|
584
638
|
*/
|
|
@@ -594,7 +648,7 @@ declare const customToolFactory: _ai_sdk_provider_utils.ProviderToolFactory<stri
|
|
|
594
648
|
} | {
|
|
595
649
|
type: "text";
|
|
596
650
|
};
|
|
597
|
-
}>;
|
|
651
|
+
}, {}>;
|
|
598
652
|
|
|
599
653
|
/**
|
|
600
654
|
* Type definitions for the apply_patch operations.
|
|
@@ -641,17 +695,16 @@ declare const openaiTools: {
|
|
|
641
695
|
}, {
|
|
642
696
|
status: "completed" | "failed";
|
|
643
697
|
output?: string;
|
|
644
|
-
}, {}>;
|
|
698
|
+
}, {}, {}>;
|
|
645
699
|
/**
|
|
646
700
|
* Custom tools let callers constrain model output to a grammar (regex or
|
|
647
701
|
* Lark syntax). The model returns a `custom_tool_call` output item whose
|
|
648
702
|
* `input` field is a string matching the specified grammar.
|
|
649
703
|
*
|
|
650
|
-
* @param name - The name of the custom tool.
|
|
651
704
|
* @param description - An optional description of the tool.
|
|
652
705
|
* @param format - The output format constraint (grammar type, syntax, and definition).
|
|
653
706
|
*/
|
|
654
|
-
customTool: (args: Parameters<typeof customToolFactory>[0]) => _ai_sdk_provider_utils.Tool<string, unknown>;
|
|
707
|
+
customTool: (args: Parameters<typeof customToolFactory>[0]) => _ai_sdk_provider_utils.Tool<string, unknown, {}>;
|
|
655
708
|
/**
|
|
656
709
|
* The Code Interpreter tool allows models to write and run Python code in a
|
|
657
710
|
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
@@ -674,7 +727,7 @@ declare const openaiTools: {
|
|
|
674
727
|
type: "image";
|
|
675
728
|
url: string;
|
|
676
729
|
}> | null;
|
|
677
|
-
}>;
|
|
730
|
+
}, {}>;
|
|
678
731
|
/**
|
|
679
732
|
* File search is a tool available in the Responses API. It enables models to
|
|
680
733
|
* retrieve information in a knowledge base of previously uploaded files through
|
|
@@ -702,7 +755,7 @@ declare const openaiTools: {
|
|
|
702
755
|
scoreThreshold?: number;
|
|
703
756
|
};
|
|
704
757
|
filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
|
|
705
|
-
}>;
|
|
758
|
+
}, {}>;
|
|
706
759
|
/**
|
|
707
760
|
* The image generation tool allows you to generate images using a text prompt,
|
|
708
761
|
* and optionally image inputs. It leverages the GPT Image model,
|
|
@@ -735,7 +788,7 @@ declare const openaiTools: {
|
|
|
735
788
|
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
736
789
|
}) => _ai_sdk_provider_utils.Tool<{}, {
|
|
737
790
|
result: string;
|
|
738
|
-
}>;
|
|
791
|
+
}, {}>;
|
|
739
792
|
/**
|
|
740
793
|
* Local shell is a tool that allows agents to run shell commands locally
|
|
741
794
|
* on a machine you or the user provides.
|
|
@@ -753,7 +806,7 @@ declare const openaiTools: {
|
|
|
753
806
|
};
|
|
754
807
|
}, {
|
|
755
808
|
output: string;
|
|
756
|
-
}, {}>;
|
|
809
|
+
}, {}, {}>;
|
|
757
810
|
/**
|
|
758
811
|
* The shell tool allows the model to interact with your local computer through
|
|
759
812
|
* a controlled command-line interface. The model proposes shell commands; your
|
|
@@ -823,7 +876,7 @@ declare const openaiTools: {
|
|
|
823
876
|
path: string;
|
|
824
877
|
}>;
|
|
825
878
|
};
|
|
826
|
-
}>;
|
|
879
|
+
}, {}>;
|
|
827
880
|
/**
|
|
828
881
|
* Web search allows models to access up-to-date information from the internet
|
|
829
882
|
* and provide answers with sourced citations.
|
|
@@ -852,7 +905,7 @@ declare const openaiTools: {
|
|
|
852
905
|
region?: string;
|
|
853
906
|
timezone?: string;
|
|
854
907
|
};
|
|
855
|
-
}>;
|
|
908
|
+
}, {}>;
|
|
856
909
|
/**
|
|
857
910
|
* Web search allows models to access up-to-date information from the internet
|
|
858
911
|
* and provide answers with sourced citations.
|
|
@@ -880,7 +933,7 @@ declare const openaiTools: {
|
|
|
880
933
|
type: "api";
|
|
881
934
|
name: string;
|
|
882
935
|
}>;
|
|
883
|
-
}>;
|
|
936
|
+
}, {}>;
|
|
884
937
|
/**
|
|
885
938
|
* MCP (Model Context Protocol) allows models to call tools exposed by
|
|
886
939
|
* remote MCP servers or service connectors.
|
|
@@ -917,10 +970,34 @@ declare const openaiTools: {
|
|
|
917
970
|
arguments: string;
|
|
918
971
|
output?: string | null;
|
|
919
972
|
error?: _ai_sdk_provider.JSONValue;
|
|
920
|
-
}>;
|
|
973
|
+
}, {}>;
|
|
974
|
+
/**
|
|
975
|
+
* Tool search allows the model to dynamically search for and load deferred
|
|
976
|
+
* tools into the model's context as needed. This helps reduce overall token
|
|
977
|
+
* usage, cost, and latency by only loading tools when the model needs them.
|
|
978
|
+
*
|
|
979
|
+
* To use tool search, mark functions or namespaces with `defer_loading: true`
|
|
980
|
+
* in the tools array. The model will use tool search to load these tools
|
|
981
|
+
* when it determines they are needed.
|
|
982
|
+
*/
|
|
983
|
+
toolSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
984
|
+
arguments?: unknown;
|
|
985
|
+
call_id?: string | null;
|
|
986
|
+
}, {
|
|
987
|
+
tools: Array<_ai_sdk_provider.JSONObject>;
|
|
988
|
+
}, {
|
|
989
|
+
execution?: "server" | "client";
|
|
990
|
+
description?: string;
|
|
991
|
+
parameters?: Record<string, unknown>;
|
|
992
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
993
|
+
arguments?: unknown;
|
|
994
|
+
call_id?: string | null;
|
|
995
|
+
}, {
|
|
996
|
+
tools: Array<_ai_sdk_provider.JSONObject>;
|
|
997
|
+
}, {}>;
|
|
921
998
|
};
|
|
922
999
|
|
|
923
|
-
type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-
|
|
1000
|
+
type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
|
924
1001
|
declare const openaiLanguageModelResponsesOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
925
1002
|
conversation?: string | null | undefined;
|
|
926
1003
|
include?: ("file_search_call.results" | "message.output_text.logprobs" | "reasoning.encrypted_content")[] | null | undefined;
|
|
@@ -943,6 +1020,10 @@ declare const openaiLanguageModelResponsesOptionsSchema: _ai_sdk_provider_utils.
|
|
|
943
1020
|
user?: string | null | undefined;
|
|
944
1021
|
systemMessageMode?: "remove" | "system" | "developer" | undefined;
|
|
945
1022
|
forceReasoning?: boolean | undefined;
|
|
1023
|
+
contextManagement?: {
|
|
1024
|
+
type: "compaction";
|
|
1025
|
+
compactThreshold: number;
|
|
1026
|
+
}[] | null | undefined;
|
|
946
1027
|
}>;
|
|
947
1028
|
type OpenAILanguageModelResponsesOptions = InferSchema<typeof openaiLanguageModelResponsesOptionsSchema>;
|
|
948
1029
|
|
|
@@ -963,56 +1044,60 @@ declare const openAITranscriptionModelOptions: _ai_sdk_provider_utils.LazySchema
|
|
|
963
1044
|
}>;
|
|
964
1045
|
type OpenAITranscriptionModelOptions = InferSchema<typeof openAITranscriptionModelOptions>;
|
|
965
1046
|
|
|
966
|
-
interface OpenAIProvider extends
|
|
967
|
-
(modelId: OpenAIResponsesModelId):
|
|
1047
|
+
interface OpenAIProvider extends ProviderV4 {
|
|
1048
|
+
(modelId: OpenAIResponsesModelId): LanguageModelV4;
|
|
968
1049
|
/**
|
|
969
1050
|
* Creates an OpenAI model for text generation.
|
|
970
1051
|
*/
|
|
971
|
-
languageModel(modelId: OpenAIResponsesModelId):
|
|
1052
|
+
languageModel(modelId: OpenAIResponsesModelId): LanguageModelV4;
|
|
972
1053
|
/**
|
|
973
1054
|
* Creates an OpenAI chat model for text generation.
|
|
974
1055
|
*/
|
|
975
|
-
chat(modelId: OpenAIChatModelId):
|
|
1056
|
+
chat(modelId: OpenAIChatModelId): LanguageModelV4;
|
|
976
1057
|
/**
|
|
977
1058
|
* Creates an OpenAI responses API model for text generation.
|
|
978
1059
|
*/
|
|
979
|
-
responses(modelId: OpenAIResponsesModelId):
|
|
1060
|
+
responses(modelId: OpenAIResponsesModelId): LanguageModelV4;
|
|
980
1061
|
/**
|
|
981
1062
|
* Creates an OpenAI completion model for text generation.
|
|
982
1063
|
*/
|
|
983
|
-
completion(modelId: OpenAICompletionModelId):
|
|
1064
|
+
completion(modelId: OpenAICompletionModelId): LanguageModelV4;
|
|
984
1065
|
/**
|
|
985
1066
|
* Creates a model for text embeddings.
|
|
986
1067
|
*/
|
|
987
|
-
embedding(modelId: OpenAIEmbeddingModelId):
|
|
1068
|
+
embedding(modelId: OpenAIEmbeddingModelId): EmbeddingModelV4;
|
|
988
1069
|
/**
|
|
989
1070
|
* Creates a model for text embeddings.
|
|
990
1071
|
*/
|
|
991
|
-
embeddingModel(modelId: OpenAIEmbeddingModelId):
|
|
1072
|
+
embeddingModel(modelId: OpenAIEmbeddingModelId): EmbeddingModelV4;
|
|
992
1073
|
/**
|
|
993
1074
|
* @deprecated Use `embedding` instead.
|
|
994
1075
|
*/
|
|
995
|
-
textEmbedding(modelId: OpenAIEmbeddingModelId):
|
|
1076
|
+
textEmbedding(modelId: OpenAIEmbeddingModelId): EmbeddingModelV4;
|
|
996
1077
|
/**
|
|
997
1078
|
* @deprecated Use `embeddingModel` instead.
|
|
998
1079
|
*/
|
|
999
|
-
textEmbeddingModel(modelId: OpenAIEmbeddingModelId):
|
|
1080
|
+
textEmbeddingModel(modelId: OpenAIEmbeddingModelId): EmbeddingModelV4;
|
|
1000
1081
|
/**
|
|
1001
1082
|
* Creates a model for image generation.
|
|
1002
1083
|
*/
|
|
1003
|
-
image(modelId: OpenAIImageModelId):
|
|
1084
|
+
image(modelId: OpenAIImageModelId): ImageModelV4;
|
|
1004
1085
|
/**
|
|
1005
1086
|
* Creates a model for image generation.
|
|
1006
1087
|
*/
|
|
1007
|
-
imageModel(modelId: OpenAIImageModelId):
|
|
1088
|
+
imageModel(modelId: OpenAIImageModelId): ImageModelV4;
|
|
1008
1089
|
/**
|
|
1009
1090
|
* Creates a model for transcription.
|
|
1010
1091
|
*/
|
|
1011
|
-
transcription(modelId: OpenAITranscriptionModelId):
|
|
1092
|
+
transcription(modelId: OpenAITranscriptionModelId): TranscriptionModelV4;
|
|
1012
1093
|
/**
|
|
1013
1094
|
* Creates a model for speech generation.
|
|
1014
1095
|
*/
|
|
1015
|
-
speech(modelId: OpenAISpeechModelId):
|
|
1096
|
+
speech(modelId: OpenAISpeechModelId): SpeechModelV4;
|
|
1097
|
+
/**
|
|
1098
|
+
* Returns a FilesV4 interface for uploading files to OpenAI.
|
|
1099
|
+
*/
|
|
1100
|
+
files(): FilesV4;
|
|
1016
1101
|
/**
|
|
1017
1102
|
* OpenAI-specific tools.
|
|
1018
1103
|
*/
|
|
@@ -1058,6 +1143,12 @@ declare function createOpenAI(options?: OpenAIProviderSettings): OpenAIProvider;
|
|
|
1058
1143
|
*/
|
|
1059
1144
|
declare const openai: OpenAIProvider;
|
|
1060
1145
|
|
|
1146
|
+
declare const openaiFilesOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
1147
|
+
purpose?: string | undefined;
|
|
1148
|
+
expiresAfter?: number | undefined;
|
|
1149
|
+
}>;
|
|
1150
|
+
type OpenAIFilesOptions = InferSchema<typeof openaiFilesOptionsSchema>;
|
|
1151
|
+
|
|
1061
1152
|
type OpenaiResponsesChunk = InferSchema<typeof openaiResponsesChunkSchema>;
|
|
1062
1153
|
type ResponsesOutputTextAnnotationProviderMetadata = Extract<OpenaiResponsesChunk, {
|
|
1063
1154
|
type: 'response.output_text.annotation.added';
|
|
@@ -1077,6 +1168,14 @@ type OpenaiResponsesReasoningProviderMetadata = {
|
|
|
1077
1168
|
type OpenaiResponsesProviderMetadata = {
|
|
1078
1169
|
openai: ResponsesProviderMetadata;
|
|
1079
1170
|
};
|
|
1171
|
+
type ResponsesCompactionProviderMetadata = {
|
|
1172
|
+
type: 'compaction';
|
|
1173
|
+
itemId: string;
|
|
1174
|
+
encryptedContent?: string;
|
|
1175
|
+
};
|
|
1176
|
+
type OpenaiResponsesCompactionProviderMetadata = {
|
|
1177
|
+
openai: ResponsesCompactionProviderMetadata;
|
|
1178
|
+
};
|
|
1080
1179
|
type ResponsesTextProviderMetadata = {
|
|
1081
1180
|
itemId: string;
|
|
1082
1181
|
phase?: 'commentary' | 'final_answer' | null;
|
|
@@ -1104,4 +1203,4 @@ type OpenaiResponsesSourceDocumentProviderMetadata = {
|
|
|
1104
1203
|
|
|
1105
1204
|
declare const VERSION: string;
|
|
1106
1205
|
|
|
1107
|
-
export { type OpenAILanguageModelChatOptions as OpenAIChatLanguageModelOptions, type OpenAIEmbeddingModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, type OpenAILanguageModelResponsesOptions, type OpenAIProvider, type OpenAIProviderSettings, type OpenAILanguageModelResponsesOptions as OpenAIResponsesProviderOptions, type OpenAISpeechModelOptions, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, VERSION, createOpenAI, openai };
|
|
1206
|
+
export { type OpenAILanguageModelChatOptions as OpenAIChatLanguageModelOptions, type OpenAIEmbeddingModelOptions, type OpenAIFilesOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, type OpenAILanguageModelResponsesOptions, type OpenAIProvider, type OpenAIProviderSettings, type OpenAILanguageModelResponsesOptions as OpenAIResponsesProviderOptions, type OpenAISpeechModelOptions, type OpenAITranscriptionModelOptions, type OpenaiResponsesCompactionProviderMetadata, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, VERSION, createOpenAI, openai };
|