@ai-sdk/openai 3.0.0-beta.73 → 3.0.0-beta.75
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 +12 -0
- package/dist/index.d.mts +55 -2
- package/dist/index.d.ts +55 -2
- package/dist/index.js +967 -789
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +933 -751
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +128 -2
- package/dist/internal/index.d.ts +128 -2
- package/dist/internal/index.js +910 -730
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +890 -711
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ __export(src_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(src_exports);
|
|
28
28
|
|
|
29
29
|
// src/openai-provider.ts
|
|
30
|
-
var
|
|
30
|
+
var import_provider_utils32 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/chat/openai-chat-language-model.ts
|
|
33
33
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -463,12 +463,6 @@ var openaiChatLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
463
463
|
* Parameters for prediction mode.
|
|
464
464
|
*/
|
|
465
465
|
prediction: import_v43.z.record(import_v43.z.string(), import_v43.z.any()).optional(),
|
|
466
|
-
/**
|
|
467
|
-
* Whether to use structured outputs.
|
|
468
|
-
*
|
|
469
|
-
* @default true
|
|
470
|
-
*/
|
|
471
|
-
structuredOutputs: import_v43.z.boolean().optional(),
|
|
472
466
|
/**
|
|
473
467
|
* Service tier for the request.
|
|
474
468
|
* - 'auto': Default service tier. The request will be processed with the service tier configured in the
|
|
@@ -483,7 +477,7 @@ var openaiChatLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
483
477
|
/**
|
|
484
478
|
* Whether to use strict JSON schema validation.
|
|
485
479
|
*
|
|
486
|
-
* @default
|
|
480
|
+
* @default true
|
|
487
481
|
*/
|
|
488
482
|
strictJsonSchema: import_v43.z.boolean().optional(),
|
|
489
483
|
/**
|
|
@@ -522,7 +516,6 @@ var import_provider2 = require("@ai-sdk/provider");
|
|
|
522
516
|
function prepareChatTools({
|
|
523
517
|
tools,
|
|
524
518
|
toolChoice,
|
|
525
|
-
structuredOutputs,
|
|
526
519
|
strictJsonSchema
|
|
527
520
|
}) {
|
|
528
521
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -540,7 +533,7 @@ function prepareChatTools({
|
|
|
540
533
|
name: tool.name,
|
|
541
534
|
description: tool.description,
|
|
542
535
|
parameters: tool.inputSchema,
|
|
543
|
-
strict:
|
|
536
|
+
strict: strictJsonSchema
|
|
544
537
|
}
|
|
545
538
|
});
|
|
546
539
|
break;
|
|
@@ -609,24 +602,16 @@ var OpenAIChatLanguageModel = class {
|
|
|
609
602
|
toolChoice,
|
|
610
603
|
providerOptions
|
|
611
604
|
}) {
|
|
612
|
-
var _a, _b, _c
|
|
605
|
+
var _a, _b, _c;
|
|
613
606
|
const warnings = [];
|
|
614
607
|
const openaiOptions = (_a = await (0, import_provider_utils5.parseProviderOptions)({
|
|
615
608
|
provider: "openai",
|
|
616
609
|
providerOptions,
|
|
617
610
|
schema: openaiChatLanguageModelOptions
|
|
618
611
|
})) != null ? _a : {};
|
|
619
|
-
const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
|
|
620
612
|
if (topK != null) {
|
|
621
613
|
warnings.push({ type: "unsupported", feature: "topK" });
|
|
622
614
|
}
|
|
623
|
-
if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !structuredOutputs) {
|
|
624
|
-
warnings.push({
|
|
625
|
-
type: "unsupported",
|
|
626
|
-
feature: "responseFormat",
|
|
627
|
-
details: "JSON response format schema is only supported with structuredOutputs"
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
615
|
const { messages, warnings: messageWarnings } = convertToOpenAIChatMessages(
|
|
631
616
|
{
|
|
632
617
|
prompt,
|
|
@@ -634,7 +619,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
634
619
|
}
|
|
635
620
|
);
|
|
636
621
|
warnings.push(...messageWarnings);
|
|
637
|
-
const strictJsonSchema = (
|
|
622
|
+
const strictJsonSchema = (_b = openaiOptions.strictJsonSchema) != null ? _b : true;
|
|
638
623
|
const baseArgs = {
|
|
639
624
|
// model id:
|
|
640
625
|
model: this.modelId,
|
|
@@ -650,12 +635,12 @@ var OpenAIChatLanguageModel = class {
|
|
|
650
635
|
top_p: topP,
|
|
651
636
|
frequency_penalty: frequencyPenalty,
|
|
652
637
|
presence_penalty: presencePenalty,
|
|
653
|
-
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ?
|
|
638
|
+
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? responseFormat.schema != null ? {
|
|
654
639
|
type: "json_schema",
|
|
655
640
|
json_schema: {
|
|
656
641
|
schema: responseFormat.schema,
|
|
657
642
|
strict: strictJsonSchema,
|
|
658
|
-
name: (
|
|
643
|
+
name: (_c = responseFormat.name) != null ? _c : "response",
|
|
659
644
|
description: responseFormat.description
|
|
660
645
|
}
|
|
661
646
|
} : { type: "json_object" } : void 0,
|
|
@@ -769,7 +754,6 @@ var OpenAIChatLanguageModel = class {
|
|
|
769
754
|
} = prepareChatTools({
|
|
770
755
|
tools,
|
|
771
756
|
toolChoice,
|
|
772
|
-
structuredOutputs,
|
|
773
757
|
strictJsonSchema
|
|
774
758
|
});
|
|
775
759
|
return {
|
|
@@ -1753,42 +1737,84 @@ var OpenAIImageModel = class {
|
|
|
1753
1737
|
}
|
|
1754
1738
|
};
|
|
1755
1739
|
|
|
1756
|
-
// src/tool/
|
|
1740
|
+
// src/tool/apply-patch.ts
|
|
1757
1741
|
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
1758
1742
|
var import_v49 = require("zod/v4");
|
|
1759
|
-
var
|
|
1743
|
+
var applyPatchInputSchema = (0, import_provider_utils14.lazySchema)(
|
|
1760
1744
|
() => (0, import_provider_utils14.zodSchema)(
|
|
1761
1745
|
import_v49.z.object({
|
|
1762
|
-
|
|
1763
|
-
|
|
1746
|
+
callId: import_v49.z.string(),
|
|
1747
|
+
operation: import_v49.z.discriminatedUnion("type", [
|
|
1748
|
+
import_v49.z.object({
|
|
1749
|
+
type: import_v49.z.literal("create_file"),
|
|
1750
|
+
path: import_v49.z.string(),
|
|
1751
|
+
diff: import_v49.z.string()
|
|
1752
|
+
}),
|
|
1753
|
+
import_v49.z.object({
|
|
1754
|
+
type: import_v49.z.literal("delete_file"),
|
|
1755
|
+
path: import_v49.z.string()
|
|
1756
|
+
}),
|
|
1757
|
+
import_v49.z.object({
|
|
1758
|
+
type: import_v49.z.literal("update_file"),
|
|
1759
|
+
path: import_v49.z.string(),
|
|
1760
|
+
diff: import_v49.z.string()
|
|
1761
|
+
})
|
|
1762
|
+
])
|
|
1764
1763
|
})
|
|
1765
1764
|
)
|
|
1766
1765
|
);
|
|
1767
|
-
var
|
|
1766
|
+
var applyPatchOutputSchema = (0, import_provider_utils14.lazySchema)(
|
|
1768
1767
|
() => (0, import_provider_utils14.zodSchema)(
|
|
1769
1768
|
import_v49.z.object({
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1769
|
+
status: import_v49.z.enum(["completed", "failed"]),
|
|
1770
|
+
output: import_v49.z.string().optional()
|
|
1771
|
+
})
|
|
1772
|
+
)
|
|
1773
|
+
);
|
|
1774
|
+
var applyPatchArgsSchema = (0, import_provider_utils14.lazySchema)(() => (0, import_provider_utils14.zodSchema)(import_v49.z.object({})));
|
|
1775
|
+
var applyPatchToolFactory = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
|
|
1776
|
+
id: "openai.apply_patch",
|
|
1777
|
+
inputSchema: applyPatchInputSchema,
|
|
1778
|
+
outputSchema: applyPatchOutputSchema
|
|
1779
|
+
});
|
|
1780
|
+
var applyPatch = () => applyPatchToolFactory({});
|
|
1781
|
+
|
|
1782
|
+
// src/tool/code-interpreter.ts
|
|
1783
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
1784
|
+
var import_v410 = require("zod/v4");
|
|
1785
|
+
var codeInterpreterInputSchema = (0, import_provider_utils15.lazySchema)(
|
|
1786
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
1787
|
+
import_v410.z.object({
|
|
1788
|
+
code: import_v410.z.string().nullish(),
|
|
1789
|
+
containerId: import_v410.z.string()
|
|
1790
|
+
})
|
|
1791
|
+
)
|
|
1792
|
+
);
|
|
1793
|
+
var codeInterpreterOutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
1794
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
1795
|
+
import_v410.z.object({
|
|
1796
|
+
outputs: import_v410.z.array(
|
|
1797
|
+
import_v410.z.discriminatedUnion("type", [
|
|
1798
|
+
import_v410.z.object({ type: import_v410.z.literal("logs"), logs: import_v410.z.string() }),
|
|
1799
|
+
import_v410.z.object({ type: import_v410.z.literal("image"), url: import_v410.z.string() })
|
|
1774
1800
|
])
|
|
1775
1801
|
).nullish()
|
|
1776
1802
|
})
|
|
1777
1803
|
)
|
|
1778
1804
|
);
|
|
1779
|
-
var codeInterpreterArgsSchema = (0,
|
|
1780
|
-
() => (0,
|
|
1781
|
-
|
|
1782
|
-
container:
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
fileIds:
|
|
1805
|
+
var codeInterpreterArgsSchema = (0, import_provider_utils15.lazySchema)(
|
|
1806
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
1807
|
+
import_v410.z.object({
|
|
1808
|
+
container: import_v410.z.union([
|
|
1809
|
+
import_v410.z.string(),
|
|
1810
|
+
import_v410.z.object({
|
|
1811
|
+
fileIds: import_v410.z.array(import_v410.z.string()).optional()
|
|
1786
1812
|
})
|
|
1787
1813
|
]).optional()
|
|
1788
1814
|
})
|
|
1789
1815
|
)
|
|
1790
1816
|
);
|
|
1791
|
-
var codeInterpreterToolFactory = (0,
|
|
1817
|
+
var codeInterpreterToolFactory = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
|
|
1792
1818
|
id: "openai.code_interpreter",
|
|
1793
1819
|
inputSchema: codeInterpreterInputSchema,
|
|
1794
1820
|
outputSchema: codeInterpreterOutputSchema
|
|
@@ -1798,81 +1824,81 @@ var codeInterpreter = (args = {}) => {
|
|
|
1798
1824
|
};
|
|
1799
1825
|
|
|
1800
1826
|
// src/tool/file-search.ts
|
|
1801
|
-
var
|
|
1802
|
-
var
|
|
1803
|
-
var comparisonFilterSchema =
|
|
1804
|
-
key:
|
|
1805
|
-
type:
|
|
1806
|
-
value:
|
|
1827
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
1828
|
+
var import_v411 = require("zod/v4");
|
|
1829
|
+
var comparisonFilterSchema = import_v411.z.object({
|
|
1830
|
+
key: import_v411.z.string(),
|
|
1831
|
+
type: import_v411.z.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
|
|
1832
|
+
value: import_v411.z.union([import_v411.z.string(), import_v411.z.number(), import_v411.z.boolean()])
|
|
1807
1833
|
});
|
|
1808
|
-
var compoundFilterSchema =
|
|
1809
|
-
type:
|
|
1810
|
-
filters:
|
|
1811
|
-
|
|
1834
|
+
var compoundFilterSchema = import_v411.z.object({
|
|
1835
|
+
type: import_v411.z.enum(["and", "or"]),
|
|
1836
|
+
filters: import_v411.z.array(
|
|
1837
|
+
import_v411.z.union([comparisonFilterSchema, import_v411.z.lazy(() => compoundFilterSchema)])
|
|
1812
1838
|
)
|
|
1813
1839
|
});
|
|
1814
|
-
var fileSearchArgsSchema = (0,
|
|
1815
|
-
() => (0,
|
|
1816
|
-
|
|
1817
|
-
vectorStoreIds:
|
|
1818
|
-
maxNumResults:
|
|
1819
|
-
ranking:
|
|
1820
|
-
ranker:
|
|
1821
|
-
scoreThreshold:
|
|
1840
|
+
var fileSearchArgsSchema = (0, import_provider_utils16.lazySchema)(
|
|
1841
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
1842
|
+
import_v411.z.object({
|
|
1843
|
+
vectorStoreIds: import_v411.z.array(import_v411.z.string()),
|
|
1844
|
+
maxNumResults: import_v411.z.number().optional(),
|
|
1845
|
+
ranking: import_v411.z.object({
|
|
1846
|
+
ranker: import_v411.z.string().optional(),
|
|
1847
|
+
scoreThreshold: import_v411.z.number().optional()
|
|
1822
1848
|
}).optional(),
|
|
1823
|
-
filters:
|
|
1849
|
+
filters: import_v411.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
1824
1850
|
})
|
|
1825
1851
|
)
|
|
1826
1852
|
);
|
|
1827
|
-
var fileSearchOutputSchema = (0,
|
|
1828
|
-
() => (0,
|
|
1829
|
-
|
|
1830
|
-
queries:
|
|
1831
|
-
results:
|
|
1832
|
-
|
|
1833
|
-
attributes:
|
|
1834
|
-
fileId:
|
|
1835
|
-
filename:
|
|
1836
|
-
score:
|
|
1837
|
-
text:
|
|
1853
|
+
var fileSearchOutputSchema = (0, import_provider_utils16.lazySchema)(
|
|
1854
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
1855
|
+
import_v411.z.object({
|
|
1856
|
+
queries: import_v411.z.array(import_v411.z.string()),
|
|
1857
|
+
results: import_v411.z.array(
|
|
1858
|
+
import_v411.z.object({
|
|
1859
|
+
attributes: import_v411.z.record(import_v411.z.string(), import_v411.z.unknown()),
|
|
1860
|
+
fileId: import_v411.z.string(),
|
|
1861
|
+
filename: import_v411.z.string(),
|
|
1862
|
+
score: import_v411.z.number(),
|
|
1863
|
+
text: import_v411.z.string()
|
|
1838
1864
|
})
|
|
1839
1865
|
).nullable()
|
|
1840
1866
|
})
|
|
1841
1867
|
)
|
|
1842
1868
|
);
|
|
1843
|
-
var fileSearch = (0,
|
|
1869
|
+
var fileSearch = (0, import_provider_utils16.createProviderToolFactoryWithOutputSchema)({
|
|
1844
1870
|
id: "openai.file_search",
|
|
1845
|
-
inputSchema:
|
|
1871
|
+
inputSchema: import_v411.z.object({}),
|
|
1846
1872
|
outputSchema: fileSearchOutputSchema
|
|
1847
1873
|
});
|
|
1848
1874
|
|
|
1849
1875
|
// src/tool/image-generation.ts
|
|
1850
|
-
var
|
|
1851
|
-
var
|
|
1852
|
-
var imageGenerationArgsSchema = (0,
|
|
1853
|
-
() => (0,
|
|
1854
|
-
|
|
1855
|
-
background:
|
|
1856
|
-
inputFidelity:
|
|
1857
|
-
inputImageMask:
|
|
1858
|
-
fileId:
|
|
1859
|
-
imageUrl:
|
|
1876
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
1877
|
+
var import_v412 = require("zod/v4");
|
|
1878
|
+
var imageGenerationArgsSchema = (0, import_provider_utils17.lazySchema)(
|
|
1879
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
1880
|
+
import_v412.z.object({
|
|
1881
|
+
background: import_v412.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
1882
|
+
inputFidelity: import_v412.z.enum(["low", "high"]).optional(),
|
|
1883
|
+
inputImageMask: import_v412.z.object({
|
|
1884
|
+
fileId: import_v412.z.string().optional(),
|
|
1885
|
+
imageUrl: import_v412.z.string().optional()
|
|
1860
1886
|
}).optional(),
|
|
1861
|
-
model:
|
|
1862
|
-
moderation:
|
|
1863
|
-
outputCompression:
|
|
1864
|
-
outputFormat:
|
|
1865
|
-
partialImages:
|
|
1866
|
-
quality:
|
|
1867
|
-
size:
|
|
1887
|
+
model: import_v412.z.string().optional(),
|
|
1888
|
+
moderation: import_v412.z.enum(["auto"]).optional(),
|
|
1889
|
+
outputCompression: import_v412.z.number().int().min(0).max(100).optional(),
|
|
1890
|
+
outputFormat: import_v412.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
1891
|
+
partialImages: import_v412.z.number().int().min(0).max(3).optional(),
|
|
1892
|
+
quality: import_v412.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
1893
|
+
size: import_v412.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
1868
1894
|
}).strict()
|
|
1869
1895
|
)
|
|
1870
1896
|
);
|
|
1871
|
-
var imageGenerationInputSchema = (0,
|
|
1872
|
-
var imageGenerationOutputSchema = (0,
|
|
1873
|
-
() => (0,
|
|
1897
|
+
var imageGenerationInputSchema = (0, import_provider_utils17.lazySchema)(() => (0, import_provider_utils17.zodSchema)(import_v412.z.object({})));
|
|
1898
|
+
var imageGenerationOutputSchema = (0, import_provider_utils17.lazySchema)(
|
|
1899
|
+
() => (0, import_provider_utils17.zodSchema)(import_v412.z.object({ result: import_v412.z.string() }))
|
|
1874
1900
|
);
|
|
1875
|
-
var imageGenerationToolFactory = (0,
|
|
1901
|
+
var imageGenerationToolFactory = (0, import_provider_utils17.createProviderToolFactoryWithOutputSchema)({
|
|
1876
1902
|
id: "openai.image_generation",
|
|
1877
1903
|
inputSchema: imageGenerationInputSchema,
|
|
1878
1904
|
outputSchema: imageGenerationOutputSchema
|
|
@@ -1882,91 +1908,39 @@ var imageGeneration = (args = {}) => {
|
|
|
1882
1908
|
};
|
|
1883
1909
|
|
|
1884
1910
|
// src/tool/local-shell.ts
|
|
1885
|
-
var
|
|
1886
|
-
var
|
|
1887
|
-
var localShellInputSchema = (0,
|
|
1888
|
-
() => (0,
|
|
1889
|
-
|
|
1890
|
-
action:
|
|
1891
|
-
type:
|
|
1892
|
-
command:
|
|
1893
|
-
timeoutMs:
|
|
1894
|
-
user:
|
|
1895
|
-
workingDirectory:
|
|
1896
|
-
env:
|
|
1911
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
1912
|
+
var import_v413 = require("zod/v4");
|
|
1913
|
+
var localShellInputSchema = (0, import_provider_utils18.lazySchema)(
|
|
1914
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
1915
|
+
import_v413.z.object({
|
|
1916
|
+
action: import_v413.z.object({
|
|
1917
|
+
type: import_v413.z.literal("exec"),
|
|
1918
|
+
command: import_v413.z.array(import_v413.z.string()),
|
|
1919
|
+
timeoutMs: import_v413.z.number().optional(),
|
|
1920
|
+
user: import_v413.z.string().optional(),
|
|
1921
|
+
workingDirectory: import_v413.z.string().optional(),
|
|
1922
|
+
env: import_v413.z.record(import_v413.z.string(), import_v413.z.string()).optional()
|
|
1897
1923
|
})
|
|
1898
1924
|
})
|
|
1899
1925
|
)
|
|
1900
1926
|
);
|
|
1901
|
-
var localShellOutputSchema = (0,
|
|
1902
|
-
() => (0,
|
|
1927
|
+
var localShellOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
1928
|
+
() => (0, import_provider_utils18.zodSchema)(import_v413.z.object({ output: import_v413.z.string() }))
|
|
1903
1929
|
);
|
|
1904
|
-
var localShell = (0,
|
|
1930
|
+
var localShell = (0, import_provider_utils18.createProviderToolFactoryWithOutputSchema)({
|
|
1905
1931
|
id: "openai.local_shell",
|
|
1906
1932
|
inputSchema: localShellInputSchema,
|
|
1907
1933
|
outputSchema: localShellOutputSchema
|
|
1908
1934
|
});
|
|
1909
1935
|
|
|
1910
1936
|
// src/tool/web-search.ts
|
|
1911
|
-
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
1912
|
-
var import_v413 = require("zod/v4");
|
|
1913
|
-
var webSearchArgsSchema = (0, import_provider_utils18.lazySchema)(
|
|
1914
|
-
() => (0, import_provider_utils18.zodSchema)(
|
|
1915
|
-
import_v413.z.object({
|
|
1916
|
-
externalWebAccess: import_v413.z.boolean().optional(),
|
|
1917
|
-
filters: import_v413.z.object({ allowedDomains: import_v413.z.array(import_v413.z.string()).optional() }).optional(),
|
|
1918
|
-
searchContextSize: import_v413.z.enum(["low", "medium", "high"]).optional(),
|
|
1919
|
-
userLocation: import_v413.z.object({
|
|
1920
|
-
type: import_v413.z.literal("approximate"),
|
|
1921
|
-
country: import_v413.z.string().optional(),
|
|
1922
|
-
city: import_v413.z.string().optional(),
|
|
1923
|
-
region: import_v413.z.string().optional(),
|
|
1924
|
-
timezone: import_v413.z.string().optional()
|
|
1925
|
-
}).optional()
|
|
1926
|
-
})
|
|
1927
|
-
)
|
|
1928
|
-
);
|
|
1929
|
-
var webSearchInputSchema = (0, import_provider_utils18.lazySchema)(() => (0, import_provider_utils18.zodSchema)(import_v413.z.object({})));
|
|
1930
|
-
var webSearchOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
1931
|
-
() => (0, import_provider_utils18.zodSchema)(
|
|
1932
|
-
import_v413.z.object({
|
|
1933
|
-
action: import_v413.z.discriminatedUnion("type", [
|
|
1934
|
-
import_v413.z.object({
|
|
1935
|
-
type: import_v413.z.literal("search"),
|
|
1936
|
-
query: import_v413.z.string().optional()
|
|
1937
|
-
}),
|
|
1938
|
-
import_v413.z.object({
|
|
1939
|
-
type: import_v413.z.literal("openPage"),
|
|
1940
|
-
url: import_v413.z.string()
|
|
1941
|
-
}),
|
|
1942
|
-
import_v413.z.object({
|
|
1943
|
-
type: import_v413.z.literal("find"),
|
|
1944
|
-
url: import_v413.z.string(),
|
|
1945
|
-
pattern: import_v413.z.string()
|
|
1946
|
-
})
|
|
1947
|
-
]),
|
|
1948
|
-
sources: import_v413.z.array(
|
|
1949
|
-
import_v413.z.discriminatedUnion("type", [
|
|
1950
|
-
import_v413.z.object({ type: import_v413.z.literal("url"), url: import_v413.z.string() }),
|
|
1951
|
-
import_v413.z.object({ type: import_v413.z.literal("api"), name: import_v413.z.string() })
|
|
1952
|
-
])
|
|
1953
|
-
).optional()
|
|
1954
|
-
})
|
|
1955
|
-
)
|
|
1956
|
-
);
|
|
1957
|
-
var webSearchToolFactory = (0, import_provider_utils18.createProviderToolFactoryWithOutputSchema)({
|
|
1958
|
-
id: "openai.web_search",
|
|
1959
|
-
inputSchema: webSearchInputSchema,
|
|
1960
|
-
outputSchema: webSearchOutputSchema
|
|
1961
|
-
});
|
|
1962
|
-
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
1963
|
-
|
|
1964
|
-
// src/tool/web-search-preview.ts
|
|
1965
1937
|
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
1966
1938
|
var import_v414 = require("zod/v4");
|
|
1967
|
-
var
|
|
1939
|
+
var webSearchArgsSchema = (0, import_provider_utils19.lazySchema)(
|
|
1968
1940
|
() => (0, import_provider_utils19.zodSchema)(
|
|
1969
1941
|
import_v414.z.object({
|
|
1942
|
+
externalWebAccess: import_v414.z.boolean().optional(),
|
|
1943
|
+
filters: import_v414.z.object({ allowedDomains: import_v414.z.array(import_v414.z.string()).optional() }).optional(),
|
|
1970
1944
|
searchContextSize: import_v414.z.enum(["low", "medium", "high"]).optional(),
|
|
1971
1945
|
userLocation: import_v414.z.object({
|
|
1972
1946
|
type: import_v414.z.literal("approximate"),
|
|
@@ -1978,10 +1952,8 @@ var webSearchPreviewArgsSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
1978
1952
|
})
|
|
1979
1953
|
)
|
|
1980
1954
|
);
|
|
1981
|
-
var
|
|
1982
|
-
|
|
1983
|
-
);
|
|
1984
|
-
var webSearchPreviewOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
1955
|
+
var webSearchInputSchema = (0, import_provider_utils19.lazySchema)(() => (0, import_provider_utils19.zodSchema)(import_v414.z.object({})));
|
|
1956
|
+
var webSearchOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
1985
1957
|
() => (0, import_provider_utils19.zodSchema)(
|
|
1986
1958
|
import_v414.z.object({
|
|
1987
1959
|
action: import_v414.z.discriminatedUnion("type", [
|
|
@@ -1998,43 +1970,97 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
1998
1970
|
url: import_v414.z.string(),
|
|
1999
1971
|
pattern: import_v414.z.string()
|
|
2000
1972
|
})
|
|
1973
|
+
]),
|
|
1974
|
+
sources: import_v414.z.array(
|
|
1975
|
+
import_v414.z.discriminatedUnion("type", [
|
|
1976
|
+
import_v414.z.object({ type: import_v414.z.literal("url"), url: import_v414.z.string() }),
|
|
1977
|
+
import_v414.z.object({ type: import_v414.z.literal("api"), name: import_v414.z.string() })
|
|
1978
|
+
])
|
|
1979
|
+
).optional()
|
|
1980
|
+
})
|
|
1981
|
+
)
|
|
1982
|
+
);
|
|
1983
|
+
var webSearchToolFactory = (0, import_provider_utils19.createProviderToolFactoryWithOutputSchema)({
|
|
1984
|
+
id: "openai.web_search",
|
|
1985
|
+
inputSchema: webSearchInputSchema,
|
|
1986
|
+
outputSchema: webSearchOutputSchema
|
|
1987
|
+
});
|
|
1988
|
+
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
1989
|
+
|
|
1990
|
+
// src/tool/web-search-preview.ts
|
|
1991
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
1992
|
+
var import_v415 = require("zod/v4");
|
|
1993
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
1994
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
1995
|
+
import_v415.z.object({
|
|
1996
|
+
searchContextSize: import_v415.z.enum(["low", "medium", "high"]).optional(),
|
|
1997
|
+
userLocation: import_v415.z.object({
|
|
1998
|
+
type: import_v415.z.literal("approximate"),
|
|
1999
|
+
country: import_v415.z.string().optional(),
|
|
2000
|
+
city: import_v415.z.string().optional(),
|
|
2001
|
+
region: import_v415.z.string().optional(),
|
|
2002
|
+
timezone: import_v415.z.string().optional()
|
|
2003
|
+
}).optional()
|
|
2004
|
+
})
|
|
2005
|
+
)
|
|
2006
|
+
);
|
|
2007
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2008
|
+
() => (0, import_provider_utils20.zodSchema)(import_v415.z.object({}))
|
|
2009
|
+
);
|
|
2010
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2011
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2012
|
+
import_v415.z.object({
|
|
2013
|
+
action: import_v415.z.discriminatedUnion("type", [
|
|
2014
|
+
import_v415.z.object({
|
|
2015
|
+
type: import_v415.z.literal("search"),
|
|
2016
|
+
query: import_v415.z.string().optional()
|
|
2017
|
+
}),
|
|
2018
|
+
import_v415.z.object({
|
|
2019
|
+
type: import_v415.z.literal("openPage"),
|
|
2020
|
+
url: import_v415.z.string()
|
|
2021
|
+
}),
|
|
2022
|
+
import_v415.z.object({
|
|
2023
|
+
type: import_v415.z.literal("find"),
|
|
2024
|
+
url: import_v415.z.string(),
|
|
2025
|
+
pattern: import_v415.z.string()
|
|
2026
|
+
})
|
|
2001
2027
|
])
|
|
2002
2028
|
})
|
|
2003
2029
|
)
|
|
2004
2030
|
);
|
|
2005
|
-
var webSearchPreview = (0,
|
|
2031
|
+
var webSearchPreview = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchema)({
|
|
2006
2032
|
id: "openai.web_search_preview",
|
|
2007
2033
|
inputSchema: webSearchPreviewInputSchema,
|
|
2008
2034
|
outputSchema: webSearchPreviewOutputSchema
|
|
2009
2035
|
});
|
|
2010
2036
|
|
|
2011
2037
|
// src/tool/mcp.ts
|
|
2012
|
-
var
|
|
2013
|
-
var
|
|
2014
|
-
var jsonValueSchema =
|
|
2015
|
-
() =>
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2038
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2039
|
+
var import_v416 = require("zod/v4");
|
|
2040
|
+
var jsonValueSchema = import_v416.z.lazy(
|
|
2041
|
+
() => import_v416.z.union([
|
|
2042
|
+
import_v416.z.string(),
|
|
2043
|
+
import_v416.z.number(),
|
|
2044
|
+
import_v416.z.boolean(),
|
|
2045
|
+
import_v416.z.null(),
|
|
2046
|
+
import_v416.z.array(jsonValueSchema),
|
|
2047
|
+
import_v416.z.record(import_v416.z.string(), jsonValueSchema)
|
|
2022
2048
|
])
|
|
2023
2049
|
);
|
|
2024
|
-
var mcpArgsSchema = (0,
|
|
2025
|
-
() => (0,
|
|
2026
|
-
|
|
2027
|
-
serverLabel:
|
|
2028
|
-
allowedTools:
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
readOnly:
|
|
2032
|
-
toolNames:
|
|
2050
|
+
var mcpArgsSchema = (0, import_provider_utils21.lazySchema)(
|
|
2051
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2052
|
+
import_v416.z.object({
|
|
2053
|
+
serverLabel: import_v416.z.string(),
|
|
2054
|
+
allowedTools: import_v416.z.union([
|
|
2055
|
+
import_v416.z.array(import_v416.z.string()),
|
|
2056
|
+
import_v416.z.object({
|
|
2057
|
+
readOnly: import_v416.z.boolean().optional(),
|
|
2058
|
+
toolNames: import_v416.z.array(import_v416.z.string()).optional()
|
|
2033
2059
|
})
|
|
2034
2060
|
]).optional(),
|
|
2035
|
-
authorization:
|
|
2036
|
-
connectorId:
|
|
2037
|
-
headers:
|
|
2061
|
+
authorization: import_v416.z.string().optional(),
|
|
2062
|
+
connectorId: import_v416.z.string().optional(),
|
|
2063
|
+
headers: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional(),
|
|
2038
2064
|
// TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
|
|
2039
2065
|
// requireApproval: z
|
|
2040
2066
|
// .union([
|
|
@@ -2045,50 +2071,50 @@ var mcpArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
2045
2071
|
// }),
|
|
2046
2072
|
// ])
|
|
2047
2073
|
// .optional(),
|
|
2048
|
-
serverDescription:
|
|
2049
|
-
serverUrl:
|
|
2074
|
+
serverDescription: import_v416.z.string().optional(),
|
|
2075
|
+
serverUrl: import_v416.z.string().optional()
|
|
2050
2076
|
}).refine(
|
|
2051
2077
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
2052
2078
|
"One of serverUrl or connectorId must be provided."
|
|
2053
2079
|
)
|
|
2054
2080
|
)
|
|
2055
2081
|
);
|
|
2056
|
-
var mcpInputSchema = (0,
|
|
2057
|
-
var mcpOutputSchema = (0,
|
|
2058
|
-
() => (0,
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
type:
|
|
2062
|
-
serverLabel:
|
|
2063
|
-
name:
|
|
2064
|
-
arguments:
|
|
2065
|
-
output:
|
|
2066
|
-
error:
|
|
2082
|
+
var mcpInputSchema = (0, import_provider_utils21.lazySchema)(() => (0, import_provider_utils21.zodSchema)(import_v416.z.object({})));
|
|
2083
|
+
var mcpOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2084
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2085
|
+
import_v416.z.discriminatedUnion("type", [
|
|
2086
|
+
import_v416.z.object({
|
|
2087
|
+
type: import_v416.z.literal("call"),
|
|
2088
|
+
serverLabel: import_v416.z.string(),
|
|
2089
|
+
name: import_v416.z.string(),
|
|
2090
|
+
arguments: import_v416.z.string(),
|
|
2091
|
+
output: import_v416.z.string().nullable().optional(),
|
|
2092
|
+
error: import_v416.z.union([import_v416.z.string(), jsonValueSchema]).optional()
|
|
2067
2093
|
}),
|
|
2068
|
-
|
|
2069
|
-
type:
|
|
2070
|
-
serverLabel:
|
|
2071
|
-
tools:
|
|
2072
|
-
|
|
2073
|
-
name:
|
|
2074
|
-
description:
|
|
2094
|
+
import_v416.z.object({
|
|
2095
|
+
type: import_v416.z.literal("listTools"),
|
|
2096
|
+
serverLabel: import_v416.z.string(),
|
|
2097
|
+
tools: import_v416.z.array(
|
|
2098
|
+
import_v416.z.object({
|
|
2099
|
+
name: import_v416.z.string(),
|
|
2100
|
+
description: import_v416.z.string().optional(),
|
|
2075
2101
|
inputSchema: jsonValueSchema,
|
|
2076
|
-
annotations:
|
|
2102
|
+
annotations: import_v416.z.record(import_v416.z.string(), jsonValueSchema).optional()
|
|
2077
2103
|
})
|
|
2078
2104
|
),
|
|
2079
|
-
error:
|
|
2105
|
+
error: import_v416.z.union([import_v416.z.string(), jsonValueSchema]).optional()
|
|
2080
2106
|
}),
|
|
2081
|
-
|
|
2082
|
-
type:
|
|
2083
|
-
serverLabel:
|
|
2084
|
-
name:
|
|
2085
|
-
arguments:
|
|
2086
|
-
approvalRequestId:
|
|
2107
|
+
import_v416.z.object({
|
|
2108
|
+
type: import_v416.z.literal("approvalRequest"),
|
|
2109
|
+
serverLabel: import_v416.z.string(),
|
|
2110
|
+
name: import_v416.z.string(),
|
|
2111
|
+
arguments: import_v416.z.string(),
|
|
2112
|
+
approvalRequestId: import_v416.z.string()
|
|
2087
2113
|
})
|
|
2088
2114
|
])
|
|
2089
2115
|
)
|
|
2090
2116
|
);
|
|
2091
|
-
var mcpToolFactory = (0,
|
|
2117
|
+
var mcpToolFactory = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
|
|
2092
2118
|
id: "openai.mcp",
|
|
2093
2119
|
inputSchema: mcpInputSchema,
|
|
2094
2120
|
outputSchema: mcpOutputSchema
|
|
@@ -2097,6 +2123,14 @@ var mcp = (args) => mcpToolFactory(args);
|
|
|
2097
2123
|
|
|
2098
2124
|
// src/openai-tools.ts
|
|
2099
2125
|
var openaiTools = {
|
|
2126
|
+
/**
|
|
2127
|
+
* The apply_patch tool lets GPT-5.1 create, update, and delete files in your
|
|
2128
|
+
* codebase using structured diffs. Instead of just suggesting edits, the model
|
|
2129
|
+
* emits patch operations that your application applies and then reports back on,
|
|
2130
|
+
* enabling iterative, multi-step code editing workflows.
|
|
2131
|
+
*
|
|
2132
|
+
*/
|
|
2133
|
+
applyPatch,
|
|
2100
2134
|
/**
|
|
2101
2135
|
* The Code Interpreter tool allows models to write and run Python code in a
|
|
2102
2136
|
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
@@ -2175,12 +2209,12 @@ var openaiTools = {
|
|
|
2175
2209
|
|
|
2176
2210
|
// src/responses/openai-responses-language-model.ts
|
|
2177
2211
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2178
|
-
var
|
|
2212
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
2179
2213
|
|
|
2180
2214
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2181
2215
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2182
|
-
var
|
|
2183
|
-
var
|
|
2216
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2217
|
+
var import_v417 = require("zod/v4");
|
|
2184
2218
|
function isFileId(data, prefixes) {
|
|
2185
2219
|
if (!prefixes) return false;
|
|
2186
2220
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2191,7 +2225,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2191
2225
|
systemMessageMode,
|
|
2192
2226
|
fileIdPrefixes,
|
|
2193
2227
|
store,
|
|
2194
|
-
hasLocalShellTool = false
|
|
2228
|
+
hasLocalShellTool = false,
|
|
2229
|
+
hasApplyPatchTool = false
|
|
2195
2230
|
}) {
|
|
2196
2231
|
var _a, _b, _c, _d, _e;
|
|
2197
2232
|
const input = [];
|
|
@@ -2239,7 +2274,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2239
2274
|
return {
|
|
2240
2275
|
type: "input_image",
|
|
2241
2276
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2242
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2277
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2243
2278
|
},
|
|
2244
2279
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
|
|
2245
2280
|
};
|
|
@@ -2254,7 +2289,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2254
2289
|
type: "input_file",
|
|
2255
2290
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2256
2291
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2257
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2292
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2258
2293
|
}
|
|
2259
2294
|
};
|
|
2260
2295
|
} else {
|
|
@@ -2298,7 +2333,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2298
2333
|
part.toolName
|
|
2299
2334
|
);
|
|
2300
2335
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2301
|
-
const parsedInput = await (0,
|
|
2336
|
+
const parsedInput = await (0, import_provider_utils22.validateTypes)({
|
|
2302
2337
|
value: part.input,
|
|
2303
2338
|
schema: localShellInputSchema
|
|
2304
2339
|
});
|
|
@@ -2339,7 +2374,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2339
2374
|
break;
|
|
2340
2375
|
}
|
|
2341
2376
|
case "reasoning": {
|
|
2342
|
-
const providerOptions = await (0,
|
|
2377
|
+
const providerOptions = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2343
2378
|
provider: "openai",
|
|
2344
2379
|
providerOptions: part.providerOptions,
|
|
2345
2380
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2403,7 +2438,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2403
2438
|
part.toolName
|
|
2404
2439
|
);
|
|
2405
2440
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2406
|
-
const parsedOutput = await (0,
|
|
2441
|
+
const parsedOutput = await (0, import_provider_utils22.validateTypes)({
|
|
2407
2442
|
value: output.value,
|
|
2408
2443
|
schema: localShellOutputSchema
|
|
2409
2444
|
});
|
|
@@ -2414,6 +2449,19 @@ async function convertToOpenAIResponsesInput({
|
|
|
2414
2449
|
});
|
|
2415
2450
|
break;
|
|
2416
2451
|
}
|
|
2452
|
+
if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
|
|
2453
|
+
const parsedOutput = await (0, import_provider_utils22.validateTypes)({
|
|
2454
|
+
value: output.value,
|
|
2455
|
+
schema: applyPatchOutputSchema
|
|
2456
|
+
});
|
|
2457
|
+
input.push({
|
|
2458
|
+
type: "apply_patch_call_output",
|
|
2459
|
+
call_id: part.toolCallId,
|
|
2460
|
+
status: parsedOutput.status,
|
|
2461
|
+
output: parsedOutput.output
|
|
2462
|
+
});
|
|
2463
|
+
break;
|
|
2464
|
+
}
|
|
2417
2465
|
let contentValue;
|
|
2418
2466
|
switch (output.type) {
|
|
2419
2467
|
case "text":
|
|
@@ -2455,7 +2503,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2455
2503
|
return void 0;
|
|
2456
2504
|
}
|
|
2457
2505
|
}
|
|
2458
|
-
}).filter(
|
|
2506
|
+
}).filter(import_provider_utils22.isNonNullable);
|
|
2459
2507
|
break;
|
|
2460
2508
|
}
|
|
2461
2509
|
input.push({
|
|
@@ -2474,9 +2522,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2474
2522
|
}
|
|
2475
2523
|
return { input, warnings };
|
|
2476
2524
|
}
|
|
2477
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2478
|
-
itemId:
|
|
2479
|
-
reasoningEncryptedContent:
|
|
2525
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v417.z.object({
|
|
2526
|
+
itemId: import_v417.z.string().nullish(),
|
|
2527
|
+
reasoningEncryptedContent: import_v417.z.string().nullish()
|
|
2480
2528
|
});
|
|
2481
2529
|
|
|
2482
2530
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2498,349 +2546,393 @@ function mapOpenAIResponseFinishReason({
|
|
|
2498
2546
|
}
|
|
2499
2547
|
|
|
2500
2548
|
// src/responses/openai-responses-api.ts
|
|
2501
|
-
var
|
|
2502
|
-
var
|
|
2503
|
-
var openaiResponsesChunkSchema = (0,
|
|
2504
|
-
() => (0,
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
type:
|
|
2508
|
-
item_id:
|
|
2509
|
-
delta:
|
|
2510
|
-
logprobs:
|
|
2511
|
-
|
|
2512
|
-
token:
|
|
2513
|
-
logprob:
|
|
2514
|
-
top_logprobs:
|
|
2515
|
-
|
|
2516
|
-
token:
|
|
2517
|
-
logprob:
|
|
2549
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2550
|
+
var import_v418 = require("zod/v4");
|
|
2551
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils23.lazySchema)(
|
|
2552
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2553
|
+
import_v418.z.union([
|
|
2554
|
+
import_v418.z.object({
|
|
2555
|
+
type: import_v418.z.literal("response.output_text.delta"),
|
|
2556
|
+
item_id: import_v418.z.string(),
|
|
2557
|
+
delta: import_v418.z.string(),
|
|
2558
|
+
logprobs: import_v418.z.array(
|
|
2559
|
+
import_v418.z.object({
|
|
2560
|
+
token: import_v418.z.string(),
|
|
2561
|
+
logprob: import_v418.z.number(),
|
|
2562
|
+
top_logprobs: import_v418.z.array(
|
|
2563
|
+
import_v418.z.object({
|
|
2564
|
+
token: import_v418.z.string(),
|
|
2565
|
+
logprob: import_v418.z.number()
|
|
2518
2566
|
})
|
|
2519
2567
|
)
|
|
2520
2568
|
})
|
|
2521
2569
|
).nullish()
|
|
2522
2570
|
}),
|
|
2523
|
-
|
|
2524
|
-
type:
|
|
2525
|
-
response:
|
|
2526
|
-
incomplete_details:
|
|
2527
|
-
usage:
|
|
2528
|
-
input_tokens:
|
|
2529
|
-
input_tokens_details:
|
|
2530
|
-
output_tokens:
|
|
2531
|
-
output_tokens_details:
|
|
2571
|
+
import_v418.z.object({
|
|
2572
|
+
type: import_v418.z.enum(["response.completed", "response.incomplete"]),
|
|
2573
|
+
response: import_v418.z.object({
|
|
2574
|
+
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
2575
|
+
usage: import_v418.z.object({
|
|
2576
|
+
input_tokens: import_v418.z.number(),
|
|
2577
|
+
input_tokens_details: import_v418.z.object({ cached_tokens: import_v418.z.number().nullish() }).nullish(),
|
|
2578
|
+
output_tokens: import_v418.z.number(),
|
|
2579
|
+
output_tokens_details: import_v418.z.object({ reasoning_tokens: import_v418.z.number().nullish() }).nullish()
|
|
2532
2580
|
}),
|
|
2533
|
-
service_tier:
|
|
2581
|
+
service_tier: import_v418.z.string().nullish()
|
|
2534
2582
|
})
|
|
2535
2583
|
}),
|
|
2536
|
-
|
|
2537
|
-
type:
|
|
2538
|
-
response:
|
|
2539
|
-
id:
|
|
2540
|
-
created_at:
|
|
2541
|
-
model:
|
|
2542
|
-
service_tier:
|
|
2584
|
+
import_v418.z.object({
|
|
2585
|
+
type: import_v418.z.literal("response.created"),
|
|
2586
|
+
response: import_v418.z.object({
|
|
2587
|
+
id: import_v418.z.string(),
|
|
2588
|
+
created_at: import_v418.z.number(),
|
|
2589
|
+
model: import_v418.z.string(),
|
|
2590
|
+
service_tier: import_v418.z.string().nullish()
|
|
2543
2591
|
})
|
|
2544
2592
|
}),
|
|
2545
|
-
|
|
2546
|
-
type:
|
|
2547
|
-
output_index:
|
|
2548
|
-
item:
|
|
2549
|
-
|
|
2550
|
-
type:
|
|
2551
|
-
id:
|
|
2593
|
+
import_v418.z.object({
|
|
2594
|
+
type: import_v418.z.literal("response.output_item.added"),
|
|
2595
|
+
output_index: import_v418.z.number(),
|
|
2596
|
+
item: import_v418.z.discriminatedUnion("type", [
|
|
2597
|
+
import_v418.z.object({
|
|
2598
|
+
type: import_v418.z.literal("message"),
|
|
2599
|
+
id: import_v418.z.string()
|
|
2552
2600
|
}),
|
|
2553
|
-
|
|
2554
|
-
type:
|
|
2555
|
-
id:
|
|
2556
|
-
encrypted_content:
|
|
2601
|
+
import_v418.z.object({
|
|
2602
|
+
type: import_v418.z.literal("reasoning"),
|
|
2603
|
+
id: import_v418.z.string(),
|
|
2604
|
+
encrypted_content: import_v418.z.string().nullish()
|
|
2557
2605
|
}),
|
|
2558
|
-
|
|
2559
|
-
type:
|
|
2560
|
-
id:
|
|
2561
|
-
call_id:
|
|
2562
|
-
name:
|
|
2563
|
-
arguments:
|
|
2606
|
+
import_v418.z.object({
|
|
2607
|
+
type: import_v418.z.literal("function_call"),
|
|
2608
|
+
id: import_v418.z.string(),
|
|
2609
|
+
call_id: import_v418.z.string(),
|
|
2610
|
+
name: import_v418.z.string(),
|
|
2611
|
+
arguments: import_v418.z.string()
|
|
2564
2612
|
}),
|
|
2565
|
-
|
|
2566
|
-
type:
|
|
2567
|
-
id:
|
|
2568
|
-
status:
|
|
2613
|
+
import_v418.z.object({
|
|
2614
|
+
type: import_v418.z.literal("web_search_call"),
|
|
2615
|
+
id: import_v418.z.string(),
|
|
2616
|
+
status: import_v418.z.string()
|
|
2569
2617
|
}),
|
|
2570
|
-
|
|
2571
|
-
type:
|
|
2572
|
-
id:
|
|
2573
|
-
status:
|
|
2618
|
+
import_v418.z.object({
|
|
2619
|
+
type: import_v418.z.literal("computer_call"),
|
|
2620
|
+
id: import_v418.z.string(),
|
|
2621
|
+
status: import_v418.z.string()
|
|
2574
2622
|
}),
|
|
2575
|
-
|
|
2576
|
-
type:
|
|
2577
|
-
id:
|
|
2623
|
+
import_v418.z.object({
|
|
2624
|
+
type: import_v418.z.literal("file_search_call"),
|
|
2625
|
+
id: import_v418.z.string()
|
|
2578
2626
|
}),
|
|
2579
|
-
|
|
2580
|
-
type:
|
|
2581
|
-
id:
|
|
2627
|
+
import_v418.z.object({
|
|
2628
|
+
type: import_v418.z.literal("image_generation_call"),
|
|
2629
|
+
id: import_v418.z.string()
|
|
2582
2630
|
}),
|
|
2583
|
-
|
|
2584
|
-
type:
|
|
2585
|
-
id:
|
|
2586
|
-
container_id:
|
|
2587
|
-
code:
|
|
2588
|
-
outputs:
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2631
|
+
import_v418.z.object({
|
|
2632
|
+
type: import_v418.z.literal("code_interpreter_call"),
|
|
2633
|
+
id: import_v418.z.string(),
|
|
2634
|
+
container_id: import_v418.z.string(),
|
|
2635
|
+
code: import_v418.z.string().nullable(),
|
|
2636
|
+
outputs: import_v418.z.array(
|
|
2637
|
+
import_v418.z.discriminatedUnion("type", [
|
|
2638
|
+
import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
|
|
2639
|
+
import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
|
|
2592
2640
|
])
|
|
2593
2641
|
).nullable(),
|
|
2594
|
-
status:
|
|
2642
|
+
status: import_v418.z.string()
|
|
2643
|
+
}),
|
|
2644
|
+
import_v418.z.object({
|
|
2645
|
+
type: import_v418.z.literal("mcp_call"),
|
|
2646
|
+
id: import_v418.z.string(),
|
|
2647
|
+
status: import_v418.z.string()
|
|
2595
2648
|
}),
|
|
2596
|
-
|
|
2597
|
-
type:
|
|
2598
|
-
id:
|
|
2599
|
-
status: import_v417.z.string()
|
|
2649
|
+
import_v418.z.object({
|
|
2650
|
+
type: import_v418.z.literal("mcp_list_tools"),
|
|
2651
|
+
id: import_v418.z.string()
|
|
2600
2652
|
}),
|
|
2601
|
-
|
|
2602
|
-
type:
|
|
2603
|
-
id:
|
|
2653
|
+
import_v418.z.object({
|
|
2654
|
+
type: import_v418.z.literal("mcp_approval_request"),
|
|
2655
|
+
id: import_v418.z.string()
|
|
2604
2656
|
}),
|
|
2605
|
-
|
|
2606
|
-
type:
|
|
2607
|
-
id:
|
|
2657
|
+
import_v418.z.object({
|
|
2658
|
+
type: import_v418.z.literal("apply_patch_call"),
|
|
2659
|
+
id: import_v418.z.string(),
|
|
2660
|
+
call_id: import_v418.z.string(),
|
|
2661
|
+
status: import_v418.z.enum(["in_progress", "completed"]),
|
|
2662
|
+
operation: import_v418.z.discriminatedUnion("type", [
|
|
2663
|
+
import_v418.z.object({
|
|
2664
|
+
type: import_v418.z.literal("create_file"),
|
|
2665
|
+
path: import_v418.z.string(),
|
|
2666
|
+
diff: import_v418.z.string()
|
|
2667
|
+
}),
|
|
2668
|
+
import_v418.z.object({
|
|
2669
|
+
type: import_v418.z.literal("delete_file"),
|
|
2670
|
+
path: import_v418.z.string()
|
|
2671
|
+
}),
|
|
2672
|
+
import_v418.z.object({
|
|
2673
|
+
type: import_v418.z.literal("update_file"),
|
|
2674
|
+
path: import_v418.z.string(),
|
|
2675
|
+
diff: import_v418.z.string()
|
|
2676
|
+
})
|
|
2677
|
+
])
|
|
2608
2678
|
})
|
|
2609
2679
|
])
|
|
2610
2680
|
}),
|
|
2611
|
-
|
|
2612
|
-
type:
|
|
2613
|
-
output_index:
|
|
2614
|
-
item:
|
|
2615
|
-
|
|
2616
|
-
type:
|
|
2617
|
-
id:
|
|
2681
|
+
import_v418.z.object({
|
|
2682
|
+
type: import_v418.z.literal("response.output_item.done"),
|
|
2683
|
+
output_index: import_v418.z.number(),
|
|
2684
|
+
item: import_v418.z.discriminatedUnion("type", [
|
|
2685
|
+
import_v418.z.object({
|
|
2686
|
+
type: import_v418.z.literal("message"),
|
|
2687
|
+
id: import_v418.z.string()
|
|
2618
2688
|
}),
|
|
2619
|
-
|
|
2620
|
-
type:
|
|
2621
|
-
id:
|
|
2622
|
-
encrypted_content:
|
|
2689
|
+
import_v418.z.object({
|
|
2690
|
+
type: import_v418.z.literal("reasoning"),
|
|
2691
|
+
id: import_v418.z.string(),
|
|
2692
|
+
encrypted_content: import_v418.z.string().nullish()
|
|
2623
2693
|
}),
|
|
2624
|
-
|
|
2625
|
-
type:
|
|
2626
|
-
id:
|
|
2627
|
-
call_id:
|
|
2628
|
-
name:
|
|
2629
|
-
arguments:
|
|
2630
|
-
status:
|
|
2694
|
+
import_v418.z.object({
|
|
2695
|
+
type: import_v418.z.literal("function_call"),
|
|
2696
|
+
id: import_v418.z.string(),
|
|
2697
|
+
call_id: import_v418.z.string(),
|
|
2698
|
+
name: import_v418.z.string(),
|
|
2699
|
+
arguments: import_v418.z.string(),
|
|
2700
|
+
status: import_v418.z.literal("completed")
|
|
2631
2701
|
}),
|
|
2632
|
-
|
|
2633
|
-
type:
|
|
2634
|
-
id:
|
|
2635
|
-
code:
|
|
2636
|
-
container_id:
|
|
2637
|
-
outputs:
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2702
|
+
import_v418.z.object({
|
|
2703
|
+
type: import_v418.z.literal("code_interpreter_call"),
|
|
2704
|
+
id: import_v418.z.string(),
|
|
2705
|
+
code: import_v418.z.string().nullable(),
|
|
2706
|
+
container_id: import_v418.z.string(),
|
|
2707
|
+
outputs: import_v418.z.array(
|
|
2708
|
+
import_v418.z.discriminatedUnion("type", [
|
|
2709
|
+
import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
|
|
2710
|
+
import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
|
|
2641
2711
|
])
|
|
2642
2712
|
).nullable()
|
|
2643
2713
|
}),
|
|
2644
|
-
|
|
2645
|
-
type:
|
|
2646
|
-
id:
|
|
2647
|
-
result:
|
|
2714
|
+
import_v418.z.object({
|
|
2715
|
+
type: import_v418.z.literal("image_generation_call"),
|
|
2716
|
+
id: import_v418.z.string(),
|
|
2717
|
+
result: import_v418.z.string()
|
|
2648
2718
|
}),
|
|
2649
|
-
|
|
2650
|
-
type:
|
|
2651
|
-
id:
|
|
2652
|
-
status:
|
|
2653
|
-
action:
|
|
2654
|
-
|
|
2655
|
-
type:
|
|
2656
|
-
query:
|
|
2657
|
-
sources:
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2719
|
+
import_v418.z.object({
|
|
2720
|
+
type: import_v418.z.literal("web_search_call"),
|
|
2721
|
+
id: import_v418.z.string(),
|
|
2722
|
+
status: import_v418.z.string(),
|
|
2723
|
+
action: import_v418.z.discriminatedUnion("type", [
|
|
2724
|
+
import_v418.z.object({
|
|
2725
|
+
type: import_v418.z.literal("search"),
|
|
2726
|
+
query: import_v418.z.string().nullish(),
|
|
2727
|
+
sources: import_v418.z.array(
|
|
2728
|
+
import_v418.z.discriminatedUnion("type", [
|
|
2729
|
+
import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() }),
|
|
2730
|
+
import_v418.z.object({ type: import_v418.z.literal("api"), name: import_v418.z.string() })
|
|
2661
2731
|
])
|
|
2662
2732
|
).nullish()
|
|
2663
2733
|
}),
|
|
2664
|
-
|
|
2665
|
-
type:
|
|
2666
|
-
url:
|
|
2734
|
+
import_v418.z.object({
|
|
2735
|
+
type: import_v418.z.literal("open_page"),
|
|
2736
|
+
url: import_v418.z.string()
|
|
2667
2737
|
}),
|
|
2668
|
-
|
|
2669
|
-
type:
|
|
2670
|
-
url:
|
|
2671
|
-
pattern:
|
|
2738
|
+
import_v418.z.object({
|
|
2739
|
+
type: import_v418.z.literal("find"),
|
|
2740
|
+
url: import_v418.z.string(),
|
|
2741
|
+
pattern: import_v418.z.string()
|
|
2672
2742
|
})
|
|
2673
2743
|
])
|
|
2674
2744
|
}),
|
|
2675
|
-
|
|
2676
|
-
type:
|
|
2677
|
-
id:
|
|
2678
|
-
queries:
|
|
2679
|
-
results:
|
|
2680
|
-
|
|
2681
|
-
attributes:
|
|
2682
|
-
|
|
2683
|
-
|
|
2745
|
+
import_v418.z.object({
|
|
2746
|
+
type: import_v418.z.literal("file_search_call"),
|
|
2747
|
+
id: import_v418.z.string(),
|
|
2748
|
+
queries: import_v418.z.array(import_v418.z.string()),
|
|
2749
|
+
results: import_v418.z.array(
|
|
2750
|
+
import_v418.z.object({
|
|
2751
|
+
attributes: import_v418.z.record(
|
|
2752
|
+
import_v418.z.string(),
|
|
2753
|
+
import_v418.z.union([import_v418.z.string(), import_v418.z.number(), import_v418.z.boolean()])
|
|
2684
2754
|
),
|
|
2685
|
-
file_id:
|
|
2686
|
-
filename:
|
|
2687
|
-
score:
|
|
2688
|
-
text:
|
|
2755
|
+
file_id: import_v418.z.string(),
|
|
2756
|
+
filename: import_v418.z.string(),
|
|
2757
|
+
score: import_v418.z.number(),
|
|
2758
|
+
text: import_v418.z.string()
|
|
2689
2759
|
})
|
|
2690
2760
|
).nullish()
|
|
2691
2761
|
}),
|
|
2692
|
-
|
|
2693
|
-
type:
|
|
2694
|
-
id:
|
|
2695
|
-
call_id:
|
|
2696
|
-
action:
|
|
2697
|
-
type:
|
|
2698
|
-
command:
|
|
2699
|
-
timeout_ms:
|
|
2700
|
-
user:
|
|
2701
|
-
working_directory:
|
|
2702
|
-
env:
|
|
2762
|
+
import_v418.z.object({
|
|
2763
|
+
type: import_v418.z.literal("local_shell_call"),
|
|
2764
|
+
id: import_v418.z.string(),
|
|
2765
|
+
call_id: import_v418.z.string(),
|
|
2766
|
+
action: import_v418.z.object({
|
|
2767
|
+
type: import_v418.z.literal("exec"),
|
|
2768
|
+
command: import_v418.z.array(import_v418.z.string()),
|
|
2769
|
+
timeout_ms: import_v418.z.number().optional(),
|
|
2770
|
+
user: import_v418.z.string().optional(),
|
|
2771
|
+
working_directory: import_v418.z.string().optional(),
|
|
2772
|
+
env: import_v418.z.record(import_v418.z.string(), import_v418.z.string()).optional()
|
|
2703
2773
|
})
|
|
2704
2774
|
}),
|
|
2705
|
-
|
|
2706
|
-
type:
|
|
2707
|
-
id:
|
|
2708
|
-
status:
|
|
2775
|
+
import_v418.z.object({
|
|
2776
|
+
type: import_v418.z.literal("computer_call"),
|
|
2777
|
+
id: import_v418.z.string(),
|
|
2778
|
+
status: import_v418.z.literal("completed")
|
|
2709
2779
|
}),
|
|
2710
|
-
|
|
2711
|
-
type:
|
|
2712
|
-
id:
|
|
2713
|
-
status:
|
|
2714
|
-
arguments:
|
|
2715
|
-
name:
|
|
2716
|
-
server_label:
|
|
2717
|
-
output:
|
|
2718
|
-
error:
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
type:
|
|
2722
|
-
code:
|
|
2723
|
-
message:
|
|
2780
|
+
import_v418.z.object({
|
|
2781
|
+
type: import_v418.z.literal("mcp_call"),
|
|
2782
|
+
id: import_v418.z.string(),
|
|
2783
|
+
status: import_v418.z.string(),
|
|
2784
|
+
arguments: import_v418.z.string(),
|
|
2785
|
+
name: import_v418.z.string(),
|
|
2786
|
+
server_label: import_v418.z.string(),
|
|
2787
|
+
output: import_v418.z.string().nullish(),
|
|
2788
|
+
error: import_v418.z.union([
|
|
2789
|
+
import_v418.z.string(),
|
|
2790
|
+
import_v418.z.object({
|
|
2791
|
+
type: import_v418.z.string().optional(),
|
|
2792
|
+
code: import_v418.z.union([import_v418.z.number(), import_v418.z.string()]).optional(),
|
|
2793
|
+
message: import_v418.z.string().optional()
|
|
2724
2794
|
}).loose()
|
|
2725
2795
|
]).nullish()
|
|
2726
2796
|
}),
|
|
2727
|
-
|
|
2728
|
-
type:
|
|
2729
|
-
id:
|
|
2730
|
-
server_label:
|
|
2731
|
-
tools:
|
|
2732
|
-
|
|
2733
|
-
name:
|
|
2734
|
-
description:
|
|
2735
|
-
input_schema:
|
|
2736
|
-
annotations:
|
|
2797
|
+
import_v418.z.object({
|
|
2798
|
+
type: import_v418.z.literal("mcp_list_tools"),
|
|
2799
|
+
id: import_v418.z.string(),
|
|
2800
|
+
server_label: import_v418.z.string(),
|
|
2801
|
+
tools: import_v418.z.array(
|
|
2802
|
+
import_v418.z.object({
|
|
2803
|
+
name: import_v418.z.string(),
|
|
2804
|
+
description: import_v418.z.string().optional(),
|
|
2805
|
+
input_schema: import_v418.z.any(),
|
|
2806
|
+
annotations: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()).optional()
|
|
2737
2807
|
})
|
|
2738
2808
|
),
|
|
2739
|
-
error:
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
type:
|
|
2743
|
-
code:
|
|
2744
|
-
message:
|
|
2809
|
+
error: import_v418.z.union([
|
|
2810
|
+
import_v418.z.string(),
|
|
2811
|
+
import_v418.z.object({
|
|
2812
|
+
type: import_v418.z.string().optional(),
|
|
2813
|
+
code: import_v418.z.union([import_v418.z.number(), import_v418.z.string()]).optional(),
|
|
2814
|
+
message: import_v418.z.string().optional()
|
|
2745
2815
|
}).loose()
|
|
2746
2816
|
]).optional()
|
|
2747
2817
|
}),
|
|
2748
|
-
|
|
2749
|
-
type:
|
|
2750
|
-
id:
|
|
2751
|
-
server_label:
|
|
2752
|
-
name:
|
|
2753
|
-
arguments:
|
|
2754
|
-
approval_request_id:
|
|
2818
|
+
import_v418.z.object({
|
|
2819
|
+
type: import_v418.z.literal("mcp_approval_request"),
|
|
2820
|
+
id: import_v418.z.string(),
|
|
2821
|
+
server_label: import_v418.z.string(),
|
|
2822
|
+
name: import_v418.z.string(),
|
|
2823
|
+
arguments: import_v418.z.string(),
|
|
2824
|
+
approval_request_id: import_v418.z.string()
|
|
2825
|
+
}),
|
|
2826
|
+
import_v418.z.object({
|
|
2827
|
+
type: import_v418.z.literal("apply_patch_call"),
|
|
2828
|
+
id: import_v418.z.string(),
|
|
2829
|
+
call_id: import_v418.z.string(),
|
|
2830
|
+
status: import_v418.z.enum(["in_progress", "completed"]),
|
|
2831
|
+
operation: import_v418.z.discriminatedUnion("type", [
|
|
2832
|
+
import_v418.z.object({
|
|
2833
|
+
type: import_v418.z.literal("create_file"),
|
|
2834
|
+
path: import_v418.z.string(),
|
|
2835
|
+
diff: import_v418.z.string()
|
|
2836
|
+
}),
|
|
2837
|
+
import_v418.z.object({
|
|
2838
|
+
type: import_v418.z.literal("delete_file"),
|
|
2839
|
+
path: import_v418.z.string()
|
|
2840
|
+
}),
|
|
2841
|
+
import_v418.z.object({
|
|
2842
|
+
type: import_v418.z.literal("update_file"),
|
|
2843
|
+
path: import_v418.z.string(),
|
|
2844
|
+
diff: import_v418.z.string()
|
|
2845
|
+
})
|
|
2846
|
+
])
|
|
2755
2847
|
})
|
|
2756
2848
|
])
|
|
2757
2849
|
}),
|
|
2758
|
-
|
|
2759
|
-
type:
|
|
2760
|
-
item_id:
|
|
2761
|
-
output_index:
|
|
2762
|
-
delta:
|
|
2850
|
+
import_v418.z.object({
|
|
2851
|
+
type: import_v418.z.literal("response.function_call_arguments.delta"),
|
|
2852
|
+
item_id: import_v418.z.string(),
|
|
2853
|
+
output_index: import_v418.z.number(),
|
|
2854
|
+
delta: import_v418.z.string()
|
|
2763
2855
|
}),
|
|
2764
|
-
|
|
2765
|
-
type:
|
|
2766
|
-
item_id:
|
|
2767
|
-
output_index:
|
|
2768
|
-
partial_image_b64:
|
|
2856
|
+
import_v418.z.object({
|
|
2857
|
+
type: import_v418.z.literal("response.image_generation_call.partial_image"),
|
|
2858
|
+
item_id: import_v418.z.string(),
|
|
2859
|
+
output_index: import_v418.z.number(),
|
|
2860
|
+
partial_image_b64: import_v418.z.string()
|
|
2769
2861
|
}),
|
|
2770
|
-
|
|
2771
|
-
type:
|
|
2772
|
-
item_id:
|
|
2773
|
-
output_index:
|
|
2774
|
-
delta:
|
|
2862
|
+
import_v418.z.object({
|
|
2863
|
+
type: import_v418.z.literal("response.code_interpreter_call_code.delta"),
|
|
2864
|
+
item_id: import_v418.z.string(),
|
|
2865
|
+
output_index: import_v418.z.number(),
|
|
2866
|
+
delta: import_v418.z.string()
|
|
2775
2867
|
}),
|
|
2776
|
-
|
|
2777
|
-
type:
|
|
2778
|
-
item_id:
|
|
2779
|
-
output_index:
|
|
2780
|
-
code:
|
|
2868
|
+
import_v418.z.object({
|
|
2869
|
+
type: import_v418.z.literal("response.code_interpreter_call_code.done"),
|
|
2870
|
+
item_id: import_v418.z.string(),
|
|
2871
|
+
output_index: import_v418.z.number(),
|
|
2872
|
+
code: import_v418.z.string()
|
|
2781
2873
|
}),
|
|
2782
|
-
|
|
2783
|
-
type:
|
|
2784
|
-
annotation:
|
|
2785
|
-
|
|
2786
|
-
type:
|
|
2787
|
-
start_index:
|
|
2788
|
-
end_index:
|
|
2789
|
-
url:
|
|
2790
|
-
title:
|
|
2874
|
+
import_v418.z.object({
|
|
2875
|
+
type: import_v418.z.literal("response.output_text.annotation.added"),
|
|
2876
|
+
annotation: import_v418.z.discriminatedUnion("type", [
|
|
2877
|
+
import_v418.z.object({
|
|
2878
|
+
type: import_v418.z.literal("url_citation"),
|
|
2879
|
+
start_index: import_v418.z.number(),
|
|
2880
|
+
end_index: import_v418.z.number(),
|
|
2881
|
+
url: import_v418.z.string(),
|
|
2882
|
+
title: import_v418.z.string()
|
|
2791
2883
|
}),
|
|
2792
|
-
|
|
2793
|
-
type:
|
|
2794
|
-
file_id:
|
|
2795
|
-
filename:
|
|
2796
|
-
index:
|
|
2797
|
-
start_index:
|
|
2798
|
-
end_index:
|
|
2799
|
-
quote:
|
|
2884
|
+
import_v418.z.object({
|
|
2885
|
+
type: import_v418.z.literal("file_citation"),
|
|
2886
|
+
file_id: import_v418.z.string(),
|
|
2887
|
+
filename: import_v418.z.string().nullish(),
|
|
2888
|
+
index: import_v418.z.number().nullish(),
|
|
2889
|
+
start_index: import_v418.z.number().nullish(),
|
|
2890
|
+
end_index: import_v418.z.number().nullish(),
|
|
2891
|
+
quote: import_v418.z.string().nullish()
|
|
2800
2892
|
}),
|
|
2801
|
-
|
|
2802
|
-
type:
|
|
2803
|
-
container_id:
|
|
2804
|
-
file_id:
|
|
2805
|
-
filename:
|
|
2806
|
-
start_index:
|
|
2807
|
-
end_index:
|
|
2808
|
-
index:
|
|
2893
|
+
import_v418.z.object({
|
|
2894
|
+
type: import_v418.z.literal("container_file_citation"),
|
|
2895
|
+
container_id: import_v418.z.string(),
|
|
2896
|
+
file_id: import_v418.z.string(),
|
|
2897
|
+
filename: import_v418.z.string().nullish(),
|
|
2898
|
+
start_index: import_v418.z.number().nullish(),
|
|
2899
|
+
end_index: import_v418.z.number().nullish(),
|
|
2900
|
+
index: import_v418.z.number().nullish()
|
|
2809
2901
|
}),
|
|
2810
|
-
|
|
2811
|
-
type:
|
|
2812
|
-
file_id:
|
|
2813
|
-
index:
|
|
2902
|
+
import_v418.z.object({
|
|
2903
|
+
type: import_v418.z.literal("file_path"),
|
|
2904
|
+
file_id: import_v418.z.string(),
|
|
2905
|
+
index: import_v418.z.number().nullish()
|
|
2814
2906
|
})
|
|
2815
2907
|
])
|
|
2816
2908
|
}),
|
|
2817
|
-
|
|
2818
|
-
type:
|
|
2819
|
-
item_id:
|
|
2820
|
-
summary_index:
|
|
2909
|
+
import_v418.z.object({
|
|
2910
|
+
type: import_v418.z.literal("response.reasoning_summary_part.added"),
|
|
2911
|
+
item_id: import_v418.z.string(),
|
|
2912
|
+
summary_index: import_v418.z.number()
|
|
2821
2913
|
}),
|
|
2822
|
-
|
|
2823
|
-
type:
|
|
2824
|
-
item_id:
|
|
2825
|
-
summary_index:
|
|
2826
|
-
delta:
|
|
2914
|
+
import_v418.z.object({
|
|
2915
|
+
type: import_v418.z.literal("response.reasoning_summary_text.delta"),
|
|
2916
|
+
item_id: import_v418.z.string(),
|
|
2917
|
+
summary_index: import_v418.z.number(),
|
|
2918
|
+
delta: import_v418.z.string()
|
|
2827
2919
|
}),
|
|
2828
|
-
|
|
2829
|
-
type:
|
|
2830
|
-
item_id:
|
|
2831
|
-
summary_index:
|
|
2920
|
+
import_v418.z.object({
|
|
2921
|
+
type: import_v418.z.literal("response.reasoning_summary_part.done"),
|
|
2922
|
+
item_id: import_v418.z.string(),
|
|
2923
|
+
summary_index: import_v418.z.number()
|
|
2832
2924
|
}),
|
|
2833
|
-
|
|
2834
|
-
type:
|
|
2835
|
-
sequence_number:
|
|
2836
|
-
error:
|
|
2837
|
-
type:
|
|
2838
|
-
code:
|
|
2839
|
-
message:
|
|
2840
|
-
param:
|
|
2925
|
+
import_v418.z.object({
|
|
2926
|
+
type: import_v418.z.literal("error"),
|
|
2927
|
+
sequence_number: import_v418.z.number(),
|
|
2928
|
+
error: import_v418.z.object({
|
|
2929
|
+
type: import_v418.z.string(),
|
|
2930
|
+
code: import_v418.z.string(),
|
|
2931
|
+
message: import_v418.z.string(),
|
|
2932
|
+
param: import_v418.z.string().nullish()
|
|
2841
2933
|
})
|
|
2842
2934
|
}),
|
|
2843
|
-
|
|
2935
|
+
import_v418.z.object({ type: import_v418.z.string() }).loose().transform((value) => ({
|
|
2844
2936
|
type: "unknown_chunk",
|
|
2845
2937
|
message: value.type
|
|
2846
2938
|
}))
|
|
@@ -2848,236 +2940,258 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazySchema)(
|
|
|
2848
2940
|
])
|
|
2849
2941
|
)
|
|
2850
2942
|
);
|
|
2851
|
-
var openaiResponsesResponseSchema = (0,
|
|
2852
|
-
() => (0,
|
|
2853
|
-
|
|
2854
|
-
id:
|
|
2855
|
-
created_at:
|
|
2856
|
-
error:
|
|
2857
|
-
message:
|
|
2858
|
-
type:
|
|
2859
|
-
param:
|
|
2860
|
-
code:
|
|
2943
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils23.lazySchema)(
|
|
2944
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2945
|
+
import_v418.z.object({
|
|
2946
|
+
id: import_v418.z.string().optional(),
|
|
2947
|
+
created_at: import_v418.z.number().optional(),
|
|
2948
|
+
error: import_v418.z.object({
|
|
2949
|
+
message: import_v418.z.string(),
|
|
2950
|
+
type: import_v418.z.string(),
|
|
2951
|
+
param: import_v418.z.string().nullish(),
|
|
2952
|
+
code: import_v418.z.string()
|
|
2861
2953
|
}).nullish(),
|
|
2862
|
-
model:
|
|
2863
|
-
output:
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
type:
|
|
2867
|
-
role:
|
|
2868
|
-
id:
|
|
2869
|
-
content:
|
|
2870
|
-
|
|
2871
|
-
type:
|
|
2872
|
-
text:
|
|
2873
|
-
logprobs:
|
|
2874
|
-
|
|
2875
|
-
token:
|
|
2876
|
-
logprob:
|
|
2877
|
-
top_logprobs:
|
|
2878
|
-
|
|
2879
|
-
token:
|
|
2880
|
-
logprob:
|
|
2954
|
+
model: import_v418.z.string().optional(),
|
|
2955
|
+
output: import_v418.z.array(
|
|
2956
|
+
import_v418.z.discriminatedUnion("type", [
|
|
2957
|
+
import_v418.z.object({
|
|
2958
|
+
type: import_v418.z.literal("message"),
|
|
2959
|
+
role: import_v418.z.literal("assistant"),
|
|
2960
|
+
id: import_v418.z.string(),
|
|
2961
|
+
content: import_v418.z.array(
|
|
2962
|
+
import_v418.z.object({
|
|
2963
|
+
type: import_v418.z.literal("output_text"),
|
|
2964
|
+
text: import_v418.z.string(),
|
|
2965
|
+
logprobs: import_v418.z.array(
|
|
2966
|
+
import_v418.z.object({
|
|
2967
|
+
token: import_v418.z.string(),
|
|
2968
|
+
logprob: import_v418.z.number(),
|
|
2969
|
+
top_logprobs: import_v418.z.array(
|
|
2970
|
+
import_v418.z.object({
|
|
2971
|
+
token: import_v418.z.string(),
|
|
2972
|
+
logprob: import_v418.z.number()
|
|
2881
2973
|
})
|
|
2882
2974
|
)
|
|
2883
2975
|
})
|
|
2884
2976
|
).nullish(),
|
|
2885
|
-
annotations:
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
type:
|
|
2889
|
-
start_index:
|
|
2890
|
-
end_index:
|
|
2891
|
-
url:
|
|
2892
|
-
title:
|
|
2977
|
+
annotations: import_v418.z.array(
|
|
2978
|
+
import_v418.z.discriminatedUnion("type", [
|
|
2979
|
+
import_v418.z.object({
|
|
2980
|
+
type: import_v418.z.literal("url_citation"),
|
|
2981
|
+
start_index: import_v418.z.number(),
|
|
2982
|
+
end_index: import_v418.z.number(),
|
|
2983
|
+
url: import_v418.z.string(),
|
|
2984
|
+
title: import_v418.z.string()
|
|
2893
2985
|
}),
|
|
2894
|
-
|
|
2895
|
-
type:
|
|
2896
|
-
file_id:
|
|
2897
|
-
filename:
|
|
2898
|
-
index:
|
|
2899
|
-
start_index:
|
|
2900
|
-
end_index:
|
|
2901
|
-
quote:
|
|
2986
|
+
import_v418.z.object({
|
|
2987
|
+
type: import_v418.z.literal("file_citation"),
|
|
2988
|
+
file_id: import_v418.z.string(),
|
|
2989
|
+
filename: import_v418.z.string().nullish(),
|
|
2990
|
+
index: import_v418.z.number().nullish(),
|
|
2991
|
+
start_index: import_v418.z.number().nullish(),
|
|
2992
|
+
end_index: import_v418.z.number().nullish(),
|
|
2993
|
+
quote: import_v418.z.string().nullish()
|
|
2902
2994
|
}),
|
|
2903
|
-
|
|
2904
|
-
type:
|
|
2905
|
-
container_id:
|
|
2906
|
-
file_id:
|
|
2907
|
-
filename:
|
|
2908
|
-
start_index:
|
|
2909
|
-
end_index:
|
|
2910
|
-
index:
|
|
2995
|
+
import_v418.z.object({
|
|
2996
|
+
type: import_v418.z.literal("container_file_citation"),
|
|
2997
|
+
container_id: import_v418.z.string(),
|
|
2998
|
+
file_id: import_v418.z.string(),
|
|
2999
|
+
filename: import_v418.z.string().nullish(),
|
|
3000
|
+
start_index: import_v418.z.number().nullish(),
|
|
3001
|
+
end_index: import_v418.z.number().nullish(),
|
|
3002
|
+
index: import_v418.z.number().nullish()
|
|
2911
3003
|
}),
|
|
2912
|
-
|
|
2913
|
-
type:
|
|
2914
|
-
file_id:
|
|
2915
|
-
index:
|
|
3004
|
+
import_v418.z.object({
|
|
3005
|
+
type: import_v418.z.literal("file_path"),
|
|
3006
|
+
file_id: import_v418.z.string(),
|
|
3007
|
+
index: import_v418.z.number().nullish()
|
|
2916
3008
|
})
|
|
2917
3009
|
])
|
|
2918
3010
|
)
|
|
2919
3011
|
})
|
|
2920
3012
|
)
|
|
2921
3013
|
}),
|
|
2922
|
-
|
|
2923
|
-
type:
|
|
2924
|
-
id:
|
|
2925
|
-
status:
|
|
2926
|
-
action:
|
|
2927
|
-
|
|
2928
|
-
type:
|
|
2929
|
-
query:
|
|
2930
|
-
sources:
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
3014
|
+
import_v418.z.object({
|
|
3015
|
+
type: import_v418.z.literal("web_search_call"),
|
|
3016
|
+
id: import_v418.z.string(),
|
|
3017
|
+
status: import_v418.z.string(),
|
|
3018
|
+
action: import_v418.z.discriminatedUnion("type", [
|
|
3019
|
+
import_v418.z.object({
|
|
3020
|
+
type: import_v418.z.literal("search"),
|
|
3021
|
+
query: import_v418.z.string().nullish(),
|
|
3022
|
+
sources: import_v418.z.array(
|
|
3023
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3024
|
+
import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() }),
|
|
3025
|
+
import_v418.z.object({ type: import_v418.z.literal("api"), name: import_v418.z.string() })
|
|
2934
3026
|
])
|
|
2935
3027
|
).nullish()
|
|
2936
3028
|
}),
|
|
2937
|
-
|
|
2938
|
-
type:
|
|
2939
|
-
url:
|
|
3029
|
+
import_v418.z.object({
|
|
3030
|
+
type: import_v418.z.literal("open_page"),
|
|
3031
|
+
url: import_v418.z.string()
|
|
2940
3032
|
}),
|
|
2941
|
-
|
|
2942
|
-
type:
|
|
2943
|
-
url:
|
|
2944
|
-
pattern:
|
|
3033
|
+
import_v418.z.object({
|
|
3034
|
+
type: import_v418.z.literal("find"),
|
|
3035
|
+
url: import_v418.z.string(),
|
|
3036
|
+
pattern: import_v418.z.string()
|
|
2945
3037
|
})
|
|
2946
3038
|
])
|
|
2947
3039
|
}),
|
|
2948
|
-
|
|
2949
|
-
type:
|
|
2950
|
-
id:
|
|
2951
|
-
queries:
|
|
2952
|
-
results:
|
|
2953
|
-
|
|
2954
|
-
attributes:
|
|
2955
|
-
|
|
2956
|
-
|
|
3040
|
+
import_v418.z.object({
|
|
3041
|
+
type: import_v418.z.literal("file_search_call"),
|
|
3042
|
+
id: import_v418.z.string(),
|
|
3043
|
+
queries: import_v418.z.array(import_v418.z.string()),
|
|
3044
|
+
results: import_v418.z.array(
|
|
3045
|
+
import_v418.z.object({
|
|
3046
|
+
attributes: import_v418.z.record(
|
|
3047
|
+
import_v418.z.string(),
|
|
3048
|
+
import_v418.z.union([import_v418.z.string(), import_v418.z.number(), import_v418.z.boolean()])
|
|
2957
3049
|
),
|
|
2958
|
-
file_id:
|
|
2959
|
-
filename:
|
|
2960
|
-
score:
|
|
2961
|
-
text:
|
|
3050
|
+
file_id: import_v418.z.string(),
|
|
3051
|
+
filename: import_v418.z.string(),
|
|
3052
|
+
score: import_v418.z.number(),
|
|
3053
|
+
text: import_v418.z.string()
|
|
2962
3054
|
})
|
|
2963
3055
|
).nullish()
|
|
2964
3056
|
}),
|
|
2965
|
-
|
|
2966
|
-
type:
|
|
2967
|
-
id:
|
|
2968
|
-
code:
|
|
2969
|
-
container_id:
|
|
2970
|
-
outputs:
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
3057
|
+
import_v418.z.object({
|
|
3058
|
+
type: import_v418.z.literal("code_interpreter_call"),
|
|
3059
|
+
id: import_v418.z.string(),
|
|
3060
|
+
code: import_v418.z.string().nullable(),
|
|
3061
|
+
container_id: import_v418.z.string(),
|
|
3062
|
+
outputs: import_v418.z.array(
|
|
3063
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3064
|
+
import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
|
|
3065
|
+
import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
|
|
2974
3066
|
])
|
|
2975
3067
|
).nullable()
|
|
2976
3068
|
}),
|
|
2977
|
-
|
|
2978
|
-
type:
|
|
2979
|
-
id:
|
|
2980
|
-
result:
|
|
3069
|
+
import_v418.z.object({
|
|
3070
|
+
type: import_v418.z.literal("image_generation_call"),
|
|
3071
|
+
id: import_v418.z.string(),
|
|
3072
|
+
result: import_v418.z.string()
|
|
2981
3073
|
}),
|
|
2982
|
-
|
|
2983
|
-
type:
|
|
2984
|
-
id:
|
|
2985
|
-
call_id:
|
|
2986
|
-
action:
|
|
2987
|
-
type:
|
|
2988
|
-
command:
|
|
2989
|
-
timeout_ms:
|
|
2990
|
-
user:
|
|
2991
|
-
working_directory:
|
|
2992
|
-
env:
|
|
3074
|
+
import_v418.z.object({
|
|
3075
|
+
type: import_v418.z.literal("local_shell_call"),
|
|
3076
|
+
id: import_v418.z.string(),
|
|
3077
|
+
call_id: import_v418.z.string(),
|
|
3078
|
+
action: import_v418.z.object({
|
|
3079
|
+
type: import_v418.z.literal("exec"),
|
|
3080
|
+
command: import_v418.z.array(import_v418.z.string()),
|
|
3081
|
+
timeout_ms: import_v418.z.number().optional(),
|
|
3082
|
+
user: import_v418.z.string().optional(),
|
|
3083
|
+
working_directory: import_v418.z.string().optional(),
|
|
3084
|
+
env: import_v418.z.record(import_v418.z.string(), import_v418.z.string()).optional()
|
|
2993
3085
|
})
|
|
2994
3086
|
}),
|
|
2995
|
-
|
|
2996
|
-
type:
|
|
2997
|
-
call_id:
|
|
2998
|
-
name:
|
|
2999
|
-
arguments:
|
|
3000
|
-
id:
|
|
3087
|
+
import_v418.z.object({
|
|
3088
|
+
type: import_v418.z.literal("function_call"),
|
|
3089
|
+
call_id: import_v418.z.string(),
|
|
3090
|
+
name: import_v418.z.string(),
|
|
3091
|
+
arguments: import_v418.z.string(),
|
|
3092
|
+
id: import_v418.z.string()
|
|
3001
3093
|
}),
|
|
3002
|
-
|
|
3003
|
-
type:
|
|
3004
|
-
id:
|
|
3005
|
-
status:
|
|
3094
|
+
import_v418.z.object({
|
|
3095
|
+
type: import_v418.z.literal("computer_call"),
|
|
3096
|
+
id: import_v418.z.string(),
|
|
3097
|
+
status: import_v418.z.string().optional()
|
|
3006
3098
|
}),
|
|
3007
|
-
|
|
3008
|
-
type:
|
|
3009
|
-
id:
|
|
3010
|
-
encrypted_content:
|
|
3011
|
-
summary:
|
|
3012
|
-
|
|
3013
|
-
type:
|
|
3014
|
-
text:
|
|
3099
|
+
import_v418.z.object({
|
|
3100
|
+
type: import_v418.z.literal("reasoning"),
|
|
3101
|
+
id: import_v418.z.string(),
|
|
3102
|
+
encrypted_content: import_v418.z.string().nullish(),
|
|
3103
|
+
summary: import_v418.z.array(
|
|
3104
|
+
import_v418.z.object({
|
|
3105
|
+
type: import_v418.z.literal("summary_text"),
|
|
3106
|
+
text: import_v418.z.string()
|
|
3015
3107
|
})
|
|
3016
3108
|
)
|
|
3017
3109
|
}),
|
|
3018
|
-
|
|
3019
|
-
type:
|
|
3020
|
-
id:
|
|
3021
|
-
status:
|
|
3022
|
-
arguments:
|
|
3023
|
-
name:
|
|
3024
|
-
server_label:
|
|
3025
|
-
output:
|
|
3026
|
-
error:
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
type:
|
|
3030
|
-
code:
|
|
3031
|
-
message:
|
|
3110
|
+
import_v418.z.object({
|
|
3111
|
+
type: import_v418.z.literal("mcp_call"),
|
|
3112
|
+
id: import_v418.z.string(),
|
|
3113
|
+
status: import_v418.z.string(),
|
|
3114
|
+
arguments: import_v418.z.string(),
|
|
3115
|
+
name: import_v418.z.string(),
|
|
3116
|
+
server_label: import_v418.z.string(),
|
|
3117
|
+
output: import_v418.z.string().nullish(),
|
|
3118
|
+
error: import_v418.z.union([
|
|
3119
|
+
import_v418.z.string(),
|
|
3120
|
+
import_v418.z.object({
|
|
3121
|
+
type: import_v418.z.string().optional(),
|
|
3122
|
+
code: import_v418.z.union([import_v418.z.number(), import_v418.z.string()]).optional(),
|
|
3123
|
+
message: import_v418.z.string().optional()
|
|
3032
3124
|
}).loose()
|
|
3033
3125
|
]).nullish()
|
|
3034
3126
|
}),
|
|
3035
|
-
|
|
3036
|
-
type:
|
|
3037
|
-
id:
|
|
3038
|
-
server_label:
|
|
3039
|
-
tools:
|
|
3040
|
-
|
|
3041
|
-
name:
|
|
3042
|
-
description:
|
|
3043
|
-
input_schema:
|
|
3044
|
-
annotations:
|
|
3127
|
+
import_v418.z.object({
|
|
3128
|
+
type: import_v418.z.literal("mcp_list_tools"),
|
|
3129
|
+
id: import_v418.z.string(),
|
|
3130
|
+
server_label: import_v418.z.string(),
|
|
3131
|
+
tools: import_v418.z.array(
|
|
3132
|
+
import_v418.z.object({
|
|
3133
|
+
name: import_v418.z.string(),
|
|
3134
|
+
description: import_v418.z.string().optional(),
|
|
3135
|
+
input_schema: import_v418.z.any(),
|
|
3136
|
+
annotations: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()).optional()
|
|
3045
3137
|
})
|
|
3046
3138
|
),
|
|
3047
|
-
error:
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
type:
|
|
3051
|
-
code:
|
|
3052
|
-
message:
|
|
3139
|
+
error: import_v418.z.union([
|
|
3140
|
+
import_v418.z.string(),
|
|
3141
|
+
import_v418.z.object({
|
|
3142
|
+
type: import_v418.z.string().optional(),
|
|
3143
|
+
code: import_v418.z.union([import_v418.z.number(), import_v418.z.string()]).optional(),
|
|
3144
|
+
message: import_v418.z.string().optional()
|
|
3053
3145
|
}).loose()
|
|
3054
3146
|
]).optional()
|
|
3055
3147
|
}),
|
|
3056
|
-
|
|
3057
|
-
type:
|
|
3058
|
-
id:
|
|
3059
|
-
server_label:
|
|
3060
|
-
name:
|
|
3061
|
-
arguments:
|
|
3062
|
-
approval_request_id:
|
|
3148
|
+
import_v418.z.object({
|
|
3149
|
+
type: import_v418.z.literal("mcp_approval_request"),
|
|
3150
|
+
id: import_v418.z.string(),
|
|
3151
|
+
server_label: import_v418.z.string(),
|
|
3152
|
+
name: import_v418.z.string(),
|
|
3153
|
+
arguments: import_v418.z.string(),
|
|
3154
|
+
approval_request_id: import_v418.z.string()
|
|
3155
|
+
}),
|
|
3156
|
+
import_v418.z.object({
|
|
3157
|
+
type: import_v418.z.literal("apply_patch_call"),
|
|
3158
|
+
id: import_v418.z.string(),
|
|
3159
|
+
call_id: import_v418.z.string(),
|
|
3160
|
+
status: import_v418.z.enum(["in_progress", "completed"]),
|
|
3161
|
+
operation: import_v418.z.discriminatedUnion("type", [
|
|
3162
|
+
import_v418.z.object({
|
|
3163
|
+
type: import_v418.z.literal("create_file"),
|
|
3164
|
+
path: import_v418.z.string(),
|
|
3165
|
+
diff: import_v418.z.string()
|
|
3166
|
+
}),
|
|
3167
|
+
import_v418.z.object({
|
|
3168
|
+
type: import_v418.z.literal("delete_file"),
|
|
3169
|
+
path: import_v418.z.string()
|
|
3170
|
+
}),
|
|
3171
|
+
import_v418.z.object({
|
|
3172
|
+
type: import_v418.z.literal("update_file"),
|
|
3173
|
+
path: import_v418.z.string(),
|
|
3174
|
+
diff: import_v418.z.string()
|
|
3175
|
+
})
|
|
3176
|
+
])
|
|
3063
3177
|
})
|
|
3064
3178
|
])
|
|
3065
3179
|
).optional(),
|
|
3066
|
-
service_tier:
|
|
3067
|
-
incomplete_details:
|
|
3068
|
-
usage:
|
|
3069
|
-
input_tokens:
|
|
3070
|
-
input_tokens_details:
|
|
3071
|
-
output_tokens:
|
|
3072
|
-
output_tokens_details:
|
|
3180
|
+
service_tier: import_v418.z.string().nullish(),
|
|
3181
|
+
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
3182
|
+
usage: import_v418.z.object({
|
|
3183
|
+
input_tokens: import_v418.z.number(),
|
|
3184
|
+
input_tokens_details: import_v418.z.object({ cached_tokens: import_v418.z.number().nullish() }).nullish(),
|
|
3185
|
+
output_tokens: import_v418.z.number(),
|
|
3186
|
+
output_tokens_details: import_v418.z.object({ reasoning_tokens: import_v418.z.number().nullish() }).nullish()
|
|
3073
3187
|
}).optional()
|
|
3074
3188
|
})
|
|
3075
3189
|
)
|
|
3076
3190
|
);
|
|
3077
3191
|
|
|
3078
3192
|
// src/responses/openai-responses-options.ts
|
|
3079
|
-
var
|
|
3080
|
-
var
|
|
3193
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
3194
|
+
var import_v419 = require("zod/v4");
|
|
3081
3195
|
var TOP_LOGPROBS_MAX = 20;
|
|
3082
3196
|
var openaiResponsesReasoningModelIds = [
|
|
3083
3197
|
"o1",
|
|
@@ -3144,19 +3258,19 @@ var openaiResponsesModelIds = [
|
|
|
3144
3258
|
"gpt-5-chat-latest",
|
|
3145
3259
|
...openaiResponsesReasoningModelIds
|
|
3146
3260
|
];
|
|
3147
|
-
var openaiResponsesProviderOptionsSchema = (0,
|
|
3148
|
-
() => (0,
|
|
3149
|
-
|
|
3150
|
-
conversation:
|
|
3151
|
-
include:
|
|
3152
|
-
|
|
3261
|
+
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils24.lazySchema)(
|
|
3262
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
3263
|
+
import_v419.z.object({
|
|
3264
|
+
conversation: import_v419.z.string().nullish(),
|
|
3265
|
+
include: import_v419.z.array(
|
|
3266
|
+
import_v419.z.enum([
|
|
3153
3267
|
"reasoning.encrypted_content",
|
|
3154
3268
|
// handled internally by default, only needed for unknown reasoning models
|
|
3155
3269
|
"file_search_call.results",
|
|
3156
3270
|
"message.output_text.logprobs"
|
|
3157
3271
|
])
|
|
3158
3272
|
).nullish(),
|
|
3159
|
-
instructions:
|
|
3273
|
+
instructions: import_v419.z.string().nullish(),
|
|
3160
3274
|
/**
|
|
3161
3275
|
* Return the log probabilities of the tokens.
|
|
3162
3276
|
*
|
|
@@ -3169,17 +3283,17 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazySchem
|
|
|
3169
3283
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3170
3284
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3171
3285
|
*/
|
|
3172
|
-
logprobs:
|
|
3286
|
+
logprobs: import_v419.z.union([import_v419.z.boolean(), import_v419.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3173
3287
|
/**
|
|
3174
3288
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3175
3289
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3176
3290
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3177
3291
|
*/
|
|
3178
|
-
maxToolCalls:
|
|
3179
|
-
metadata:
|
|
3180
|
-
parallelToolCalls:
|
|
3181
|
-
previousResponseId:
|
|
3182
|
-
promptCacheKey:
|
|
3292
|
+
maxToolCalls: import_v419.z.number().nullish(),
|
|
3293
|
+
metadata: import_v419.z.any().nullish(),
|
|
3294
|
+
parallelToolCalls: import_v419.z.boolean().nullish(),
|
|
3295
|
+
previousResponseId: import_v419.z.string().nullish(),
|
|
3296
|
+
promptCacheKey: import_v419.z.string().nullish(),
|
|
3183
3297
|
/**
|
|
3184
3298
|
* The retention policy for the prompt cache.
|
|
3185
3299
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -3188,23 +3302,23 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazySchem
|
|
|
3188
3302
|
*
|
|
3189
3303
|
* @default 'in_memory'
|
|
3190
3304
|
*/
|
|
3191
|
-
promptCacheRetention:
|
|
3192
|
-
reasoningEffort:
|
|
3193
|
-
reasoningSummary:
|
|
3194
|
-
safetyIdentifier:
|
|
3195
|
-
serviceTier:
|
|
3196
|
-
store:
|
|
3197
|
-
strictJsonSchema:
|
|
3198
|
-
textVerbosity:
|
|
3199
|
-
truncation:
|
|
3200
|
-
user:
|
|
3305
|
+
promptCacheRetention: import_v419.z.enum(["in_memory", "24h"]).nullish(),
|
|
3306
|
+
reasoningEffort: import_v419.z.string().nullish(),
|
|
3307
|
+
reasoningSummary: import_v419.z.string().nullish(),
|
|
3308
|
+
safetyIdentifier: import_v419.z.string().nullish(),
|
|
3309
|
+
serviceTier: import_v419.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3310
|
+
store: import_v419.z.boolean().nullish(),
|
|
3311
|
+
strictJsonSchema: import_v419.z.boolean().nullish(),
|
|
3312
|
+
textVerbosity: import_v419.z.enum(["low", "medium", "high"]).nullish(),
|
|
3313
|
+
truncation: import_v419.z.enum(["auto", "disabled"]).nullish(),
|
|
3314
|
+
user: import_v419.z.string().nullish()
|
|
3201
3315
|
})
|
|
3202
3316
|
)
|
|
3203
3317
|
);
|
|
3204
3318
|
|
|
3205
3319
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3206
3320
|
var import_provider7 = require("@ai-sdk/provider");
|
|
3207
|
-
var
|
|
3321
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
3208
3322
|
async function prepareResponsesTools({
|
|
3209
3323
|
tools,
|
|
3210
3324
|
toolChoice,
|
|
@@ -3230,7 +3344,7 @@ async function prepareResponsesTools({
|
|
|
3230
3344
|
case "provider": {
|
|
3231
3345
|
switch (tool.id) {
|
|
3232
3346
|
case "openai.file_search": {
|
|
3233
|
-
const args = await (0,
|
|
3347
|
+
const args = await (0, import_provider_utils25.validateTypes)({
|
|
3234
3348
|
value: tool.args,
|
|
3235
3349
|
schema: fileSearchArgsSchema
|
|
3236
3350
|
});
|
|
@@ -3252,8 +3366,14 @@ async function prepareResponsesTools({
|
|
|
3252
3366
|
});
|
|
3253
3367
|
break;
|
|
3254
3368
|
}
|
|
3369
|
+
case "openai.apply_patch": {
|
|
3370
|
+
openaiTools2.push({
|
|
3371
|
+
type: "apply_patch"
|
|
3372
|
+
});
|
|
3373
|
+
break;
|
|
3374
|
+
}
|
|
3255
3375
|
case "openai.web_search_preview": {
|
|
3256
|
-
const args = await (0,
|
|
3376
|
+
const args = await (0, import_provider_utils25.validateTypes)({
|
|
3257
3377
|
value: tool.args,
|
|
3258
3378
|
schema: webSearchPreviewArgsSchema
|
|
3259
3379
|
});
|
|
@@ -3265,7 +3385,7 @@ async function prepareResponsesTools({
|
|
|
3265
3385
|
break;
|
|
3266
3386
|
}
|
|
3267
3387
|
case "openai.web_search": {
|
|
3268
|
-
const args = await (0,
|
|
3388
|
+
const args = await (0, import_provider_utils25.validateTypes)({
|
|
3269
3389
|
value: tool.args,
|
|
3270
3390
|
schema: webSearchArgsSchema
|
|
3271
3391
|
});
|
|
@@ -3279,7 +3399,7 @@ async function prepareResponsesTools({
|
|
|
3279
3399
|
break;
|
|
3280
3400
|
}
|
|
3281
3401
|
case "openai.code_interpreter": {
|
|
3282
|
-
const args = await (0,
|
|
3402
|
+
const args = await (0, import_provider_utils25.validateTypes)({
|
|
3283
3403
|
value: tool.args,
|
|
3284
3404
|
schema: codeInterpreterArgsSchema
|
|
3285
3405
|
});
|
|
@@ -3290,7 +3410,7 @@ async function prepareResponsesTools({
|
|
|
3290
3410
|
break;
|
|
3291
3411
|
}
|
|
3292
3412
|
case "openai.image_generation": {
|
|
3293
|
-
const args = await (0,
|
|
3413
|
+
const args = await (0, import_provider_utils25.validateTypes)({
|
|
3294
3414
|
value: tool.args,
|
|
3295
3415
|
schema: imageGenerationArgsSchema
|
|
3296
3416
|
});
|
|
@@ -3313,7 +3433,7 @@ async function prepareResponsesTools({
|
|
|
3313
3433
|
break;
|
|
3314
3434
|
}
|
|
3315
3435
|
case "openai.mcp": {
|
|
3316
|
-
const args = await (0,
|
|
3436
|
+
const args = await (0, import_provider_utils25.validateTypes)({
|
|
3317
3437
|
value: tool.args,
|
|
3318
3438
|
schema: mcpArgsSchema
|
|
3319
3439
|
});
|
|
@@ -3356,7 +3476,7 @@ async function prepareResponsesTools({
|
|
|
3356
3476
|
case "tool":
|
|
3357
3477
|
return {
|
|
3358
3478
|
tools: openaiTools2,
|
|
3359
|
-
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" || toolChoice.toolName === "mcp" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
3479
|
+
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" || toolChoice.toolName === "mcp" || toolChoice.toolName === "apply_patch" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
3360
3480
|
toolWarnings
|
|
3361
3481
|
};
|
|
3362
3482
|
default: {
|
|
@@ -3415,7 +3535,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3415
3535
|
if (stopSequences != null) {
|
|
3416
3536
|
warnings.push({ type: "unsupported", feature: "stopSequences" });
|
|
3417
3537
|
}
|
|
3418
|
-
const openaiOptions = await (0,
|
|
3538
|
+
const openaiOptions = await (0, import_provider_utils26.parseProviderOptions)({
|
|
3419
3539
|
provider: "openai",
|
|
3420
3540
|
providerOptions,
|
|
3421
3541
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -3427,7 +3547,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3427
3547
|
details: "conversation and previousResponseId cannot be used together"
|
|
3428
3548
|
});
|
|
3429
3549
|
}
|
|
3430
|
-
const toolNameMapping = (0,
|
|
3550
|
+
const toolNameMapping = (0, import_provider_utils26.createToolNameMapping)({
|
|
3431
3551
|
tools,
|
|
3432
3552
|
providerToolNames: {
|
|
3433
3553
|
"openai.code_interpreter": "code_interpreter",
|
|
@@ -3436,7 +3556,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3436
3556
|
"openai.local_shell": "local_shell",
|
|
3437
3557
|
"openai.web_search": "web_search",
|
|
3438
3558
|
"openai.web_search_preview": "web_search_preview",
|
|
3439
|
-
"openai.mcp": "mcp"
|
|
3559
|
+
"openai.mcp": "mcp",
|
|
3560
|
+
"openai.apply_patch": "apply_patch"
|
|
3440
3561
|
}
|
|
3441
3562
|
});
|
|
3442
3563
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
@@ -3445,10 +3566,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3445
3566
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
3446
3567
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
3447
3568
|
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
3448
|
-
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
3569
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
3570
|
+
hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
|
|
3449
3571
|
});
|
|
3450
3572
|
warnings.push(...inputWarnings);
|
|
3451
|
-
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b :
|
|
3573
|
+
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : true;
|
|
3452
3574
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
3453
3575
|
function addInclude(key) {
|
|
3454
3576
|
if (include == null) {
|
|
@@ -3614,12 +3736,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3614
3736
|
responseHeaders,
|
|
3615
3737
|
value: response,
|
|
3616
3738
|
rawValue: rawResponse
|
|
3617
|
-
} = await (0,
|
|
3739
|
+
} = await (0, import_provider_utils26.postJsonToApi)({
|
|
3618
3740
|
url,
|
|
3619
|
-
headers: (0,
|
|
3741
|
+
headers: (0, import_provider_utils26.combineHeaders)(this.config.headers(), options.headers),
|
|
3620
3742
|
body,
|
|
3621
3743
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3622
|
-
successfulResponseHandler: (0,
|
|
3744
|
+
successfulResponseHandler: (0, import_provider_utils26.createJsonResponseHandler)(
|
|
3623
3745
|
openaiResponsesResponseSchema
|
|
3624
3746
|
),
|
|
3625
3747
|
abortSignal: options.abortSignal,
|
|
@@ -3716,7 +3838,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3716
3838
|
content.push({
|
|
3717
3839
|
type: "source",
|
|
3718
3840
|
sourceType: "url",
|
|
3719
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
3841
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils26.generateId)(),
|
|
3720
3842
|
url: annotation.url,
|
|
3721
3843
|
title: annotation.title
|
|
3722
3844
|
});
|
|
@@ -3724,7 +3846,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3724
3846
|
content.push({
|
|
3725
3847
|
type: "source",
|
|
3726
3848
|
sourceType: "document",
|
|
3727
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
3849
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils26.generateId)(),
|
|
3728
3850
|
mediaType: "text/plain",
|
|
3729
3851
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3730
3852
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
|
|
@@ -3740,7 +3862,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3740
3862
|
content.push({
|
|
3741
3863
|
type: "source",
|
|
3742
3864
|
sourceType: "document",
|
|
3743
|
-
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0,
|
|
3865
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils26.generateId)(),
|
|
3744
3866
|
mediaType: "text/plain",
|
|
3745
3867
|
title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
|
|
3746
3868
|
filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
|
|
@@ -3756,7 +3878,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3756
3878
|
content.push({
|
|
3757
3879
|
type: "source",
|
|
3758
3880
|
sourceType: "document",
|
|
3759
|
-
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0,
|
|
3881
|
+
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils26.generateId)(),
|
|
3760
3882
|
mediaType: "application/octet-stream",
|
|
3761
3883
|
title: annotation.file_id,
|
|
3762
3884
|
filename: annotation.file_id,
|
|
@@ -3946,6 +4068,23 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3946
4068
|
});
|
|
3947
4069
|
break;
|
|
3948
4070
|
}
|
|
4071
|
+
case "apply_patch_call": {
|
|
4072
|
+
content.push({
|
|
4073
|
+
type: "tool-call",
|
|
4074
|
+
toolCallId: part.call_id,
|
|
4075
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4076
|
+
input: JSON.stringify({
|
|
4077
|
+
callId: part.call_id,
|
|
4078
|
+
operation: part.operation
|
|
4079
|
+
}),
|
|
4080
|
+
providerMetadata: {
|
|
4081
|
+
[providerKey]: {
|
|
4082
|
+
itemId: part.id
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4085
|
+
});
|
|
4086
|
+
break;
|
|
4087
|
+
}
|
|
3949
4088
|
}
|
|
3950
4089
|
}
|
|
3951
4090
|
const providerMetadata = {
|
|
@@ -3991,18 +4130,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3991
4130
|
toolNameMapping,
|
|
3992
4131
|
store
|
|
3993
4132
|
} = await this.getArgs(options);
|
|
3994
|
-
const { responseHeaders, value: response } = await (0,
|
|
4133
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils26.postJsonToApi)({
|
|
3995
4134
|
url: this.config.url({
|
|
3996
4135
|
path: "/responses",
|
|
3997
4136
|
modelId: this.modelId
|
|
3998
4137
|
}),
|
|
3999
|
-
headers: (0,
|
|
4138
|
+
headers: (0, import_provider_utils26.combineHeaders)(this.config.headers(), options.headers),
|
|
4000
4139
|
body: {
|
|
4001
4140
|
...body,
|
|
4002
4141
|
stream: true
|
|
4003
4142
|
},
|
|
4004
4143
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4005
|
-
successfulResponseHandler: (0,
|
|
4144
|
+
successfulResponseHandler: (0, import_provider_utils26.createEventSourceResponseHandler)(
|
|
4006
4145
|
openaiResponsesChunkSchema
|
|
4007
4146
|
),
|
|
4008
4147
|
abortSignal: options.abortSignal,
|
|
@@ -4133,6 +4272,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4133
4272
|
input: "{}",
|
|
4134
4273
|
providerExecuted: true
|
|
4135
4274
|
});
|
|
4275
|
+
} else if (value.item.type === "apply_patch_call") {
|
|
4276
|
+
ongoingToolCalls[value.output_index] = {
|
|
4277
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4278
|
+
toolCallId: value.item.call_id
|
|
4279
|
+
};
|
|
4280
|
+
if (value.item.status === "completed") {
|
|
4281
|
+
controller.enqueue({
|
|
4282
|
+
type: "tool-call",
|
|
4283
|
+
toolCallId: value.item.call_id,
|
|
4284
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4285
|
+
input: JSON.stringify({
|
|
4286
|
+
callId: value.item.call_id,
|
|
4287
|
+
operation: value.item.operation
|
|
4288
|
+
}),
|
|
4289
|
+
providerMetadata: {
|
|
4290
|
+
[providerKey]: {
|
|
4291
|
+
itemId: value.item.id
|
|
4292
|
+
}
|
|
4293
|
+
}
|
|
4294
|
+
});
|
|
4295
|
+
}
|
|
4136
4296
|
} else if (value.item.type === "message") {
|
|
4137
4297
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
4138
4298
|
controller.enqueue({
|
|
@@ -4296,6 +4456,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4296
4456
|
...value.item.error != null ? { error: value.item.error } : {}
|
|
4297
4457
|
}
|
|
4298
4458
|
});
|
|
4459
|
+
} else if (value.item.type === "apply_patch_call") {
|
|
4460
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
4461
|
+
if (value.item.status === "completed") {
|
|
4462
|
+
controller.enqueue({
|
|
4463
|
+
type: "tool-call",
|
|
4464
|
+
toolCallId: value.item.call_id,
|
|
4465
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4466
|
+
input: JSON.stringify({
|
|
4467
|
+
callId: value.item.call_id,
|
|
4468
|
+
operation: value.item.operation
|
|
4469
|
+
}),
|
|
4470
|
+
providerMetadata: {
|
|
4471
|
+
[providerKey]: {
|
|
4472
|
+
itemId: value.item.id
|
|
4473
|
+
}
|
|
4474
|
+
}
|
|
4475
|
+
});
|
|
4476
|
+
}
|
|
4299
4477
|
} else if (value.item.type === "mcp_approval_request") {
|
|
4300
4478
|
ongoingToolCalls[value.output_index] = void 0;
|
|
4301
4479
|
controller.enqueue({
|
|
@@ -4493,7 +4671,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4493
4671
|
controller.enqueue({
|
|
4494
4672
|
type: "source",
|
|
4495
4673
|
sourceType: "url",
|
|
4496
|
-
id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0,
|
|
4674
|
+
id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0, import_provider_utils26.generateId)(),
|
|
4497
4675
|
url: value.annotation.url,
|
|
4498
4676
|
title: value.annotation.title
|
|
4499
4677
|
});
|
|
@@ -4501,7 +4679,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4501
4679
|
controller.enqueue({
|
|
4502
4680
|
type: "source",
|
|
4503
4681
|
sourceType: "document",
|
|
4504
|
-
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0,
|
|
4682
|
+
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0, import_provider_utils26.generateId)(),
|
|
4505
4683
|
mediaType: "text/plain",
|
|
4506
4684
|
title: (_u = (_t = value.annotation.quote) != null ? _t : value.annotation.filename) != null ? _u : "Document",
|
|
4507
4685
|
filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
|
|
@@ -4517,7 +4695,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4517
4695
|
controller.enqueue({
|
|
4518
4696
|
type: "source",
|
|
4519
4697
|
sourceType: "document",
|
|
4520
|
-
id: (_y = (_x = (_w = self.config).generateId) == null ? void 0 : _x.call(_w)) != null ? _y : (0,
|
|
4698
|
+
id: (_y = (_x = (_w = self.config).generateId) == null ? void 0 : _x.call(_w)) != null ? _y : (0, import_provider_utils26.generateId)(),
|
|
4521
4699
|
mediaType: "text/plain",
|
|
4522
4700
|
title: (_A = (_z = value.annotation.filename) != null ? _z : value.annotation.file_id) != null ? _A : "Document",
|
|
4523
4701
|
filename: (_B = value.annotation.filename) != null ? _B : value.annotation.file_id,
|
|
@@ -4533,7 +4711,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4533
4711
|
controller.enqueue({
|
|
4534
4712
|
type: "source",
|
|
4535
4713
|
sourceType: "document",
|
|
4536
|
-
id: (_E = (_D = (_C = self.config).generateId) == null ? void 0 : _D.call(_C)) != null ? _E : (0,
|
|
4714
|
+
id: (_E = (_D = (_C = self.config).generateId) == null ? void 0 : _D.call(_C)) != null ? _E : (0, import_provider_utils26.generateId)(),
|
|
4537
4715
|
mediaType: "application/octet-stream",
|
|
4538
4716
|
title: value.annotation.file_id,
|
|
4539
4717
|
filename: value.annotation.file_id,
|
|
@@ -4639,16 +4817,16 @@ function mapWebSearchOutput(action) {
|
|
|
4639
4817
|
}
|
|
4640
4818
|
|
|
4641
4819
|
// src/speech/openai-speech-model.ts
|
|
4642
|
-
var
|
|
4820
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
4643
4821
|
|
|
4644
4822
|
// src/speech/openai-speech-options.ts
|
|
4645
|
-
var
|
|
4646
|
-
var
|
|
4647
|
-
var openaiSpeechProviderOptionsSchema = (0,
|
|
4648
|
-
() => (0,
|
|
4649
|
-
|
|
4650
|
-
instructions:
|
|
4651
|
-
speed:
|
|
4823
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
4824
|
+
var import_v420 = require("zod/v4");
|
|
4825
|
+
var openaiSpeechProviderOptionsSchema = (0, import_provider_utils27.lazySchema)(
|
|
4826
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
4827
|
+
import_v420.z.object({
|
|
4828
|
+
instructions: import_v420.z.string().nullish(),
|
|
4829
|
+
speed: import_v420.z.number().min(0.25).max(4).default(1).nullish()
|
|
4652
4830
|
})
|
|
4653
4831
|
)
|
|
4654
4832
|
);
|
|
@@ -4673,7 +4851,7 @@ var OpenAISpeechModel = class {
|
|
|
4673
4851
|
providerOptions
|
|
4674
4852
|
}) {
|
|
4675
4853
|
const warnings = [];
|
|
4676
|
-
const openAIOptions = await (0,
|
|
4854
|
+
const openAIOptions = await (0, import_provider_utils28.parseProviderOptions)({
|
|
4677
4855
|
provider: "openai",
|
|
4678
4856
|
providerOptions,
|
|
4679
4857
|
schema: openaiSpeechProviderOptionsSchema
|
|
@@ -4726,15 +4904,15 @@ var OpenAISpeechModel = class {
|
|
|
4726
4904
|
value: audio,
|
|
4727
4905
|
responseHeaders,
|
|
4728
4906
|
rawValue: rawResponse
|
|
4729
|
-
} = await (0,
|
|
4907
|
+
} = await (0, import_provider_utils28.postJsonToApi)({
|
|
4730
4908
|
url: this.config.url({
|
|
4731
4909
|
path: "/audio/speech",
|
|
4732
4910
|
modelId: this.modelId
|
|
4733
4911
|
}),
|
|
4734
|
-
headers: (0,
|
|
4912
|
+
headers: (0, import_provider_utils28.combineHeaders)(this.config.headers(), options.headers),
|
|
4735
4913
|
body: requestBody,
|
|
4736
4914
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4737
|
-
successfulResponseHandler: (0,
|
|
4915
|
+
successfulResponseHandler: (0, import_provider_utils28.createBinaryResponseHandler)(),
|
|
4738
4916
|
abortSignal: options.abortSignal,
|
|
4739
4917
|
fetch: this.config.fetch
|
|
4740
4918
|
});
|
|
@@ -4755,36 +4933,36 @@ var OpenAISpeechModel = class {
|
|
|
4755
4933
|
};
|
|
4756
4934
|
|
|
4757
4935
|
// src/transcription/openai-transcription-model.ts
|
|
4758
|
-
var
|
|
4936
|
+
var import_provider_utils31 = require("@ai-sdk/provider-utils");
|
|
4759
4937
|
|
|
4760
4938
|
// src/transcription/openai-transcription-api.ts
|
|
4761
|
-
var
|
|
4762
|
-
var
|
|
4763
|
-
var openaiTranscriptionResponseSchema = (0,
|
|
4764
|
-
() => (0,
|
|
4765
|
-
|
|
4766
|
-
text:
|
|
4767
|
-
language:
|
|
4768
|
-
duration:
|
|
4769
|
-
words:
|
|
4770
|
-
|
|
4771
|
-
word:
|
|
4772
|
-
start:
|
|
4773
|
-
end:
|
|
4939
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
4940
|
+
var import_v421 = require("zod/v4");
|
|
4941
|
+
var openaiTranscriptionResponseSchema = (0, import_provider_utils29.lazySchema)(
|
|
4942
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
4943
|
+
import_v421.z.object({
|
|
4944
|
+
text: import_v421.z.string(),
|
|
4945
|
+
language: import_v421.z.string().nullish(),
|
|
4946
|
+
duration: import_v421.z.number().nullish(),
|
|
4947
|
+
words: import_v421.z.array(
|
|
4948
|
+
import_v421.z.object({
|
|
4949
|
+
word: import_v421.z.string(),
|
|
4950
|
+
start: import_v421.z.number(),
|
|
4951
|
+
end: import_v421.z.number()
|
|
4774
4952
|
})
|
|
4775
4953
|
).nullish(),
|
|
4776
|
-
segments:
|
|
4777
|
-
|
|
4778
|
-
id:
|
|
4779
|
-
seek:
|
|
4780
|
-
start:
|
|
4781
|
-
end:
|
|
4782
|
-
text:
|
|
4783
|
-
tokens:
|
|
4784
|
-
temperature:
|
|
4785
|
-
avg_logprob:
|
|
4786
|
-
compression_ratio:
|
|
4787
|
-
no_speech_prob:
|
|
4954
|
+
segments: import_v421.z.array(
|
|
4955
|
+
import_v421.z.object({
|
|
4956
|
+
id: import_v421.z.number(),
|
|
4957
|
+
seek: import_v421.z.number(),
|
|
4958
|
+
start: import_v421.z.number(),
|
|
4959
|
+
end: import_v421.z.number(),
|
|
4960
|
+
text: import_v421.z.string(),
|
|
4961
|
+
tokens: import_v421.z.array(import_v421.z.number()),
|
|
4962
|
+
temperature: import_v421.z.number(),
|
|
4963
|
+
avg_logprob: import_v421.z.number(),
|
|
4964
|
+
compression_ratio: import_v421.z.number(),
|
|
4965
|
+
no_speech_prob: import_v421.z.number()
|
|
4788
4966
|
})
|
|
4789
4967
|
).nullish()
|
|
4790
4968
|
})
|
|
@@ -4792,33 +4970,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils28.lazySchema)(
|
|
|
4792
4970
|
);
|
|
4793
4971
|
|
|
4794
4972
|
// src/transcription/openai-transcription-options.ts
|
|
4795
|
-
var
|
|
4796
|
-
var
|
|
4797
|
-
var openAITranscriptionProviderOptions = (0,
|
|
4798
|
-
() => (0,
|
|
4799
|
-
|
|
4973
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
4974
|
+
var import_v422 = require("zod/v4");
|
|
4975
|
+
var openAITranscriptionProviderOptions = (0, import_provider_utils30.lazySchema)(
|
|
4976
|
+
() => (0, import_provider_utils30.zodSchema)(
|
|
4977
|
+
import_v422.z.object({
|
|
4800
4978
|
/**
|
|
4801
4979
|
* Additional information to include in the transcription response.
|
|
4802
4980
|
*/
|
|
4803
|
-
include:
|
|
4981
|
+
include: import_v422.z.array(import_v422.z.string()).optional(),
|
|
4804
4982
|
/**
|
|
4805
4983
|
* The language of the input audio in ISO-639-1 format.
|
|
4806
4984
|
*/
|
|
4807
|
-
language:
|
|
4985
|
+
language: import_v422.z.string().optional(),
|
|
4808
4986
|
/**
|
|
4809
4987
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
4810
4988
|
*/
|
|
4811
|
-
prompt:
|
|
4989
|
+
prompt: import_v422.z.string().optional(),
|
|
4812
4990
|
/**
|
|
4813
4991
|
* The sampling temperature, between 0 and 1.
|
|
4814
4992
|
* @default 0
|
|
4815
4993
|
*/
|
|
4816
|
-
temperature:
|
|
4994
|
+
temperature: import_v422.z.number().min(0).max(1).default(0).optional(),
|
|
4817
4995
|
/**
|
|
4818
4996
|
* The timestamp granularities to populate for this transcription.
|
|
4819
4997
|
* @default ['segment']
|
|
4820
4998
|
*/
|
|
4821
|
-
timestampGranularities:
|
|
4999
|
+
timestampGranularities: import_v422.z.array(import_v422.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
4822
5000
|
})
|
|
4823
5001
|
)
|
|
4824
5002
|
);
|
|
@@ -4898,15 +5076,15 @@ var OpenAITranscriptionModel = class {
|
|
|
4898
5076
|
providerOptions
|
|
4899
5077
|
}) {
|
|
4900
5078
|
const warnings = [];
|
|
4901
|
-
const openAIOptions = await (0,
|
|
5079
|
+
const openAIOptions = await (0, import_provider_utils31.parseProviderOptions)({
|
|
4902
5080
|
provider: "openai",
|
|
4903
5081
|
providerOptions,
|
|
4904
5082
|
schema: openAITranscriptionProviderOptions
|
|
4905
5083
|
});
|
|
4906
5084
|
const formData = new FormData();
|
|
4907
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0,
|
|
5085
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils31.convertBase64ToUint8Array)(audio)]);
|
|
4908
5086
|
formData.append("model", this.modelId);
|
|
4909
|
-
const fileExtension = (0,
|
|
5087
|
+
const fileExtension = (0, import_provider_utils31.mediaTypeToExtension)(mediaType);
|
|
4910
5088
|
formData.append(
|
|
4911
5089
|
"file",
|
|
4912
5090
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -4951,15 +5129,15 @@ var OpenAITranscriptionModel = class {
|
|
|
4951
5129
|
value: response,
|
|
4952
5130
|
responseHeaders,
|
|
4953
5131
|
rawValue: rawResponse
|
|
4954
|
-
} = await (0,
|
|
5132
|
+
} = await (0, import_provider_utils31.postFormDataToApi)({
|
|
4955
5133
|
url: this.config.url({
|
|
4956
5134
|
path: "/audio/transcriptions",
|
|
4957
5135
|
modelId: this.modelId
|
|
4958
5136
|
}),
|
|
4959
|
-
headers: (0,
|
|
5137
|
+
headers: (0, import_provider_utils31.combineHeaders)(this.config.headers(), options.headers),
|
|
4960
5138
|
formData,
|
|
4961
5139
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4962
|
-
successfulResponseHandler: (0,
|
|
5140
|
+
successfulResponseHandler: (0, import_provider_utils31.createJsonResponseHandler)(
|
|
4963
5141
|
openaiTranscriptionResponseSchema
|
|
4964
5142
|
),
|
|
4965
5143
|
abortSignal: options.abortSignal,
|
|
@@ -4991,21 +5169,21 @@ var OpenAITranscriptionModel = class {
|
|
|
4991
5169
|
};
|
|
4992
5170
|
|
|
4993
5171
|
// src/version.ts
|
|
4994
|
-
var VERSION = true ? "3.0.0-beta.
|
|
5172
|
+
var VERSION = true ? "3.0.0-beta.75" : "0.0.0-test";
|
|
4995
5173
|
|
|
4996
5174
|
// src/openai-provider.ts
|
|
4997
5175
|
function createOpenAI(options = {}) {
|
|
4998
5176
|
var _a, _b;
|
|
4999
|
-
const baseURL = (_a = (0,
|
|
5000
|
-
(0,
|
|
5177
|
+
const baseURL = (_a = (0, import_provider_utils32.withoutTrailingSlash)(
|
|
5178
|
+
(0, import_provider_utils32.loadOptionalSetting)({
|
|
5001
5179
|
settingValue: options.baseURL,
|
|
5002
5180
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
5003
5181
|
})
|
|
5004
5182
|
)) != null ? _a : "https://api.openai.com/v1";
|
|
5005
5183
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
5006
|
-
const getHeaders = () => (0,
|
|
5184
|
+
const getHeaders = () => (0, import_provider_utils32.withUserAgentSuffix)(
|
|
5007
5185
|
{
|
|
5008
|
-
Authorization: `Bearer ${(0,
|
|
5186
|
+
Authorization: `Bearer ${(0, import_provider_utils32.loadApiKey)({
|
|
5009
5187
|
apiKey: options.apiKey,
|
|
5010
5188
|
environmentVariableName: "OPENAI_API_KEY",
|
|
5011
5189
|
description: "OpenAI"
|