@ai-sdk/openai 3.0.0-beta.73 → 3.0.0-beta.74
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 +6 -0
- package/dist/index.d.mts +55 -1
- package/dist/index.d.ts +55 -1
- package/dist/index.js +960 -766
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +926 -728
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +128 -1
- package/dist/internal/index.d.ts +128 -1
- package/dist/internal/index.js +903 -707
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +883 -688
- 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");
|
|
@@ -1753,42 +1753,84 @@ var OpenAIImageModel = class {
|
|
|
1753
1753
|
}
|
|
1754
1754
|
};
|
|
1755
1755
|
|
|
1756
|
-
// src/tool/
|
|
1756
|
+
// src/tool/apply-patch.ts
|
|
1757
1757
|
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
1758
1758
|
var import_v49 = require("zod/v4");
|
|
1759
|
-
var
|
|
1759
|
+
var applyPatchInputSchema = (0, import_provider_utils14.lazySchema)(
|
|
1760
1760
|
() => (0, import_provider_utils14.zodSchema)(
|
|
1761
1761
|
import_v49.z.object({
|
|
1762
|
-
|
|
1763
|
-
|
|
1762
|
+
callId: import_v49.z.string(),
|
|
1763
|
+
operation: import_v49.z.discriminatedUnion("type", [
|
|
1764
|
+
import_v49.z.object({
|
|
1765
|
+
type: import_v49.z.literal("create_file"),
|
|
1766
|
+
path: import_v49.z.string(),
|
|
1767
|
+
diff: import_v49.z.string()
|
|
1768
|
+
}),
|
|
1769
|
+
import_v49.z.object({
|
|
1770
|
+
type: import_v49.z.literal("delete_file"),
|
|
1771
|
+
path: import_v49.z.string()
|
|
1772
|
+
}),
|
|
1773
|
+
import_v49.z.object({
|
|
1774
|
+
type: import_v49.z.literal("update_file"),
|
|
1775
|
+
path: import_v49.z.string(),
|
|
1776
|
+
diff: import_v49.z.string()
|
|
1777
|
+
})
|
|
1778
|
+
])
|
|
1764
1779
|
})
|
|
1765
1780
|
)
|
|
1766
1781
|
);
|
|
1767
|
-
var
|
|
1782
|
+
var applyPatchOutputSchema = (0, import_provider_utils14.lazySchema)(
|
|
1768
1783
|
() => (0, import_provider_utils14.zodSchema)(
|
|
1769
1784
|
import_v49.z.object({
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1785
|
+
status: import_v49.z.enum(["completed", "failed"]),
|
|
1786
|
+
output: import_v49.z.string().optional()
|
|
1787
|
+
})
|
|
1788
|
+
)
|
|
1789
|
+
);
|
|
1790
|
+
var applyPatchArgsSchema = (0, import_provider_utils14.lazySchema)(() => (0, import_provider_utils14.zodSchema)(import_v49.z.object({})));
|
|
1791
|
+
var applyPatchToolFactory = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
|
|
1792
|
+
id: "openai.apply_patch",
|
|
1793
|
+
inputSchema: applyPatchInputSchema,
|
|
1794
|
+
outputSchema: applyPatchOutputSchema
|
|
1795
|
+
});
|
|
1796
|
+
var applyPatch = () => applyPatchToolFactory({});
|
|
1797
|
+
|
|
1798
|
+
// src/tool/code-interpreter.ts
|
|
1799
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
1800
|
+
var import_v410 = require("zod/v4");
|
|
1801
|
+
var codeInterpreterInputSchema = (0, import_provider_utils15.lazySchema)(
|
|
1802
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
1803
|
+
import_v410.z.object({
|
|
1804
|
+
code: import_v410.z.string().nullish(),
|
|
1805
|
+
containerId: import_v410.z.string()
|
|
1806
|
+
})
|
|
1807
|
+
)
|
|
1808
|
+
);
|
|
1809
|
+
var codeInterpreterOutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
1810
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
1811
|
+
import_v410.z.object({
|
|
1812
|
+
outputs: import_v410.z.array(
|
|
1813
|
+
import_v410.z.discriminatedUnion("type", [
|
|
1814
|
+
import_v410.z.object({ type: import_v410.z.literal("logs"), logs: import_v410.z.string() }),
|
|
1815
|
+
import_v410.z.object({ type: import_v410.z.literal("image"), url: import_v410.z.string() })
|
|
1774
1816
|
])
|
|
1775
1817
|
).nullish()
|
|
1776
1818
|
})
|
|
1777
1819
|
)
|
|
1778
1820
|
);
|
|
1779
|
-
var codeInterpreterArgsSchema = (0,
|
|
1780
|
-
() => (0,
|
|
1781
|
-
|
|
1782
|
-
container:
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
fileIds:
|
|
1821
|
+
var codeInterpreterArgsSchema = (0, import_provider_utils15.lazySchema)(
|
|
1822
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
1823
|
+
import_v410.z.object({
|
|
1824
|
+
container: import_v410.z.union([
|
|
1825
|
+
import_v410.z.string(),
|
|
1826
|
+
import_v410.z.object({
|
|
1827
|
+
fileIds: import_v410.z.array(import_v410.z.string()).optional()
|
|
1786
1828
|
})
|
|
1787
1829
|
]).optional()
|
|
1788
1830
|
})
|
|
1789
1831
|
)
|
|
1790
1832
|
);
|
|
1791
|
-
var codeInterpreterToolFactory = (0,
|
|
1833
|
+
var codeInterpreterToolFactory = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
|
|
1792
1834
|
id: "openai.code_interpreter",
|
|
1793
1835
|
inputSchema: codeInterpreterInputSchema,
|
|
1794
1836
|
outputSchema: codeInterpreterOutputSchema
|
|
@@ -1798,81 +1840,81 @@ var codeInterpreter = (args = {}) => {
|
|
|
1798
1840
|
};
|
|
1799
1841
|
|
|
1800
1842
|
// src/tool/file-search.ts
|
|
1801
|
-
var
|
|
1802
|
-
var
|
|
1803
|
-
var comparisonFilterSchema =
|
|
1804
|
-
key:
|
|
1805
|
-
type:
|
|
1806
|
-
value:
|
|
1843
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
1844
|
+
var import_v411 = require("zod/v4");
|
|
1845
|
+
var comparisonFilterSchema = import_v411.z.object({
|
|
1846
|
+
key: import_v411.z.string(),
|
|
1847
|
+
type: import_v411.z.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
|
|
1848
|
+
value: import_v411.z.union([import_v411.z.string(), import_v411.z.number(), import_v411.z.boolean()])
|
|
1807
1849
|
});
|
|
1808
|
-
var compoundFilterSchema =
|
|
1809
|
-
type:
|
|
1810
|
-
filters:
|
|
1811
|
-
|
|
1850
|
+
var compoundFilterSchema = import_v411.z.object({
|
|
1851
|
+
type: import_v411.z.enum(["and", "or"]),
|
|
1852
|
+
filters: import_v411.z.array(
|
|
1853
|
+
import_v411.z.union([comparisonFilterSchema, import_v411.z.lazy(() => compoundFilterSchema)])
|
|
1812
1854
|
)
|
|
1813
1855
|
});
|
|
1814
|
-
var fileSearchArgsSchema = (0,
|
|
1815
|
-
() => (0,
|
|
1816
|
-
|
|
1817
|
-
vectorStoreIds:
|
|
1818
|
-
maxNumResults:
|
|
1819
|
-
ranking:
|
|
1820
|
-
ranker:
|
|
1821
|
-
scoreThreshold:
|
|
1856
|
+
var fileSearchArgsSchema = (0, import_provider_utils16.lazySchema)(
|
|
1857
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
1858
|
+
import_v411.z.object({
|
|
1859
|
+
vectorStoreIds: import_v411.z.array(import_v411.z.string()),
|
|
1860
|
+
maxNumResults: import_v411.z.number().optional(),
|
|
1861
|
+
ranking: import_v411.z.object({
|
|
1862
|
+
ranker: import_v411.z.string().optional(),
|
|
1863
|
+
scoreThreshold: import_v411.z.number().optional()
|
|
1822
1864
|
}).optional(),
|
|
1823
|
-
filters:
|
|
1865
|
+
filters: import_v411.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
1824
1866
|
})
|
|
1825
1867
|
)
|
|
1826
1868
|
);
|
|
1827
|
-
var fileSearchOutputSchema = (0,
|
|
1828
|
-
() => (0,
|
|
1829
|
-
|
|
1830
|
-
queries:
|
|
1831
|
-
results:
|
|
1832
|
-
|
|
1833
|
-
attributes:
|
|
1834
|
-
fileId:
|
|
1835
|
-
filename:
|
|
1836
|
-
score:
|
|
1837
|
-
text:
|
|
1869
|
+
var fileSearchOutputSchema = (0, import_provider_utils16.lazySchema)(
|
|
1870
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
1871
|
+
import_v411.z.object({
|
|
1872
|
+
queries: import_v411.z.array(import_v411.z.string()),
|
|
1873
|
+
results: import_v411.z.array(
|
|
1874
|
+
import_v411.z.object({
|
|
1875
|
+
attributes: import_v411.z.record(import_v411.z.string(), import_v411.z.unknown()),
|
|
1876
|
+
fileId: import_v411.z.string(),
|
|
1877
|
+
filename: import_v411.z.string(),
|
|
1878
|
+
score: import_v411.z.number(),
|
|
1879
|
+
text: import_v411.z.string()
|
|
1838
1880
|
})
|
|
1839
1881
|
).nullable()
|
|
1840
1882
|
})
|
|
1841
1883
|
)
|
|
1842
1884
|
);
|
|
1843
|
-
var fileSearch = (0,
|
|
1885
|
+
var fileSearch = (0, import_provider_utils16.createProviderToolFactoryWithOutputSchema)({
|
|
1844
1886
|
id: "openai.file_search",
|
|
1845
|
-
inputSchema:
|
|
1887
|
+
inputSchema: import_v411.z.object({}),
|
|
1846
1888
|
outputSchema: fileSearchOutputSchema
|
|
1847
1889
|
});
|
|
1848
1890
|
|
|
1849
1891
|
// 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:
|
|
1892
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
1893
|
+
var import_v412 = require("zod/v4");
|
|
1894
|
+
var imageGenerationArgsSchema = (0, import_provider_utils17.lazySchema)(
|
|
1895
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
1896
|
+
import_v412.z.object({
|
|
1897
|
+
background: import_v412.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
1898
|
+
inputFidelity: import_v412.z.enum(["low", "high"]).optional(),
|
|
1899
|
+
inputImageMask: import_v412.z.object({
|
|
1900
|
+
fileId: import_v412.z.string().optional(),
|
|
1901
|
+
imageUrl: import_v412.z.string().optional()
|
|
1860
1902
|
}).optional(),
|
|
1861
|
-
model:
|
|
1862
|
-
moderation:
|
|
1863
|
-
outputCompression:
|
|
1864
|
-
outputFormat:
|
|
1865
|
-
partialImages:
|
|
1866
|
-
quality:
|
|
1867
|
-
size:
|
|
1903
|
+
model: import_v412.z.string().optional(),
|
|
1904
|
+
moderation: import_v412.z.enum(["auto"]).optional(),
|
|
1905
|
+
outputCompression: import_v412.z.number().int().min(0).max(100).optional(),
|
|
1906
|
+
outputFormat: import_v412.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
1907
|
+
partialImages: import_v412.z.number().int().min(0).max(3).optional(),
|
|
1908
|
+
quality: import_v412.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
1909
|
+
size: import_v412.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
1868
1910
|
}).strict()
|
|
1869
1911
|
)
|
|
1870
1912
|
);
|
|
1871
|
-
var imageGenerationInputSchema = (0,
|
|
1872
|
-
var imageGenerationOutputSchema = (0,
|
|
1873
|
-
() => (0,
|
|
1913
|
+
var imageGenerationInputSchema = (0, import_provider_utils17.lazySchema)(() => (0, import_provider_utils17.zodSchema)(import_v412.z.object({})));
|
|
1914
|
+
var imageGenerationOutputSchema = (0, import_provider_utils17.lazySchema)(
|
|
1915
|
+
() => (0, import_provider_utils17.zodSchema)(import_v412.z.object({ result: import_v412.z.string() }))
|
|
1874
1916
|
);
|
|
1875
|
-
var imageGenerationToolFactory = (0,
|
|
1917
|
+
var imageGenerationToolFactory = (0, import_provider_utils17.createProviderToolFactoryWithOutputSchema)({
|
|
1876
1918
|
id: "openai.image_generation",
|
|
1877
1919
|
inputSchema: imageGenerationInputSchema,
|
|
1878
1920
|
outputSchema: imageGenerationOutputSchema
|
|
@@ -1882,91 +1924,39 @@ var imageGeneration = (args = {}) => {
|
|
|
1882
1924
|
};
|
|
1883
1925
|
|
|
1884
1926
|
// 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:
|
|
1927
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
1928
|
+
var import_v413 = require("zod/v4");
|
|
1929
|
+
var localShellInputSchema = (0, import_provider_utils18.lazySchema)(
|
|
1930
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
1931
|
+
import_v413.z.object({
|
|
1932
|
+
action: import_v413.z.object({
|
|
1933
|
+
type: import_v413.z.literal("exec"),
|
|
1934
|
+
command: import_v413.z.array(import_v413.z.string()),
|
|
1935
|
+
timeoutMs: import_v413.z.number().optional(),
|
|
1936
|
+
user: import_v413.z.string().optional(),
|
|
1937
|
+
workingDirectory: import_v413.z.string().optional(),
|
|
1938
|
+
env: import_v413.z.record(import_v413.z.string(), import_v413.z.string()).optional()
|
|
1897
1939
|
})
|
|
1898
1940
|
})
|
|
1899
1941
|
)
|
|
1900
1942
|
);
|
|
1901
|
-
var localShellOutputSchema = (0,
|
|
1902
|
-
() => (0,
|
|
1943
|
+
var localShellOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
1944
|
+
() => (0, import_provider_utils18.zodSchema)(import_v413.z.object({ output: import_v413.z.string() }))
|
|
1903
1945
|
);
|
|
1904
|
-
var localShell = (0,
|
|
1946
|
+
var localShell = (0, import_provider_utils18.createProviderToolFactoryWithOutputSchema)({
|
|
1905
1947
|
id: "openai.local_shell",
|
|
1906
1948
|
inputSchema: localShellInputSchema,
|
|
1907
1949
|
outputSchema: localShellOutputSchema
|
|
1908
1950
|
});
|
|
1909
1951
|
|
|
1910
1952
|
// 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
1953
|
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
1966
1954
|
var import_v414 = require("zod/v4");
|
|
1967
|
-
var
|
|
1955
|
+
var webSearchArgsSchema = (0, import_provider_utils19.lazySchema)(
|
|
1968
1956
|
() => (0, import_provider_utils19.zodSchema)(
|
|
1969
1957
|
import_v414.z.object({
|
|
1958
|
+
externalWebAccess: import_v414.z.boolean().optional(),
|
|
1959
|
+
filters: import_v414.z.object({ allowedDomains: import_v414.z.array(import_v414.z.string()).optional() }).optional(),
|
|
1970
1960
|
searchContextSize: import_v414.z.enum(["low", "medium", "high"]).optional(),
|
|
1971
1961
|
userLocation: import_v414.z.object({
|
|
1972
1962
|
type: import_v414.z.literal("approximate"),
|
|
@@ -1978,10 +1968,8 @@ var webSearchPreviewArgsSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
1978
1968
|
})
|
|
1979
1969
|
)
|
|
1980
1970
|
);
|
|
1981
|
-
var
|
|
1982
|
-
|
|
1983
|
-
);
|
|
1984
|
-
var webSearchPreviewOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
1971
|
+
var webSearchInputSchema = (0, import_provider_utils19.lazySchema)(() => (0, import_provider_utils19.zodSchema)(import_v414.z.object({})));
|
|
1972
|
+
var webSearchOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
1985
1973
|
() => (0, import_provider_utils19.zodSchema)(
|
|
1986
1974
|
import_v414.z.object({
|
|
1987
1975
|
action: import_v414.z.discriminatedUnion("type", [
|
|
@@ -1998,43 +1986,97 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
1998
1986
|
url: import_v414.z.string(),
|
|
1999
1987
|
pattern: import_v414.z.string()
|
|
2000
1988
|
})
|
|
1989
|
+
]),
|
|
1990
|
+
sources: import_v414.z.array(
|
|
1991
|
+
import_v414.z.discriminatedUnion("type", [
|
|
1992
|
+
import_v414.z.object({ type: import_v414.z.literal("url"), url: import_v414.z.string() }),
|
|
1993
|
+
import_v414.z.object({ type: import_v414.z.literal("api"), name: import_v414.z.string() })
|
|
1994
|
+
])
|
|
1995
|
+
).optional()
|
|
1996
|
+
})
|
|
1997
|
+
)
|
|
1998
|
+
);
|
|
1999
|
+
var webSearchToolFactory = (0, import_provider_utils19.createProviderToolFactoryWithOutputSchema)({
|
|
2000
|
+
id: "openai.web_search",
|
|
2001
|
+
inputSchema: webSearchInputSchema,
|
|
2002
|
+
outputSchema: webSearchOutputSchema
|
|
2003
|
+
});
|
|
2004
|
+
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2005
|
+
|
|
2006
|
+
// src/tool/web-search-preview.ts
|
|
2007
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2008
|
+
var import_v415 = require("zod/v4");
|
|
2009
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
2010
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2011
|
+
import_v415.z.object({
|
|
2012
|
+
searchContextSize: import_v415.z.enum(["low", "medium", "high"]).optional(),
|
|
2013
|
+
userLocation: import_v415.z.object({
|
|
2014
|
+
type: import_v415.z.literal("approximate"),
|
|
2015
|
+
country: import_v415.z.string().optional(),
|
|
2016
|
+
city: import_v415.z.string().optional(),
|
|
2017
|
+
region: import_v415.z.string().optional(),
|
|
2018
|
+
timezone: import_v415.z.string().optional()
|
|
2019
|
+
}).optional()
|
|
2020
|
+
})
|
|
2021
|
+
)
|
|
2022
|
+
);
|
|
2023
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2024
|
+
() => (0, import_provider_utils20.zodSchema)(import_v415.z.object({}))
|
|
2025
|
+
);
|
|
2026
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2027
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2028
|
+
import_v415.z.object({
|
|
2029
|
+
action: import_v415.z.discriminatedUnion("type", [
|
|
2030
|
+
import_v415.z.object({
|
|
2031
|
+
type: import_v415.z.literal("search"),
|
|
2032
|
+
query: import_v415.z.string().optional()
|
|
2033
|
+
}),
|
|
2034
|
+
import_v415.z.object({
|
|
2035
|
+
type: import_v415.z.literal("openPage"),
|
|
2036
|
+
url: import_v415.z.string()
|
|
2037
|
+
}),
|
|
2038
|
+
import_v415.z.object({
|
|
2039
|
+
type: import_v415.z.literal("find"),
|
|
2040
|
+
url: import_v415.z.string(),
|
|
2041
|
+
pattern: import_v415.z.string()
|
|
2042
|
+
})
|
|
2001
2043
|
])
|
|
2002
2044
|
})
|
|
2003
2045
|
)
|
|
2004
2046
|
);
|
|
2005
|
-
var webSearchPreview = (0,
|
|
2047
|
+
var webSearchPreview = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchema)({
|
|
2006
2048
|
id: "openai.web_search_preview",
|
|
2007
2049
|
inputSchema: webSearchPreviewInputSchema,
|
|
2008
2050
|
outputSchema: webSearchPreviewOutputSchema
|
|
2009
2051
|
});
|
|
2010
2052
|
|
|
2011
2053
|
// src/tool/mcp.ts
|
|
2012
|
-
var
|
|
2013
|
-
var
|
|
2014
|
-
var jsonValueSchema =
|
|
2015
|
-
() =>
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2054
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2055
|
+
var import_v416 = require("zod/v4");
|
|
2056
|
+
var jsonValueSchema = import_v416.z.lazy(
|
|
2057
|
+
() => import_v416.z.union([
|
|
2058
|
+
import_v416.z.string(),
|
|
2059
|
+
import_v416.z.number(),
|
|
2060
|
+
import_v416.z.boolean(),
|
|
2061
|
+
import_v416.z.null(),
|
|
2062
|
+
import_v416.z.array(jsonValueSchema),
|
|
2063
|
+
import_v416.z.record(import_v416.z.string(), jsonValueSchema)
|
|
2022
2064
|
])
|
|
2023
2065
|
);
|
|
2024
|
-
var mcpArgsSchema = (0,
|
|
2025
|
-
() => (0,
|
|
2026
|
-
|
|
2027
|
-
serverLabel:
|
|
2028
|
-
allowedTools:
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
readOnly:
|
|
2032
|
-
toolNames:
|
|
2066
|
+
var mcpArgsSchema = (0, import_provider_utils21.lazySchema)(
|
|
2067
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2068
|
+
import_v416.z.object({
|
|
2069
|
+
serverLabel: import_v416.z.string(),
|
|
2070
|
+
allowedTools: import_v416.z.union([
|
|
2071
|
+
import_v416.z.array(import_v416.z.string()),
|
|
2072
|
+
import_v416.z.object({
|
|
2073
|
+
readOnly: import_v416.z.boolean().optional(),
|
|
2074
|
+
toolNames: import_v416.z.array(import_v416.z.string()).optional()
|
|
2033
2075
|
})
|
|
2034
2076
|
]).optional(),
|
|
2035
|
-
authorization:
|
|
2036
|
-
connectorId:
|
|
2037
|
-
headers:
|
|
2077
|
+
authorization: import_v416.z.string().optional(),
|
|
2078
|
+
connectorId: import_v416.z.string().optional(),
|
|
2079
|
+
headers: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional(),
|
|
2038
2080
|
// TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
|
|
2039
2081
|
// requireApproval: z
|
|
2040
2082
|
// .union([
|
|
@@ -2045,50 +2087,50 @@ var mcpArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
2045
2087
|
// }),
|
|
2046
2088
|
// ])
|
|
2047
2089
|
// .optional(),
|
|
2048
|
-
serverDescription:
|
|
2049
|
-
serverUrl:
|
|
2090
|
+
serverDescription: import_v416.z.string().optional(),
|
|
2091
|
+
serverUrl: import_v416.z.string().optional()
|
|
2050
2092
|
}).refine(
|
|
2051
2093
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
2052
2094
|
"One of serverUrl or connectorId must be provided."
|
|
2053
2095
|
)
|
|
2054
2096
|
)
|
|
2055
2097
|
);
|
|
2056
|
-
var mcpInputSchema = (0,
|
|
2057
|
-
var mcpOutputSchema = (0,
|
|
2058
|
-
() => (0,
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
type:
|
|
2062
|
-
serverLabel:
|
|
2063
|
-
name:
|
|
2064
|
-
arguments:
|
|
2065
|
-
output:
|
|
2066
|
-
error:
|
|
2098
|
+
var mcpInputSchema = (0, import_provider_utils21.lazySchema)(() => (0, import_provider_utils21.zodSchema)(import_v416.z.object({})));
|
|
2099
|
+
var mcpOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2100
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2101
|
+
import_v416.z.discriminatedUnion("type", [
|
|
2102
|
+
import_v416.z.object({
|
|
2103
|
+
type: import_v416.z.literal("call"),
|
|
2104
|
+
serverLabel: import_v416.z.string(),
|
|
2105
|
+
name: import_v416.z.string(),
|
|
2106
|
+
arguments: import_v416.z.string(),
|
|
2107
|
+
output: import_v416.z.string().nullable().optional(),
|
|
2108
|
+
error: import_v416.z.union([import_v416.z.string(), jsonValueSchema]).optional()
|
|
2067
2109
|
}),
|
|
2068
|
-
|
|
2069
|
-
type:
|
|
2070
|
-
serverLabel:
|
|
2071
|
-
tools:
|
|
2072
|
-
|
|
2073
|
-
name:
|
|
2074
|
-
description:
|
|
2110
|
+
import_v416.z.object({
|
|
2111
|
+
type: import_v416.z.literal("listTools"),
|
|
2112
|
+
serverLabel: import_v416.z.string(),
|
|
2113
|
+
tools: import_v416.z.array(
|
|
2114
|
+
import_v416.z.object({
|
|
2115
|
+
name: import_v416.z.string(),
|
|
2116
|
+
description: import_v416.z.string().optional(),
|
|
2075
2117
|
inputSchema: jsonValueSchema,
|
|
2076
|
-
annotations:
|
|
2118
|
+
annotations: import_v416.z.record(import_v416.z.string(), jsonValueSchema).optional()
|
|
2077
2119
|
})
|
|
2078
2120
|
),
|
|
2079
|
-
error:
|
|
2121
|
+
error: import_v416.z.union([import_v416.z.string(), jsonValueSchema]).optional()
|
|
2080
2122
|
}),
|
|
2081
|
-
|
|
2082
|
-
type:
|
|
2083
|
-
serverLabel:
|
|
2084
|
-
name:
|
|
2085
|
-
arguments:
|
|
2086
|
-
approvalRequestId:
|
|
2123
|
+
import_v416.z.object({
|
|
2124
|
+
type: import_v416.z.literal("approvalRequest"),
|
|
2125
|
+
serverLabel: import_v416.z.string(),
|
|
2126
|
+
name: import_v416.z.string(),
|
|
2127
|
+
arguments: import_v416.z.string(),
|
|
2128
|
+
approvalRequestId: import_v416.z.string()
|
|
2087
2129
|
})
|
|
2088
2130
|
])
|
|
2089
2131
|
)
|
|
2090
2132
|
);
|
|
2091
|
-
var mcpToolFactory = (0,
|
|
2133
|
+
var mcpToolFactory = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
|
|
2092
2134
|
id: "openai.mcp",
|
|
2093
2135
|
inputSchema: mcpInputSchema,
|
|
2094
2136
|
outputSchema: mcpOutputSchema
|
|
@@ -2097,6 +2139,14 @@ var mcp = (args) => mcpToolFactory(args);
|
|
|
2097
2139
|
|
|
2098
2140
|
// src/openai-tools.ts
|
|
2099
2141
|
var openaiTools = {
|
|
2142
|
+
/**
|
|
2143
|
+
* The apply_patch tool lets GPT-5.1 create, update, and delete files in your
|
|
2144
|
+
* codebase using structured diffs. Instead of just suggesting edits, the model
|
|
2145
|
+
* emits patch operations that your application applies and then reports back on,
|
|
2146
|
+
* enabling iterative, multi-step code editing workflows.
|
|
2147
|
+
*
|
|
2148
|
+
*/
|
|
2149
|
+
applyPatch,
|
|
2100
2150
|
/**
|
|
2101
2151
|
* The Code Interpreter tool allows models to write and run Python code in a
|
|
2102
2152
|
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
@@ -2175,12 +2225,12 @@ var openaiTools = {
|
|
|
2175
2225
|
|
|
2176
2226
|
// src/responses/openai-responses-language-model.ts
|
|
2177
2227
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2178
|
-
var
|
|
2228
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
2179
2229
|
|
|
2180
2230
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2181
2231
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2182
|
-
var
|
|
2183
|
-
var
|
|
2232
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2233
|
+
var import_v417 = require("zod/v4");
|
|
2184
2234
|
function isFileId(data, prefixes) {
|
|
2185
2235
|
if (!prefixes) return false;
|
|
2186
2236
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2191,7 +2241,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2191
2241
|
systemMessageMode,
|
|
2192
2242
|
fileIdPrefixes,
|
|
2193
2243
|
store,
|
|
2194
|
-
hasLocalShellTool = false
|
|
2244
|
+
hasLocalShellTool = false,
|
|
2245
|
+
hasApplyPatchTool = false
|
|
2195
2246
|
}) {
|
|
2196
2247
|
var _a, _b, _c, _d, _e;
|
|
2197
2248
|
const input = [];
|
|
@@ -2239,7 +2290,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2239
2290
|
return {
|
|
2240
2291
|
type: "input_image",
|
|
2241
2292
|
...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,
|
|
2293
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2243
2294
|
},
|
|
2244
2295
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
|
|
2245
2296
|
};
|
|
@@ -2254,7 +2305,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2254
2305
|
type: "input_file",
|
|
2255
2306
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2256
2307
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2257
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2308
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2258
2309
|
}
|
|
2259
2310
|
};
|
|
2260
2311
|
} else {
|
|
@@ -2298,7 +2349,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2298
2349
|
part.toolName
|
|
2299
2350
|
);
|
|
2300
2351
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2301
|
-
const parsedInput = await (0,
|
|
2352
|
+
const parsedInput = await (0, import_provider_utils22.validateTypes)({
|
|
2302
2353
|
value: part.input,
|
|
2303
2354
|
schema: localShellInputSchema
|
|
2304
2355
|
});
|
|
@@ -2339,7 +2390,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2339
2390
|
break;
|
|
2340
2391
|
}
|
|
2341
2392
|
case "reasoning": {
|
|
2342
|
-
const providerOptions = await (0,
|
|
2393
|
+
const providerOptions = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2343
2394
|
provider: "openai",
|
|
2344
2395
|
providerOptions: part.providerOptions,
|
|
2345
2396
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2403,7 +2454,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2403
2454
|
part.toolName
|
|
2404
2455
|
);
|
|
2405
2456
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2406
|
-
const parsedOutput = await (0,
|
|
2457
|
+
const parsedOutput = await (0, import_provider_utils22.validateTypes)({
|
|
2407
2458
|
value: output.value,
|
|
2408
2459
|
schema: localShellOutputSchema
|
|
2409
2460
|
});
|
|
@@ -2414,6 +2465,19 @@ async function convertToOpenAIResponsesInput({
|
|
|
2414
2465
|
});
|
|
2415
2466
|
break;
|
|
2416
2467
|
}
|
|
2468
|
+
if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
|
|
2469
|
+
const parsedOutput = await (0, import_provider_utils22.validateTypes)({
|
|
2470
|
+
value: output.value,
|
|
2471
|
+
schema: applyPatchOutputSchema
|
|
2472
|
+
});
|
|
2473
|
+
input.push({
|
|
2474
|
+
type: "apply_patch_call_output",
|
|
2475
|
+
call_id: part.toolCallId,
|
|
2476
|
+
status: parsedOutput.status,
|
|
2477
|
+
output: parsedOutput.output
|
|
2478
|
+
});
|
|
2479
|
+
break;
|
|
2480
|
+
}
|
|
2417
2481
|
let contentValue;
|
|
2418
2482
|
switch (output.type) {
|
|
2419
2483
|
case "text":
|
|
@@ -2455,7 +2519,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2455
2519
|
return void 0;
|
|
2456
2520
|
}
|
|
2457
2521
|
}
|
|
2458
|
-
}).filter(
|
|
2522
|
+
}).filter(import_provider_utils22.isNonNullable);
|
|
2459
2523
|
break;
|
|
2460
2524
|
}
|
|
2461
2525
|
input.push({
|
|
@@ -2474,9 +2538,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2474
2538
|
}
|
|
2475
2539
|
return { input, warnings };
|
|
2476
2540
|
}
|
|
2477
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2478
|
-
itemId:
|
|
2479
|
-
reasoningEncryptedContent:
|
|
2541
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v417.z.object({
|
|
2542
|
+
itemId: import_v417.z.string().nullish(),
|
|
2543
|
+
reasoningEncryptedContent: import_v417.z.string().nullish()
|
|
2480
2544
|
});
|
|
2481
2545
|
|
|
2482
2546
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2498,349 +2562,393 @@ function mapOpenAIResponseFinishReason({
|
|
|
2498
2562
|
}
|
|
2499
2563
|
|
|
2500
2564
|
// 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:
|
|
2565
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2566
|
+
var import_v418 = require("zod/v4");
|
|
2567
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils23.lazySchema)(
|
|
2568
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2569
|
+
import_v418.z.union([
|
|
2570
|
+
import_v418.z.object({
|
|
2571
|
+
type: import_v418.z.literal("response.output_text.delta"),
|
|
2572
|
+
item_id: import_v418.z.string(),
|
|
2573
|
+
delta: import_v418.z.string(),
|
|
2574
|
+
logprobs: import_v418.z.array(
|
|
2575
|
+
import_v418.z.object({
|
|
2576
|
+
token: import_v418.z.string(),
|
|
2577
|
+
logprob: import_v418.z.number(),
|
|
2578
|
+
top_logprobs: import_v418.z.array(
|
|
2579
|
+
import_v418.z.object({
|
|
2580
|
+
token: import_v418.z.string(),
|
|
2581
|
+
logprob: import_v418.z.number()
|
|
2518
2582
|
})
|
|
2519
2583
|
)
|
|
2520
2584
|
})
|
|
2521
2585
|
).nullish()
|
|
2522
2586
|
}),
|
|
2523
|
-
|
|
2524
|
-
type:
|
|
2525
|
-
response:
|
|
2526
|
-
incomplete_details:
|
|
2527
|
-
usage:
|
|
2528
|
-
input_tokens:
|
|
2529
|
-
input_tokens_details:
|
|
2530
|
-
output_tokens:
|
|
2531
|
-
output_tokens_details:
|
|
2587
|
+
import_v418.z.object({
|
|
2588
|
+
type: import_v418.z.enum(["response.completed", "response.incomplete"]),
|
|
2589
|
+
response: import_v418.z.object({
|
|
2590
|
+
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
2591
|
+
usage: import_v418.z.object({
|
|
2592
|
+
input_tokens: import_v418.z.number(),
|
|
2593
|
+
input_tokens_details: import_v418.z.object({ cached_tokens: import_v418.z.number().nullish() }).nullish(),
|
|
2594
|
+
output_tokens: import_v418.z.number(),
|
|
2595
|
+
output_tokens_details: import_v418.z.object({ reasoning_tokens: import_v418.z.number().nullish() }).nullish()
|
|
2532
2596
|
}),
|
|
2533
|
-
service_tier:
|
|
2597
|
+
service_tier: import_v418.z.string().nullish()
|
|
2534
2598
|
})
|
|
2535
2599
|
}),
|
|
2536
|
-
|
|
2537
|
-
type:
|
|
2538
|
-
response:
|
|
2539
|
-
id:
|
|
2540
|
-
created_at:
|
|
2541
|
-
model:
|
|
2542
|
-
service_tier:
|
|
2600
|
+
import_v418.z.object({
|
|
2601
|
+
type: import_v418.z.literal("response.created"),
|
|
2602
|
+
response: import_v418.z.object({
|
|
2603
|
+
id: import_v418.z.string(),
|
|
2604
|
+
created_at: import_v418.z.number(),
|
|
2605
|
+
model: import_v418.z.string(),
|
|
2606
|
+
service_tier: import_v418.z.string().nullish()
|
|
2543
2607
|
})
|
|
2544
2608
|
}),
|
|
2545
|
-
|
|
2546
|
-
type:
|
|
2547
|
-
output_index:
|
|
2548
|
-
item:
|
|
2549
|
-
|
|
2550
|
-
type:
|
|
2551
|
-
id:
|
|
2609
|
+
import_v418.z.object({
|
|
2610
|
+
type: import_v418.z.literal("response.output_item.added"),
|
|
2611
|
+
output_index: import_v418.z.number(),
|
|
2612
|
+
item: import_v418.z.discriminatedUnion("type", [
|
|
2613
|
+
import_v418.z.object({
|
|
2614
|
+
type: import_v418.z.literal("message"),
|
|
2615
|
+
id: import_v418.z.string()
|
|
2552
2616
|
}),
|
|
2553
|
-
|
|
2554
|
-
type:
|
|
2555
|
-
id:
|
|
2556
|
-
encrypted_content:
|
|
2617
|
+
import_v418.z.object({
|
|
2618
|
+
type: import_v418.z.literal("reasoning"),
|
|
2619
|
+
id: import_v418.z.string(),
|
|
2620
|
+
encrypted_content: import_v418.z.string().nullish()
|
|
2557
2621
|
}),
|
|
2558
|
-
|
|
2559
|
-
type:
|
|
2560
|
-
id:
|
|
2561
|
-
call_id:
|
|
2562
|
-
name:
|
|
2563
|
-
arguments:
|
|
2622
|
+
import_v418.z.object({
|
|
2623
|
+
type: import_v418.z.literal("function_call"),
|
|
2624
|
+
id: import_v418.z.string(),
|
|
2625
|
+
call_id: import_v418.z.string(),
|
|
2626
|
+
name: import_v418.z.string(),
|
|
2627
|
+
arguments: import_v418.z.string()
|
|
2564
2628
|
}),
|
|
2565
|
-
|
|
2566
|
-
type:
|
|
2567
|
-
id:
|
|
2568
|
-
status:
|
|
2629
|
+
import_v418.z.object({
|
|
2630
|
+
type: import_v418.z.literal("web_search_call"),
|
|
2631
|
+
id: import_v418.z.string(),
|
|
2632
|
+
status: import_v418.z.string()
|
|
2569
2633
|
}),
|
|
2570
|
-
|
|
2571
|
-
type:
|
|
2572
|
-
id:
|
|
2573
|
-
status:
|
|
2634
|
+
import_v418.z.object({
|
|
2635
|
+
type: import_v418.z.literal("computer_call"),
|
|
2636
|
+
id: import_v418.z.string(),
|
|
2637
|
+
status: import_v418.z.string()
|
|
2574
2638
|
}),
|
|
2575
|
-
|
|
2576
|
-
type:
|
|
2577
|
-
id:
|
|
2639
|
+
import_v418.z.object({
|
|
2640
|
+
type: import_v418.z.literal("file_search_call"),
|
|
2641
|
+
id: import_v418.z.string()
|
|
2578
2642
|
}),
|
|
2579
|
-
|
|
2580
|
-
type:
|
|
2581
|
-
id:
|
|
2643
|
+
import_v418.z.object({
|
|
2644
|
+
type: import_v418.z.literal("image_generation_call"),
|
|
2645
|
+
id: import_v418.z.string()
|
|
2582
2646
|
}),
|
|
2583
|
-
|
|
2584
|
-
type:
|
|
2585
|
-
id:
|
|
2586
|
-
container_id:
|
|
2587
|
-
code:
|
|
2588
|
-
outputs:
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2647
|
+
import_v418.z.object({
|
|
2648
|
+
type: import_v418.z.literal("code_interpreter_call"),
|
|
2649
|
+
id: import_v418.z.string(),
|
|
2650
|
+
container_id: import_v418.z.string(),
|
|
2651
|
+
code: import_v418.z.string().nullable(),
|
|
2652
|
+
outputs: import_v418.z.array(
|
|
2653
|
+
import_v418.z.discriminatedUnion("type", [
|
|
2654
|
+
import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
|
|
2655
|
+
import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
|
|
2592
2656
|
])
|
|
2593
2657
|
).nullable(),
|
|
2594
|
-
status:
|
|
2658
|
+
status: import_v418.z.string()
|
|
2659
|
+
}),
|
|
2660
|
+
import_v418.z.object({
|
|
2661
|
+
type: import_v418.z.literal("mcp_call"),
|
|
2662
|
+
id: import_v418.z.string(),
|
|
2663
|
+
status: import_v418.z.string()
|
|
2595
2664
|
}),
|
|
2596
|
-
|
|
2597
|
-
type:
|
|
2598
|
-
id:
|
|
2599
|
-
status: import_v417.z.string()
|
|
2665
|
+
import_v418.z.object({
|
|
2666
|
+
type: import_v418.z.literal("mcp_list_tools"),
|
|
2667
|
+
id: import_v418.z.string()
|
|
2600
2668
|
}),
|
|
2601
|
-
|
|
2602
|
-
type:
|
|
2603
|
-
id:
|
|
2669
|
+
import_v418.z.object({
|
|
2670
|
+
type: import_v418.z.literal("mcp_approval_request"),
|
|
2671
|
+
id: import_v418.z.string()
|
|
2604
2672
|
}),
|
|
2605
|
-
|
|
2606
|
-
type:
|
|
2607
|
-
id:
|
|
2673
|
+
import_v418.z.object({
|
|
2674
|
+
type: import_v418.z.literal("apply_patch_call"),
|
|
2675
|
+
id: import_v418.z.string(),
|
|
2676
|
+
call_id: import_v418.z.string(),
|
|
2677
|
+
status: import_v418.z.enum(["in_progress", "completed"]),
|
|
2678
|
+
operation: import_v418.z.discriminatedUnion("type", [
|
|
2679
|
+
import_v418.z.object({
|
|
2680
|
+
type: import_v418.z.literal("create_file"),
|
|
2681
|
+
path: import_v418.z.string(),
|
|
2682
|
+
diff: import_v418.z.string()
|
|
2683
|
+
}),
|
|
2684
|
+
import_v418.z.object({
|
|
2685
|
+
type: import_v418.z.literal("delete_file"),
|
|
2686
|
+
path: import_v418.z.string()
|
|
2687
|
+
}),
|
|
2688
|
+
import_v418.z.object({
|
|
2689
|
+
type: import_v418.z.literal("update_file"),
|
|
2690
|
+
path: import_v418.z.string(),
|
|
2691
|
+
diff: import_v418.z.string()
|
|
2692
|
+
})
|
|
2693
|
+
])
|
|
2608
2694
|
})
|
|
2609
2695
|
])
|
|
2610
2696
|
}),
|
|
2611
|
-
|
|
2612
|
-
type:
|
|
2613
|
-
output_index:
|
|
2614
|
-
item:
|
|
2615
|
-
|
|
2616
|
-
type:
|
|
2617
|
-
id:
|
|
2697
|
+
import_v418.z.object({
|
|
2698
|
+
type: import_v418.z.literal("response.output_item.done"),
|
|
2699
|
+
output_index: import_v418.z.number(),
|
|
2700
|
+
item: import_v418.z.discriminatedUnion("type", [
|
|
2701
|
+
import_v418.z.object({
|
|
2702
|
+
type: import_v418.z.literal("message"),
|
|
2703
|
+
id: import_v418.z.string()
|
|
2618
2704
|
}),
|
|
2619
|
-
|
|
2620
|
-
type:
|
|
2621
|
-
id:
|
|
2622
|
-
encrypted_content:
|
|
2705
|
+
import_v418.z.object({
|
|
2706
|
+
type: import_v418.z.literal("reasoning"),
|
|
2707
|
+
id: import_v418.z.string(),
|
|
2708
|
+
encrypted_content: import_v418.z.string().nullish()
|
|
2623
2709
|
}),
|
|
2624
|
-
|
|
2625
|
-
type:
|
|
2626
|
-
id:
|
|
2627
|
-
call_id:
|
|
2628
|
-
name:
|
|
2629
|
-
arguments:
|
|
2630
|
-
status:
|
|
2710
|
+
import_v418.z.object({
|
|
2711
|
+
type: import_v418.z.literal("function_call"),
|
|
2712
|
+
id: import_v418.z.string(),
|
|
2713
|
+
call_id: import_v418.z.string(),
|
|
2714
|
+
name: import_v418.z.string(),
|
|
2715
|
+
arguments: import_v418.z.string(),
|
|
2716
|
+
status: import_v418.z.literal("completed")
|
|
2631
2717
|
}),
|
|
2632
|
-
|
|
2633
|
-
type:
|
|
2634
|
-
id:
|
|
2635
|
-
code:
|
|
2636
|
-
container_id:
|
|
2637
|
-
outputs:
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2718
|
+
import_v418.z.object({
|
|
2719
|
+
type: import_v418.z.literal("code_interpreter_call"),
|
|
2720
|
+
id: import_v418.z.string(),
|
|
2721
|
+
code: import_v418.z.string().nullable(),
|
|
2722
|
+
container_id: import_v418.z.string(),
|
|
2723
|
+
outputs: import_v418.z.array(
|
|
2724
|
+
import_v418.z.discriminatedUnion("type", [
|
|
2725
|
+
import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
|
|
2726
|
+
import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
|
|
2641
2727
|
])
|
|
2642
2728
|
).nullable()
|
|
2643
2729
|
}),
|
|
2644
|
-
|
|
2645
|
-
type:
|
|
2646
|
-
id:
|
|
2647
|
-
result:
|
|
2730
|
+
import_v418.z.object({
|
|
2731
|
+
type: import_v418.z.literal("image_generation_call"),
|
|
2732
|
+
id: import_v418.z.string(),
|
|
2733
|
+
result: import_v418.z.string()
|
|
2648
2734
|
}),
|
|
2649
|
-
|
|
2650
|
-
type:
|
|
2651
|
-
id:
|
|
2652
|
-
status:
|
|
2653
|
-
action:
|
|
2654
|
-
|
|
2655
|
-
type:
|
|
2656
|
-
query:
|
|
2657
|
-
sources:
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2735
|
+
import_v418.z.object({
|
|
2736
|
+
type: import_v418.z.literal("web_search_call"),
|
|
2737
|
+
id: import_v418.z.string(),
|
|
2738
|
+
status: import_v418.z.string(),
|
|
2739
|
+
action: import_v418.z.discriminatedUnion("type", [
|
|
2740
|
+
import_v418.z.object({
|
|
2741
|
+
type: import_v418.z.literal("search"),
|
|
2742
|
+
query: import_v418.z.string().nullish(),
|
|
2743
|
+
sources: import_v418.z.array(
|
|
2744
|
+
import_v418.z.discriminatedUnion("type", [
|
|
2745
|
+
import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() }),
|
|
2746
|
+
import_v418.z.object({ type: import_v418.z.literal("api"), name: import_v418.z.string() })
|
|
2661
2747
|
])
|
|
2662
2748
|
).nullish()
|
|
2663
2749
|
}),
|
|
2664
|
-
|
|
2665
|
-
type:
|
|
2666
|
-
url:
|
|
2750
|
+
import_v418.z.object({
|
|
2751
|
+
type: import_v418.z.literal("open_page"),
|
|
2752
|
+
url: import_v418.z.string()
|
|
2667
2753
|
}),
|
|
2668
|
-
|
|
2669
|
-
type:
|
|
2670
|
-
url:
|
|
2671
|
-
pattern:
|
|
2754
|
+
import_v418.z.object({
|
|
2755
|
+
type: import_v418.z.literal("find"),
|
|
2756
|
+
url: import_v418.z.string(),
|
|
2757
|
+
pattern: import_v418.z.string()
|
|
2672
2758
|
})
|
|
2673
2759
|
])
|
|
2674
2760
|
}),
|
|
2675
|
-
|
|
2676
|
-
type:
|
|
2677
|
-
id:
|
|
2678
|
-
queries:
|
|
2679
|
-
results:
|
|
2680
|
-
|
|
2681
|
-
attributes:
|
|
2682
|
-
|
|
2683
|
-
|
|
2761
|
+
import_v418.z.object({
|
|
2762
|
+
type: import_v418.z.literal("file_search_call"),
|
|
2763
|
+
id: import_v418.z.string(),
|
|
2764
|
+
queries: import_v418.z.array(import_v418.z.string()),
|
|
2765
|
+
results: import_v418.z.array(
|
|
2766
|
+
import_v418.z.object({
|
|
2767
|
+
attributes: import_v418.z.record(
|
|
2768
|
+
import_v418.z.string(),
|
|
2769
|
+
import_v418.z.union([import_v418.z.string(), import_v418.z.number(), import_v418.z.boolean()])
|
|
2684
2770
|
),
|
|
2685
|
-
file_id:
|
|
2686
|
-
filename:
|
|
2687
|
-
score:
|
|
2688
|
-
text:
|
|
2771
|
+
file_id: import_v418.z.string(),
|
|
2772
|
+
filename: import_v418.z.string(),
|
|
2773
|
+
score: import_v418.z.number(),
|
|
2774
|
+
text: import_v418.z.string()
|
|
2689
2775
|
})
|
|
2690
2776
|
).nullish()
|
|
2691
2777
|
}),
|
|
2692
|
-
|
|
2693
|
-
type:
|
|
2694
|
-
id:
|
|
2695
|
-
call_id:
|
|
2696
|
-
action:
|
|
2697
|
-
type:
|
|
2698
|
-
command:
|
|
2699
|
-
timeout_ms:
|
|
2700
|
-
user:
|
|
2701
|
-
working_directory:
|
|
2702
|
-
env:
|
|
2778
|
+
import_v418.z.object({
|
|
2779
|
+
type: import_v418.z.literal("local_shell_call"),
|
|
2780
|
+
id: import_v418.z.string(),
|
|
2781
|
+
call_id: import_v418.z.string(),
|
|
2782
|
+
action: import_v418.z.object({
|
|
2783
|
+
type: import_v418.z.literal("exec"),
|
|
2784
|
+
command: import_v418.z.array(import_v418.z.string()),
|
|
2785
|
+
timeout_ms: import_v418.z.number().optional(),
|
|
2786
|
+
user: import_v418.z.string().optional(),
|
|
2787
|
+
working_directory: import_v418.z.string().optional(),
|
|
2788
|
+
env: import_v418.z.record(import_v418.z.string(), import_v418.z.string()).optional()
|
|
2703
2789
|
})
|
|
2704
2790
|
}),
|
|
2705
|
-
|
|
2706
|
-
type:
|
|
2707
|
-
id:
|
|
2708
|
-
status:
|
|
2791
|
+
import_v418.z.object({
|
|
2792
|
+
type: import_v418.z.literal("computer_call"),
|
|
2793
|
+
id: import_v418.z.string(),
|
|
2794
|
+
status: import_v418.z.literal("completed")
|
|
2709
2795
|
}),
|
|
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:
|
|
2796
|
+
import_v418.z.object({
|
|
2797
|
+
type: import_v418.z.literal("mcp_call"),
|
|
2798
|
+
id: import_v418.z.string(),
|
|
2799
|
+
status: import_v418.z.string(),
|
|
2800
|
+
arguments: import_v418.z.string(),
|
|
2801
|
+
name: import_v418.z.string(),
|
|
2802
|
+
server_label: import_v418.z.string(),
|
|
2803
|
+
output: import_v418.z.string().nullish(),
|
|
2804
|
+
error: import_v418.z.union([
|
|
2805
|
+
import_v418.z.string(),
|
|
2806
|
+
import_v418.z.object({
|
|
2807
|
+
type: import_v418.z.string().optional(),
|
|
2808
|
+
code: import_v418.z.union([import_v418.z.number(), import_v418.z.string()]).optional(),
|
|
2809
|
+
message: import_v418.z.string().optional()
|
|
2724
2810
|
}).loose()
|
|
2725
2811
|
]).nullish()
|
|
2726
2812
|
}),
|
|
2727
|
-
|
|
2728
|
-
type:
|
|
2729
|
-
id:
|
|
2730
|
-
server_label:
|
|
2731
|
-
tools:
|
|
2732
|
-
|
|
2733
|
-
name:
|
|
2734
|
-
description:
|
|
2735
|
-
input_schema:
|
|
2736
|
-
annotations:
|
|
2813
|
+
import_v418.z.object({
|
|
2814
|
+
type: import_v418.z.literal("mcp_list_tools"),
|
|
2815
|
+
id: import_v418.z.string(),
|
|
2816
|
+
server_label: import_v418.z.string(),
|
|
2817
|
+
tools: import_v418.z.array(
|
|
2818
|
+
import_v418.z.object({
|
|
2819
|
+
name: import_v418.z.string(),
|
|
2820
|
+
description: import_v418.z.string().optional(),
|
|
2821
|
+
input_schema: import_v418.z.any(),
|
|
2822
|
+
annotations: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()).optional()
|
|
2737
2823
|
})
|
|
2738
2824
|
),
|
|
2739
|
-
error:
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
type:
|
|
2743
|
-
code:
|
|
2744
|
-
message:
|
|
2825
|
+
error: import_v418.z.union([
|
|
2826
|
+
import_v418.z.string(),
|
|
2827
|
+
import_v418.z.object({
|
|
2828
|
+
type: import_v418.z.string().optional(),
|
|
2829
|
+
code: import_v418.z.union([import_v418.z.number(), import_v418.z.string()]).optional(),
|
|
2830
|
+
message: import_v418.z.string().optional()
|
|
2745
2831
|
}).loose()
|
|
2746
2832
|
]).optional()
|
|
2747
2833
|
}),
|
|
2748
|
-
|
|
2749
|
-
type:
|
|
2750
|
-
id:
|
|
2751
|
-
server_label:
|
|
2752
|
-
name:
|
|
2753
|
-
arguments:
|
|
2754
|
-
approval_request_id:
|
|
2834
|
+
import_v418.z.object({
|
|
2835
|
+
type: import_v418.z.literal("mcp_approval_request"),
|
|
2836
|
+
id: import_v418.z.string(),
|
|
2837
|
+
server_label: import_v418.z.string(),
|
|
2838
|
+
name: import_v418.z.string(),
|
|
2839
|
+
arguments: import_v418.z.string(),
|
|
2840
|
+
approval_request_id: import_v418.z.string()
|
|
2841
|
+
}),
|
|
2842
|
+
import_v418.z.object({
|
|
2843
|
+
type: import_v418.z.literal("apply_patch_call"),
|
|
2844
|
+
id: import_v418.z.string(),
|
|
2845
|
+
call_id: import_v418.z.string(),
|
|
2846
|
+
status: import_v418.z.enum(["in_progress", "completed"]),
|
|
2847
|
+
operation: import_v418.z.discriminatedUnion("type", [
|
|
2848
|
+
import_v418.z.object({
|
|
2849
|
+
type: import_v418.z.literal("create_file"),
|
|
2850
|
+
path: import_v418.z.string(),
|
|
2851
|
+
diff: import_v418.z.string()
|
|
2852
|
+
}),
|
|
2853
|
+
import_v418.z.object({
|
|
2854
|
+
type: import_v418.z.literal("delete_file"),
|
|
2855
|
+
path: import_v418.z.string()
|
|
2856
|
+
}),
|
|
2857
|
+
import_v418.z.object({
|
|
2858
|
+
type: import_v418.z.literal("update_file"),
|
|
2859
|
+
path: import_v418.z.string(),
|
|
2860
|
+
diff: import_v418.z.string()
|
|
2861
|
+
})
|
|
2862
|
+
])
|
|
2755
2863
|
})
|
|
2756
2864
|
])
|
|
2757
2865
|
}),
|
|
2758
|
-
|
|
2759
|
-
type:
|
|
2760
|
-
item_id:
|
|
2761
|
-
output_index:
|
|
2762
|
-
delta:
|
|
2866
|
+
import_v418.z.object({
|
|
2867
|
+
type: import_v418.z.literal("response.function_call_arguments.delta"),
|
|
2868
|
+
item_id: import_v418.z.string(),
|
|
2869
|
+
output_index: import_v418.z.number(),
|
|
2870
|
+
delta: import_v418.z.string()
|
|
2763
2871
|
}),
|
|
2764
|
-
|
|
2765
|
-
type:
|
|
2766
|
-
item_id:
|
|
2767
|
-
output_index:
|
|
2768
|
-
partial_image_b64:
|
|
2872
|
+
import_v418.z.object({
|
|
2873
|
+
type: import_v418.z.literal("response.image_generation_call.partial_image"),
|
|
2874
|
+
item_id: import_v418.z.string(),
|
|
2875
|
+
output_index: import_v418.z.number(),
|
|
2876
|
+
partial_image_b64: import_v418.z.string()
|
|
2769
2877
|
}),
|
|
2770
|
-
|
|
2771
|
-
type:
|
|
2772
|
-
item_id:
|
|
2773
|
-
output_index:
|
|
2774
|
-
delta:
|
|
2878
|
+
import_v418.z.object({
|
|
2879
|
+
type: import_v418.z.literal("response.code_interpreter_call_code.delta"),
|
|
2880
|
+
item_id: import_v418.z.string(),
|
|
2881
|
+
output_index: import_v418.z.number(),
|
|
2882
|
+
delta: import_v418.z.string()
|
|
2775
2883
|
}),
|
|
2776
|
-
|
|
2777
|
-
type:
|
|
2778
|
-
item_id:
|
|
2779
|
-
output_index:
|
|
2780
|
-
code:
|
|
2884
|
+
import_v418.z.object({
|
|
2885
|
+
type: import_v418.z.literal("response.code_interpreter_call_code.done"),
|
|
2886
|
+
item_id: import_v418.z.string(),
|
|
2887
|
+
output_index: import_v418.z.number(),
|
|
2888
|
+
code: import_v418.z.string()
|
|
2781
2889
|
}),
|
|
2782
|
-
|
|
2783
|
-
type:
|
|
2784
|
-
annotation:
|
|
2785
|
-
|
|
2786
|
-
type:
|
|
2787
|
-
start_index:
|
|
2788
|
-
end_index:
|
|
2789
|
-
url:
|
|
2790
|
-
title:
|
|
2890
|
+
import_v418.z.object({
|
|
2891
|
+
type: import_v418.z.literal("response.output_text.annotation.added"),
|
|
2892
|
+
annotation: import_v418.z.discriminatedUnion("type", [
|
|
2893
|
+
import_v418.z.object({
|
|
2894
|
+
type: import_v418.z.literal("url_citation"),
|
|
2895
|
+
start_index: import_v418.z.number(),
|
|
2896
|
+
end_index: import_v418.z.number(),
|
|
2897
|
+
url: import_v418.z.string(),
|
|
2898
|
+
title: import_v418.z.string()
|
|
2791
2899
|
}),
|
|
2792
|
-
|
|
2793
|
-
type:
|
|
2794
|
-
file_id:
|
|
2795
|
-
filename:
|
|
2796
|
-
index:
|
|
2797
|
-
start_index:
|
|
2798
|
-
end_index:
|
|
2799
|
-
quote:
|
|
2900
|
+
import_v418.z.object({
|
|
2901
|
+
type: import_v418.z.literal("file_citation"),
|
|
2902
|
+
file_id: import_v418.z.string(),
|
|
2903
|
+
filename: import_v418.z.string().nullish(),
|
|
2904
|
+
index: import_v418.z.number().nullish(),
|
|
2905
|
+
start_index: import_v418.z.number().nullish(),
|
|
2906
|
+
end_index: import_v418.z.number().nullish(),
|
|
2907
|
+
quote: import_v418.z.string().nullish()
|
|
2800
2908
|
}),
|
|
2801
|
-
|
|
2802
|
-
type:
|
|
2803
|
-
container_id:
|
|
2804
|
-
file_id:
|
|
2805
|
-
filename:
|
|
2806
|
-
start_index:
|
|
2807
|
-
end_index:
|
|
2808
|
-
index:
|
|
2909
|
+
import_v418.z.object({
|
|
2910
|
+
type: import_v418.z.literal("container_file_citation"),
|
|
2911
|
+
container_id: import_v418.z.string(),
|
|
2912
|
+
file_id: import_v418.z.string(),
|
|
2913
|
+
filename: import_v418.z.string().nullish(),
|
|
2914
|
+
start_index: import_v418.z.number().nullish(),
|
|
2915
|
+
end_index: import_v418.z.number().nullish(),
|
|
2916
|
+
index: import_v418.z.number().nullish()
|
|
2809
2917
|
}),
|
|
2810
|
-
|
|
2811
|
-
type:
|
|
2812
|
-
file_id:
|
|
2813
|
-
index:
|
|
2918
|
+
import_v418.z.object({
|
|
2919
|
+
type: import_v418.z.literal("file_path"),
|
|
2920
|
+
file_id: import_v418.z.string(),
|
|
2921
|
+
index: import_v418.z.number().nullish()
|
|
2814
2922
|
})
|
|
2815
2923
|
])
|
|
2816
2924
|
}),
|
|
2817
|
-
|
|
2818
|
-
type:
|
|
2819
|
-
item_id:
|
|
2820
|
-
summary_index:
|
|
2925
|
+
import_v418.z.object({
|
|
2926
|
+
type: import_v418.z.literal("response.reasoning_summary_part.added"),
|
|
2927
|
+
item_id: import_v418.z.string(),
|
|
2928
|
+
summary_index: import_v418.z.number()
|
|
2821
2929
|
}),
|
|
2822
|
-
|
|
2823
|
-
type:
|
|
2824
|
-
item_id:
|
|
2825
|
-
summary_index:
|
|
2826
|
-
delta:
|
|
2930
|
+
import_v418.z.object({
|
|
2931
|
+
type: import_v418.z.literal("response.reasoning_summary_text.delta"),
|
|
2932
|
+
item_id: import_v418.z.string(),
|
|
2933
|
+
summary_index: import_v418.z.number(),
|
|
2934
|
+
delta: import_v418.z.string()
|
|
2827
2935
|
}),
|
|
2828
|
-
|
|
2829
|
-
type:
|
|
2830
|
-
item_id:
|
|
2831
|
-
summary_index:
|
|
2936
|
+
import_v418.z.object({
|
|
2937
|
+
type: import_v418.z.literal("response.reasoning_summary_part.done"),
|
|
2938
|
+
item_id: import_v418.z.string(),
|
|
2939
|
+
summary_index: import_v418.z.number()
|
|
2832
2940
|
}),
|
|
2833
|
-
|
|
2834
|
-
type:
|
|
2835
|
-
sequence_number:
|
|
2836
|
-
error:
|
|
2837
|
-
type:
|
|
2838
|
-
code:
|
|
2839
|
-
message:
|
|
2840
|
-
param:
|
|
2941
|
+
import_v418.z.object({
|
|
2942
|
+
type: import_v418.z.literal("error"),
|
|
2943
|
+
sequence_number: import_v418.z.number(),
|
|
2944
|
+
error: import_v418.z.object({
|
|
2945
|
+
type: import_v418.z.string(),
|
|
2946
|
+
code: import_v418.z.string(),
|
|
2947
|
+
message: import_v418.z.string(),
|
|
2948
|
+
param: import_v418.z.string().nullish()
|
|
2841
2949
|
})
|
|
2842
2950
|
}),
|
|
2843
|
-
|
|
2951
|
+
import_v418.z.object({ type: import_v418.z.string() }).loose().transform((value) => ({
|
|
2844
2952
|
type: "unknown_chunk",
|
|
2845
2953
|
message: value.type
|
|
2846
2954
|
}))
|
|
@@ -2848,236 +2956,258 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazySchema)(
|
|
|
2848
2956
|
])
|
|
2849
2957
|
)
|
|
2850
2958
|
);
|
|
2851
|
-
var openaiResponsesResponseSchema = (0,
|
|
2852
|
-
() => (0,
|
|
2853
|
-
|
|
2854
|
-
id:
|
|
2855
|
-
created_at:
|
|
2856
|
-
error:
|
|
2857
|
-
message:
|
|
2858
|
-
type:
|
|
2859
|
-
param:
|
|
2860
|
-
code:
|
|
2959
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils23.lazySchema)(
|
|
2960
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2961
|
+
import_v418.z.object({
|
|
2962
|
+
id: import_v418.z.string().optional(),
|
|
2963
|
+
created_at: import_v418.z.number().optional(),
|
|
2964
|
+
error: import_v418.z.object({
|
|
2965
|
+
message: import_v418.z.string(),
|
|
2966
|
+
type: import_v418.z.string(),
|
|
2967
|
+
param: import_v418.z.string().nullish(),
|
|
2968
|
+
code: import_v418.z.string()
|
|
2861
2969
|
}).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:
|
|
2970
|
+
model: import_v418.z.string().optional(),
|
|
2971
|
+
output: import_v418.z.array(
|
|
2972
|
+
import_v418.z.discriminatedUnion("type", [
|
|
2973
|
+
import_v418.z.object({
|
|
2974
|
+
type: import_v418.z.literal("message"),
|
|
2975
|
+
role: import_v418.z.literal("assistant"),
|
|
2976
|
+
id: import_v418.z.string(),
|
|
2977
|
+
content: import_v418.z.array(
|
|
2978
|
+
import_v418.z.object({
|
|
2979
|
+
type: import_v418.z.literal("output_text"),
|
|
2980
|
+
text: import_v418.z.string(),
|
|
2981
|
+
logprobs: import_v418.z.array(
|
|
2982
|
+
import_v418.z.object({
|
|
2983
|
+
token: import_v418.z.string(),
|
|
2984
|
+
logprob: import_v418.z.number(),
|
|
2985
|
+
top_logprobs: import_v418.z.array(
|
|
2986
|
+
import_v418.z.object({
|
|
2987
|
+
token: import_v418.z.string(),
|
|
2988
|
+
logprob: import_v418.z.number()
|
|
2881
2989
|
})
|
|
2882
2990
|
)
|
|
2883
2991
|
})
|
|
2884
2992
|
).nullish(),
|
|
2885
|
-
annotations:
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
type:
|
|
2889
|
-
start_index:
|
|
2890
|
-
end_index:
|
|
2891
|
-
url:
|
|
2892
|
-
title:
|
|
2993
|
+
annotations: import_v418.z.array(
|
|
2994
|
+
import_v418.z.discriminatedUnion("type", [
|
|
2995
|
+
import_v418.z.object({
|
|
2996
|
+
type: import_v418.z.literal("url_citation"),
|
|
2997
|
+
start_index: import_v418.z.number(),
|
|
2998
|
+
end_index: import_v418.z.number(),
|
|
2999
|
+
url: import_v418.z.string(),
|
|
3000
|
+
title: import_v418.z.string()
|
|
2893
3001
|
}),
|
|
2894
|
-
|
|
2895
|
-
type:
|
|
2896
|
-
file_id:
|
|
2897
|
-
filename:
|
|
2898
|
-
index:
|
|
2899
|
-
start_index:
|
|
2900
|
-
end_index:
|
|
2901
|
-
quote:
|
|
3002
|
+
import_v418.z.object({
|
|
3003
|
+
type: import_v418.z.literal("file_citation"),
|
|
3004
|
+
file_id: import_v418.z.string(),
|
|
3005
|
+
filename: import_v418.z.string().nullish(),
|
|
3006
|
+
index: import_v418.z.number().nullish(),
|
|
3007
|
+
start_index: import_v418.z.number().nullish(),
|
|
3008
|
+
end_index: import_v418.z.number().nullish(),
|
|
3009
|
+
quote: import_v418.z.string().nullish()
|
|
2902
3010
|
}),
|
|
2903
|
-
|
|
2904
|
-
type:
|
|
2905
|
-
container_id:
|
|
2906
|
-
file_id:
|
|
2907
|
-
filename:
|
|
2908
|
-
start_index:
|
|
2909
|
-
end_index:
|
|
2910
|
-
index:
|
|
3011
|
+
import_v418.z.object({
|
|
3012
|
+
type: import_v418.z.literal("container_file_citation"),
|
|
3013
|
+
container_id: import_v418.z.string(),
|
|
3014
|
+
file_id: import_v418.z.string(),
|
|
3015
|
+
filename: import_v418.z.string().nullish(),
|
|
3016
|
+
start_index: import_v418.z.number().nullish(),
|
|
3017
|
+
end_index: import_v418.z.number().nullish(),
|
|
3018
|
+
index: import_v418.z.number().nullish()
|
|
2911
3019
|
}),
|
|
2912
|
-
|
|
2913
|
-
type:
|
|
2914
|
-
file_id:
|
|
2915
|
-
index:
|
|
3020
|
+
import_v418.z.object({
|
|
3021
|
+
type: import_v418.z.literal("file_path"),
|
|
3022
|
+
file_id: import_v418.z.string(),
|
|
3023
|
+
index: import_v418.z.number().nullish()
|
|
2916
3024
|
})
|
|
2917
3025
|
])
|
|
2918
3026
|
)
|
|
2919
3027
|
})
|
|
2920
3028
|
)
|
|
2921
3029
|
}),
|
|
2922
|
-
|
|
2923
|
-
type:
|
|
2924
|
-
id:
|
|
2925
|
-
status:
|
|
2926
|
-
action:
|
|
2927
|
-
|
|
2928
|
-
type:
|
|
2929
|
-
query:
|
|
2930
|
-
sources:
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
3030
|
+
import_v418.z.object({
|
|
3031
|
+
type: import_v418.z.literal("web_search_call"),
|
|
3032
|
+
id: import_v418.z.string(),
|
|
3033
|
+
status: import_v418.z.string(),
|
|
3034
|
+
action: import_v418.z.discriminatedUnion("type", [
|
|
3035
|
+
import_v418.z.object({
|
|
3036
|
+
type: import_v418.z.literal("search"),
|
|
3037
|
+
query: import_v418.z.string().nullish(),
|
|
3038
|
+
sources: import_v418.z.array(
|
|
3039
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3040
|
+
import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() }),
|
|
3041
|
+
import_v418.z.object({ type: import_v418.z.literal("api"), name: import_v418.z.string() })
|
|
2934
3042
|
])
|
|
2935
3043
|
).nullish()
|
|
2936
3044
|
}),
|
|
2937
|
-
|
|
2938
|
-
type:
|
|
2939
|
-
url:
|
|
3045
|
+
import_v418.z.object({
|
|
3046
|
+
type: import_v418.z.literal("open_page"),
|
|
3047
|
+
url: import_v418.z.string()
|
|
2940
3048
|
}),
|
|
2941
|
-
|
|
2942
|
-
type:
|
|
2943
|
-
url:
|
|
2944
|
-
pattern:
|
|
3049
|
+
import_v418.z.object({
|
|
3050
|
+
type: import_v418.z.literal("find"),
|
|
3051
|
+
url: import_v418.z.string(),
|
|
3052
|
+
pattern: import_v418.z.string()
|
|
2945
3053
|
})
|
|
2946
3054
|
])
|
|
2947
3055
|
}),
|
|
2948
|
-
|
|
2949
|
-
type:
|
|
2950
|
-
id:
|
|
2951
|
-
queries:
|
|
2952
|
-
results:
|
|
2953
|
-
|
|
2954
|
-
attributes:
|
|
2955
|
-
|
|
2956
|
-
|
|
3056
|
+
import_v418.z.object({
|
|
3057
|
+
type: import_v418.z.literal("file_search_call"),
|
|
3058
|
+
id: import_v418.z.string(),
|
|
3059
|
+
queries: import_v418.z.array(import_v418.z.string()),
|
|
3060
|
+
results: import_v418.z.array(
|
|
3061
|
+
import_v418.z.object({
|
|
3062
|
+
attributes: import_v418.z.record(
|
|
3063
|
+
import_v418.z.string(),
|
|
3064
|
+
import_v418.z.union([import_v418.z.string(), import_v418.z.number(), import_v418.z.boolean()])
|
|
2957
3065
|
),
|
|
2958
|
-
file_id:
|
|
2959
|
-
filename:
|
|
2960
|
-
score:
|
|
2961
|
-
text:
|
|
3066
|
+
file_id: import_v418.z.string(),
|
|
3067
|
+
filename: import_v418.z.string(),
|
|
3068
|
+
score: import_v418.z.number(),
|
|
3069
|
+
text: import_v418.z.string()
|
|
2962
3070
|
})
|
|
2963
3071
|
).nullish()
|
|
2964
3072
|
}),
|
|
2965
|
-
|
|
2966
|
-
type:
|
|
2967
|
-
id:
|
|
2968
|
-
code:
|
|
2969
|
-
container_id:
|
|
2970
|
-
outputs:
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
3073
|
+
import_v418.z.object({
|
|
3074
|
+
type: import_v418.z.literal("code_interpreter_call"),
|
|
3075
|
+
id: import_v418.z.string(),
|
|
3076
|
+
code: import_v418.z.string().nullable(),
|
|
3077
|
+
container_id: import_v418.z.string(),
|
|
3078
|
+
outputs: import_v418.z.array(
|
|
3079
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3080
|
+
import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
|
|
3081
|
+
import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
|
|
2974
3082
|
])
|
|
2975
3083
|
).nullable()
|
|
2976
3084
|
}),
|
|
2977
|
-
|
|
2978
|
-
type:
|
|
2979
|
-
id:
|
|
2980
|
-
result:
|
|
3085
|
+
import_v418.z.object({
|
|
3086
|
+
type: import_v418.z.literal("image_generation_call"),
|
|
3087
|
+
id: import_v418.z.string(),
|
|
3088
|
+
result: import_v418.z.string()
|
|
2981
3089
|
}),
|
|
2982
|
-
|
|
2983
|
-
type:
|
|
2984
|
-
id:
|
|
2985
|
-
call_id:
|
|
2986
|
-
action:
|
|
2987
|
-
type:
|
|
2988
|
-
command:
|
|
2989
|
-
timeout_ms:
|
|
2990
|
-
user:
|
|
2991
|
-
working_directory:
|
|
2992
|
-
env:
|
|
3090
|
+
import_v418.z.object({
|
|
3091
|
+
type: import_v418.z.literal("local_shell_call"),
|
|
3092
|
+
id: import_v418.z.string(),
|
|
3093
|
+
call_id: import_v418.z.string(),
|
|
3094
|
+
action: import_v418.z.object({
|
|
3095
|
+
type: import_v418.z.literal("exec"),
|
|
3096
|
+
command: import_v418.z.array(import_v418.z.string()),
|
|
3097
|
+
timeout_ms: import_v418.z.number().optional(),
|
|
3098
|
+
user: import_v418.z.string().optional(),
|
|
3099
|
+
working_directory: import_v418.z.string().optional(),
|
|
3100
|
+
env: import_v418.z.record(import_v418.z.string(), import_v418.z.string()).optional()
|
|
2993
3101
|
})
|
|
2994
3102
|
}),
|
|
2995
|
-
|
|
2996
|
-
type:
|
|
2997
|
-
call_id:
|
|
2998
|
-
name:
|
|
2999
|
-
arguments:
|
|
3000
|
-
id:
|
|
3103
|
+
import_v418.z.object({
|
|
3104
|
+
type: import_v418.z.literal("function_call"),
|
|
3105
|
+
call_id: import_v418.z.string(),
|
|
3106
|
+
name: import_v418.z.string(),
|
|
3107
|
+
arguments: import_v418.z.string(),
|
|
3108
|
+
id: import_v418.z.string()
|
|
3001
3109
|
}),
|
|
3002
|
-
|
|
3003
|
-
type:
|
|
3004
|
-
id:
|
|
3005
|
-
status:
|
|
3110
|
+
import_v418.z.object({
|
|
3111
|
+
type: import_v418.z.literal("computer_call"),
|
|
3112
|
+
id: import_v418.z.string(),
|
|
3113
|
+
status: import_v418.z.string().optional()
|
|
3006
3114
|
}),
|
|
3007
|
-
|
|
3008
|
-
type:
|
|
3009
|
-
id:
|
|
3010
|
-
encrypted_content:
|
|
3011
|
-
summary:
|
|
3012
|
-
|
|
3013
|
-
type:
|
|
3014
|
-
text:
|
|
3115
|
+
import_v418.z.object({
|
|
3116
|
+
type: import_v418.z.literal("reasoning"),
|
|
3117
|
+
id: import_v418.z.string(),
|
|
3118
|
+
encrypted_content: import_v418.z.string().nullish(),
|
|
3119
|
+
summary: import_v418.z.array(
|
|
3120
|
+
import_v418.z.object({
|
|
3121
|
+
type: import_v418.z.literal("summary_text"),
|
|
3122
|
+
text: import_v418.z.string()
|
|
3015
3123
|
})
|
|
3016
3124
|
)
|
|
3017
3125
|
}),
|
|
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:
|
|
3126
|
+
import_v418.z.object({
|
|
3127
|
+
type: import_v418.z.literal("mcp_call"),
|
|
3128
|
+
id: import_v418.z.string(),
|
|
3129
|
+
status: import_v418.z.string(),
|
|
3130
|
+
arguments: import_v418.z.string(),
|
|
3131
|
+
name: import_v418.z.string(),
|
|
3132
|
+
server_label: import_v418.z.string(),
|
|
3133
|
+
output: import_v418.z.string().nullish(),
|
|
3134
|
+
error: import_v418.z.union([
|
|
3135
|
+
import_v418.z.string(),
|
|
3136
|
+
import_v418.z.object({
|
|
3137
|
+
type: import_v418.z.string().optional(),
|
|
3138
|
+
code: import_v418.z.union([import_v418.z.number(), import_v418.z.string()]).optional(),
|
|
3139
|
+
message: import_v418.z.string().optional()
|
|
3032
3140
|
}).loose()
|
|
3033
3141
|
]).nullish()
|
|
3034
3142
|
}),
|
|
3035
|
-
|
|
3036
|
-
type:
|
|
3037
|
-
id:
|
|
3038
|
-
server_label:
|
|
3039
|
-
tools:
|
|
3040
|
-
|
|
3041
|
-
name:
|
|
3042
|
-
description:
|
|
3043
|
-
input_schema:
|
|
3044
|
-
annotations:
|
|
3143
|
+
import_v418.z.object({
|
|
3144
|
+
type: import_v418.z.literal("mcp_list_tools"),
|
|
3145
|
+
id: import_v418.z.string(),
|
|
3146
|
+
server_label: import_v418.z.string(),
|
|
3147
|
+
tools: import_v418.z.array(
|
|
3148
|
+
import_v418.z.object({
|
|
3149
|
+
name: import_v418.z.string(),
|
|
3150
|
+
description: import_v418.z.string().optional(),
|
|
3151
|
+
input_schema: import_v418.z.any(),
|
|
3152
|
+
annotations: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()).optional()
|
|
3045
3153
|
})
|
|
3046
3154
|
),
|
|
3047
|
-
error:
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
type:
|
|
3051
|
-
code:
|
|
3052
|
-
message:
|
|
3155
|
+
error: import_v418.z.union([
|
|
3156
|
+
import_v418.z.string(),
|
|
3157
|
+
import_v418.z.object({
|
|
3158
|
+
type: import_v418.z.string().optional(),
|
|
3159
|
+
code: import_v418.z.union([import_v418.z.number(), import_v418.z.string()]).optional(),
|
|
3160
|
+
message: import_v418.z.string().optional()
|
|
3053
3161
|
}).loose()
|
|
3054
3162
|
]).optional()
|
|
3055
3163
|
}),
|
|
3056
|
-
|
|
3057
|
-
type:
|
|
3058
|
-
id:
|
|
3059
|
-
server_label:
|
|
3060
|
-
name:
|
|
3061
|
-
arguments:
|
|
3062
|
-
approval_request_id:
|
|
3164
|
+
import_v418.z.object({
|
|
3165
|
+
type: import_v418.z.literal("mcp_approval_request"),
|
|
3166
|
+
id: import_v418.z.string(),
|
|
3167
|
+
server_label: import_v418.z.string(),
|
|
3168
|
+
name: import_v418.z.string(),
|
|
3169
|
+
arguments: import_v418.z.string(),
|
|
3170
|
+
approval_request_id: import_v418.z.string()
|
|
3171
|
+
}),
|
|
3172
|
+
import_v418.z.object({
|
|
3173
|
+
type: import_v418.z.literal("apply_patch_call"),
|
|
3174
|
+
id: import_v418.z.string(),
|
|
3175
|
+
call_id: import_v418.z.string(),
|
|
3176
|
+
status: import_v418.z.enum(["in_progress", "completed"]),
|
|
3177
|
+
operation: import_v418.z.discriminatedUnion("type", [
|
|
3178
|
+
import_v418.z.object({
|
|
3179
|
+
type: import_v418.z.literal("create_file"),
|
|
3180
|
+
path: import_v418.z.string(),
|
|
3181
|
+
diff: import_v418.z.string()
|
|
3182
|
+
}),
|
|
3183
|
+
import_v418.z.object({
|
|
3184
|
+
type: import_v418.z.literal("delete_file"),
|
|
3185
|
+
path: import_v418.z.string()
|
|
3186
|
+
}),
|
|
3187
|
+
import_v418.z.object({
|
|
3188
|
+
type: import_v418.z.literal("update_file"),
|
|
3189
|
+
path: import_v418.z.string(),
|
|
3190
|
+
diff: import_v418.z.string()
|
|
3191
|
+
})
|
|
3192
|
+
])
|
|
3063
3193
|
})
|
|
3064
3194
|
])
|
|
3065
3195
|
).optional(),
|
|
3066
|
-
service_tier:
|
|
3067
|
-
incomplete_details:
|
|
3068
|
-
usage:
|
|
3069
|
-
input_tokens:
|
|
3070
|
-
input_tokens_details:
|
|
3071
|
-
output_tokens:
|
|
3072
|
-
output_tokens_details:
|
|
3196
|
+
service_tier: import_v418.z.string().nullish(),
|
|
3197
|
+
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
3198
|
+
usage: import_v418.z.object({
|
|
3199
|
+
input_tokens: import_v418.z.number(),
|
|
3200
|
+
input_tokens_details: import_v418.z.object({ cached_tokens: import_v418.z.number().nullish() }).nullish(),
|
|
3201
|
+
output_tokens: import_v418.z.number(),
|
|
3202
|
+
output_tokens_details: import_v418.z.object({ reasoning_tokens: import_v418.z.number().nullish() }).nullish()
|
|
3073
3203
|
}).optional()
|
|
3074
3204
|
})
|
|
3075
3205
|
)
|
|
3076
3206
|
);
|
|
3077
3207
|
|
|
3078
3208
|
// src/responses/openai-responses-options.ts
|
|
3079
|
-
var
|
|
3080
|
-
var
|
|
3209
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
3210
|
+
var import_v419 = require("zod/v4");
|
|
3081
3211
|
var TOP_LOGPROBS_MAX = 20;
|
|
3082
3212
|
var openaiResponsesReasoningModelIds = [
|
|
3083
3213
|
"o1",
|
|
@@ -3144,19 +3274,19 @@ var openaiResponsesModelIds = [
|
|
|
3144
3274
|
"gpt-5-chat-latest",
|
|
3145
3275
|
...openaiResponsesReasoningModelIds
|
|
3146
3276
|
];
|
|
3147
|
-
var openaiResponsesProviderOptionsSchema = (0,
|
|
3148
|
-
() => (0,
|
|
3149
|
-
|
|
3150
|
-
conversation:
|
|
3151
|
-
include:
|
|
3152
|
-
|
|
3277
|
+
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils24.lazySchema)(
|
|
3278
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
3279
|
+
import_v419.z.object({
|
|
3280
|
+
conversation: import_v419.z.string().nullish(),
|
|
3281
|
+
include: import_v419.z.array(
|
|
3282
|
+
import_v419.z.enum([
|
|
3153
3283
|
"reasoning.encrypted_content",
|
|
3154
3284
|
// handled internally by default, only needed for unknown reasoning models
|
|
3155
3285
|
"file_search_call.results",
|
|
3156
3286
|
"message.output_text.logprobs"
|
|
3157
3287
|
])
|
|
3158
3288
|
).nullish(),
|
|
3159
|
-
instructions:
|
|
3289
|
+
instructions: import_v419.z.string().nullish(),
|
|
3160
3290
|
/**
|
|
3161
3291
|
* Return the log probabilities of the tokens.
|
|
3162
3292
|
*
|
|
@@ -3169,17 +3299,17 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazySchem
|
|
|
3169
3299
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3170
3300
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3171
3301
|
*/
|
|
3172
|
-
logprobs:
|
|
3302
|
+
logprobs: import_v419.z.union([import_v419.z.boolean(), import_v419.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3173
3303
|
/**
|
|
3174
3304
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3175
3305
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3176
3306
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3177
3307
|
*/
|
|
3178
|
-
maxToolCalls:
|
|
3179
|
-
metadata:
|
|
3180
|
-
parallelToolCalls:
|
|
3181
|
-
previousResponseId:
|
|
3182
|
-
promptCacheKey:
|
|
3308
|
+
maxToolCalls: import_v419.z.number().nullish(),
|
|
3309
|
+
metadata: import_v419.z.any().nullish(),
|
|
3310
|
+
parallelToolCalls: import_v419.z.boolean().nullish(),
|
|
3311
|
+
previousResponseId: import_v419.z.string().nullish(),
|
|
3312
|
+
promptCacheKey: import_v419.z.string().nullish(),
|
|
3183
3313
|
/**
|
|
3184
3314
|
* The retention policy for the prompt cache.
|
|
3185
3315
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -3188,23 +3318,23 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazySchem
|
|
|
3188
3318
|
*
|
|
3189
3319
|
* @default 'in_memory'
|
|
3190
3320
|
*/
|
|
3191
|
-
promptCacheRetention:
|
|
3192
|
-
reasoningEffort:
|
|
3193
|
-
reasoningSummary:
|
|
3194
|
-
safetyIdentifier:
|
|
3195
|
-
serviceTier:
|
|
3196
|
-
store:
|
|
3197
|
-
strictJsonSchema:
|
|
3198
|
-
textVerbosity:
|
|
3199
|
-
truncation:
|
|
3200
|
-
user:
|
|
3321
|
+
promptCacheRetention: import_v419.z.enum(["in_memory", "24h"]).nullish(),
|
|
3322
|
+
reasoningEffort: import_v419.z.string().nullish(),
|
|
3323
|
+
reasoningSummary: import_v419.z.string().nullish(),
|
|
3324
|
+
safetyIdentifier: import_v419.z.string().nullish(),
|
|
3325
|
+
serviceTier: import_v419.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3326
|
+
store: import_v419.z.boolean().nullish(),
|
|
3327
|
+
strictJsonSchema: import_v419.z.boolean().nullish(),
|
|
3328
|
+
textVerbosity: import_v419.z.enum(["low", "medium", "high"]).nullish(),
|
|
3329
|
+
truncation: import_v419.z.enum(["auto", "disabled"]).nullish(),
|
|
3330
|
+
user: import_v419.z.string().nullish()
|
|
3201
3331
|
})
|
|
3202
3332
|
)
|
|
3203
3333
|
);
|
|
3204
3334
|
|
|
3205
3335
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3206
3336
|
var import_provider7 = require("@ai-sdk/provider");
|
|
3207
|
-
var
|
|
3337
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
3208
3338
|
async function prepareResponsesTools({
|
|
3209
3339
|
tools,
|
|
3210
3340
|
toolChoice,
|
|
@@ -3230,7 +3360,7 @@ async function prepareResponsesTools({
|
|
|
3230
3360
|
case "provider": {
|
|
3231
3361
|
switch (tool.id) {
|
|
3232
3362
|
case "openai.file_search": {
|
|
3233
|
-
const args = await (0,
|
|
3363
|
+
const args = await (0, import_provider_utils25.validateTypes)({
|
|
3234
3364
|
value: tool.args,
|
|
3235
3365
|
schema: fileSearchArgsSchema
|
|
3236
3366
|
});
|
|
@@ -3252,8 +3382,14 @@ async function prepareResponsesTools({
|
|
|
3252
3382
|
});
|
|
3253
3383
|
break;
|
|
3254
3384
|
}
|
|
3385
|
+
case "openai.apply_patch": {
|
|
3386
|
+
openaiTools2.push({
|
|
3387
|
+
type: "apply_patch"
|
|
3388
|
+
});
|
|
3389
|
+
break;
|
|
3390
|
+
}
|
|
3255
3391
|
case "openai.web_search_preview": {
|
|
3256
|
-
const args = await (0,
|
|
3392
|
+
const args = await (0, import_provider_utils25.validateTypes)({
|
|
3257
3393
|
value: tool.args,
|
|
3258
3394
|
schema: webSearchPreviewArgsSchema
|
|
3259
3395
|
});
|
|
@@ -3265,7 +3401,7 @@ async function prepareResponsesTools({
|
|
|
3265
3401
|
break;
|
|
3266
3402
|
}
|
|
3267
3403
|
case "openai.web_search": {
|
|
3268
|
-
const args = await (0,
|
|
3404
|
+
const args = await (0, import_provider_utils25.validateTypes)({
|
|
3269
3405
|
value: tool.args,
|
|
3270
3406
|
schema: webSearchArgsSchema
|
|
3271
3407
|
});
|
|
@@ -3279,7 +3415,7 @@ async function prepareResponsesTools({
|
|
|
3279
3415
|
break;
|
|
3280
3416
|
}
|
|
3281
3417
|
case "openai.code_interpreter": {
|
|
3282
|
-
const args = await (0,
|
|
3418
|
+
const args = await (0, import_provider_utils25.validateTypes)({
|
|
3283
3419
|
value: tool.args,
|
|
3284
3420
|
schema: codeInterpreterArgsSchema
|
|
3285
3421
|
});
|
|
@@ -3290,7 +3426,7 @@ async function prepareResponsesTools({
|
|
|
3290
3426
|
break;
|
|
3291
3427
|
}
|
|
3292
3428
|
case "openai.image_generation": {
|
|
3293
|
-
const args = await (0,
|
|
3429
|
+
const args = await (0, import_provider_utils25.validateTypes)({
|
|
3294
3430
|
value: tool.args,
|
|
3295
3431
|
schema: imageGenerationArgsSchema
|
|
3296
3432
|
});
|
|
@@ -3313,7 +3449,7 @@ async function prepareResponsesTools({
|
|
|
3313
3449
|
break;
|
|
3314
3450
|
}
|
|
3315
3451
|
case "openai.mcp": {
|
|
3316
|
-
const args = await (0,
|
|
3452
|
+
const args = await (0, import_provider_utils25.validateTypes)({
|
|
3317
3453
|
value: tool.args,
|
|
3318
3454
|
schema: mcpArgsSchema
|
|
3319
3455
|
});
|
|
@@ -3356,7 +3492,7 @@ async function prepareResponsesTools({
|
|
|
3356
3492
|
case "tool":
|
|
3357
3493
|
return {
|
|
3358
3494
|
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 },
|
|
3495
|
+
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
3496
|
toolWarnings
|
|
3361
3497
|
};
|
|
3362
3498
|
default: {
|
|
@@ -3415,7 +3551,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3415
3551
|
if (stopSequences != null) {
|
|
3416
3552
|
warnings.push({ type: "unsupported", feature: "stopSequences" });
|
|
3417
3553
|
}
|
|
3418
|
-
const openaiOptions = await (0,
|
|
3554
|
+
const openaiOptions = await (0, import_provider_utils26.parseProviderOptions)({
|
|
3419
3555
|
provider: "openai",
|
|
3420
3556
|
providerOptions,
|
|
3421
3557
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -3427,7 +3563,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3427
3563
|
details: "conversation and previousResponseId cannot be used together"
|
|
3428
3564
|
});
|
|
3429
3565
|
}
|
|
3430
|
-
const toolNameMapping = (0,
|
|
3566
|
+
const toolNameMapping = (0, import_provider_utils26.createToolNameMapping)({
|
|
3431
3567
|
tools,
|
|
3432
3568
|
providerToolNames: {
|
|
3433
3569
|
"openai.code_interpreter": "code_interpreter",
|
|
@@ -3436,7 +3572,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3436
3572
|
"openai.local_shell": "local_shell",
|
|
3437
3573
|
"openai.web_search": "web_search",
|
|
3438
3574
|
"openai.web_search_preview": "web_search_preview",
|
|
3439
|
-
"openai.mcp": "mcp"
|
|
3575
|
+
"openai.mcp": "mcp",
|
|
3576
|
+
"openai.apply_patch": "apply_patch"
|
|
3440
3577
|
}
|
|
3441
3578
|
});
|
|
3442
3579
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
@@ -3445,7 +3582,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3445
3582
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
3446
3583
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
3447
3584
|
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
3448
|
-
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
3585
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
3586
|
+
hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
|
|
3449
3587
|
});
|
|
3450
3588
|
warnings.push(...inputWarnings);
|
|
3451
3589
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
@@ -3614,12 +3752,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3614
3752
|
responseHeaders,
|
|
3615
3753
|
value: response,
|
|
3616
3754
|
rawValue: rawResponse
|
|
3617
|
-
} = await (0,
|
|
3755
|
+
} = await (0, import_provider_utils26.postJsonToApi)({
|
|
3618
3756
|
url,
|
|
3619
|
-
headers: (0,
|
|
3757
|
+
headers: (0, import_provider_utils26.combineHeaders)(this.config.headers(), options.headers),
|
|
3620
3758
|
body,
|
|
3621
3759
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3622
|
-
successfulResponseHandler: (0,
|
|
3760
|
+
successfulResponseHandler: (0, import_provider_utils26.createJsonResponseHandler)(
|
|
3623
3761
|
openaiResponsesResponseSchema
|
|
3624
3762
|
),
|
|
3625
3763
|
abortSignal: options.abortSignal,
|
|
@@ -3716,7 +3854,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3716
3854
|
content.push({
|
|
3717
3855
|
type: "source",
|
|
3718
3856
|
sourceType: "url",
|
|
3719
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
3857
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils26.generateId)(),
|
|
3720
3858
|
url: annotation.url,
|
|
3721
3859
|
title: annotation.title
|
|
3722
3860
|
});
|
|
@@ -3724,7 +3862,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3724
3862
|
content.push({
|
|
3725
3863
|
type: "source",
|
|
3726
3864
|
sourceType: "document",
|
|
3727
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
3865
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils26.generateId)(),
|
|
3728
3866
|
mediaType: "text/plain",
|
|
3729
3867
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3730
3868
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
|
|
@@ -3740,7 +3878,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3740
3878
|
content.push({
|
|
3741
3879
|
type: "source",
|
|
3742
3880
|
sourceType: "document",
|
|
3743
|
-
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0,
|
|
3881
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils26.generateId)(),
|
|
3744
3882
|
mediaType: "text/plain",
|
|
3745
3883
|
title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
|
|
3746
3884
|
filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
|
|
@@ -3756,7 +3894,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3756
3894
|
content.push({
|
|
3757
3895
|
type: "source",
|
|
3758
3896
|
sourceType: "document",
|
|
3759
|
-
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0,
|
|
3897
|
+
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils26.generateId)(),
|
|
3760
3898
|
mediaType: "application/octet-stream",
|
|
3761
3899
|
title: annotation.file_id,
|
|
3762
3900
|
filename: annotation.file_id,
|
|
@@ -3946,6 +4084,23 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3946
4084
|
});
|
|
3947
4085
|
break;
|
|
3948
4086
|
}
|
|
4087
|
+
case "apply_patch_call": {
|
|
4088
|
+
content.push({
|
|
4089
|
+
type: "tool-call",
|
|
4090
|
+
toolCallId: part.call_id,
|
|
4091
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4092
|
+
input: JSON.stringify({
|
|
4093
|
+
callId: part.call_id,
|
|
4094
|
+
operation: part.operation
|
|
4095
|
+
}),
|
|
4096
|
+
providerMetadata: {
|
|
4097
|
+
[providerKey]: {
|
|
4098
|
+
itemId: part.id
|
|
4099
|
+
}
|
|
4100
|
+
}
|
|
4101
|
+
});
|
|
4102
|
+
break;
|
|
4103
|
+
}
|
|
3949
4104
|
}
|
|
3950
4105
|
}
|
|
3951
4106
|
const providerMetadata = {
|
|
@@ -3991,18 +4146,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3991
4146
|
toolNameMapping,
|
|
3992
4147
|
store
|
|
3993
4148
|
} = await this.getArgs(options);
|
|
3994
|
-
const { responseHeaders, value: response } = await (0,
|
|
4149
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils26.postJsonToApi)({
|
|
3995
4150
|
url: this.config.url({
|
|
3996
4151
|
path: "/responses",
|
|
3997
4152
|
modelId: this.modelId
|
|
3998
4153
|
}),
|
|
3999
|
-
headers: (0,
|
|
4154
|
+
headers: (0, import_provider_utils26.combineHeaders)(this.config.headers(), options.headers),
|
|
4000
4155
|
body: {
|
|
4001
4156
|
...body,
|
|
4002
4157
|
stream: true
|
|
4003
4158
|
},
|
|
4004
4159
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4005
|
-
successfulResponseHandler: (0,
|
|
4160
|
+
successfulResponseHandler: (0, import_provider_utils26.createEventSourceResponseHandler)(
|
|
4006
4161
|
openaiResponsesChunkSchema
|
|
4007
4162
|
),
|
|
4008
4163
|
abortSignal: options.abortSignal,
|
|
@@ -4133,6 +4288,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4133
4288
|
input: "{}",
|
|
4134
4289
|
providerExecuted: true
|
|
4135
4290
|
});
|
|
4291
|
+
} else if (value.item.type === "apply_patch_call") {
|
|
4292
|
+
ongoingToolCalls[value.output_index] = {
|
|
4293
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4294
|
+
toolCallId: value.item.call_id
|
|
4295
|
+
};
|
|
4296
|
+
if (value.item.status === "completed") {
|
|
4297
|
+
controller.enqueue({
|
|
4298
|
+
type: "tool-call",
|
|
4299
|
+
toolCallId: value.item.call_id,
|
|
4300
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4301
|
+
input: JSON.stringify({
|
|
4302
|
+
callId: value.item.call_id,
|
|
4303
|
+
operation: value.item.operation
|
|
4304
|
+
}),
|
|
4305
|
+
providerMetadata: {
|
|
4306
|
+
[providerKey]: {
|
|
4307
|
+
itemId: value.item.id
|
|
4308
|
+
}
|
|
4309
|
+
}
|
|
4310
|
+
});
|
|
4311
|
+
}
|
|
4136
4312
|
} else if (value.item.type === "message") {
|
|
4137
4313
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
4138
4314
|
controller.enqueue({
|
|
@@ -4296,6 +4472,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4296
4472
|
...value.item.error != null ? { error: value.item.error } : {}
|
|
4297
4473
|
}
|
|
4298
4474
|
});
|
|
4475
|
+
} else if (value.item.type === "apply_patch_call") {
|
|
4476
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
4477
|
+
if (value.item.status === "completed") {
|
|
4478
|
+
controller.enqueue({
|
|
4479
|
+
type: "tool-call",
|
|
4480
|
+
toolCallId: value.item.call_id,
|
|
4481
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4482
|
+
input: JSON.stringify({
|
|
4483
|
+
callId: value.item.call_id,
|
|
4484
|
+
operation: value.item.operation
|
|
4485
|
+
}),
|
|
4486
|
+
providerMetadata: {
|
|
4487
|
+
[providerKey]: {
|
|
4488
|
+
itemId: value.item.id
|
|
4489
|
+
}
|
|
4490
|
+
}
|
|
4491
|
+
});
|
|
4492
|
+
}
|
|
4299
4493
|
} else if (value.item.type === "mcp_approval_request") {
|
|
4300
4494
|
ongoingToolCalls[value.output_index] = void 0;
|
|
4301
4495
|
controller.enqueue({
|
|
@@ -4493,7 +4687,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4493
4687
|
controller.enqueue({
|
|
4494
4688
|
type: "source",
|
|
4495
4689
|
sourceType: "url",
|
|
4496
|
-
id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0,
|
|
4690
|
+
id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0, import_provider_utils26.generateId)(),
|
|
4497
4691
|
url: value.annotation.url,
|
|
4498
4692
|
title: value.annotation.title
|
|
4499
4693
|
});
|
|
@@ -4501,7 +4695,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4501
4695
|
controller.enqueue({
|
|
4502
4696
|
type: "source",
|
|
4503
4697
|
sourceType: "document",
|
|
4504
|
-
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0,
|
|
4698
|
+
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0, import_provider_utils26.generateId)(),
|
|
4505
4699
|
mediaType: "text/plain",
|
|
4506
4700
|
title: (_u = (_t = value.annotation.quote) != null ? _t : value.annotation.filename) != null ? _u : "Document",
|
|
4507
4701
|
filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
|
|
@@ -4517,7 +4711,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4517
4711
|
controller.enqueue({
|
|
4518
4712
|
type: "source",
|
|
4519
4713
|
sourceType: "document",
|
|
4520
|
-
id: (_y = (_x = (_w = self.config).generateId) == null ? void 0 : _x.call(_w)) != null ? _y : (0,
|
|
4714
|
+
id: (_y = (_x = (_w = self.config).generateId) == null ? void 0 : _x.call(_w)) != null ? _y : (0, import_provider_utils26.generateId)(),
|
|
4521
4715
|
mediaType: "text/plain",
|
|
4522
4716
|
title: (_A = (_z = value.annotation.filename) != null ? _z : value.annotation.file_id) != null ? _A : "Document",
|
|
4523
4717
|
filename: (_B = value.annotation.filename) != null ? _B : value.annotation.file_id,
|
|
@@ -4533,7 +4727,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4533
4727
|
controller.enqueue({
|
|
4534
4728
|
type: "source",
|
|
4535
4729
|
sourceType: "document",
|
|
4536
|
-
id: (_E = (_D = (_C = self.config).generateId) == null ? void 0 : _D.call(_C)) != null ? _E : (0,
|
|
4730
|
+
id: (_E = (_D = (_C = self.config).generateId) == null ? void 0 : _D.call(_C)) != null ? _E : (0, import_provider_utils26.generateId)(),
|
|
4537
4731
|
mediaType: "application/octet-stream",
|
|
4538
4732
|
title: value.annotation.file_id,
|
|
4539
4733
|
filename: value.annotation.file_id,
|
|
@@ -4639,16 +4833,16 @@ function mapWebSearchOutput(action) {
|
|
|
4639
4833
|
}
|
|
4640
4834
|
|
|
4641
4835
|
// src/speech/openai-speech-model.ts
|
|
4642
|
-
var
|
|
4836
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
4643
4837
|
|
|
4644
4838
|
// src/speech/openai-speech-options.ts
|
|
4645
|
-
var
|
|
4646
|
-
var
|
|
4647
|
-
var openaiSpeechProviderOptionsSchema = (0,
|
|
4648
|
-
() => (0,
|
|
4649
|
-
|
|
4650
|
-
instructions:
|
|
4651
|
-
speed:
|
|
4839
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
4840
|
+
var import_v420 = require("zod/v4");
|
|
4841
|
+
var openaiSpeechProviderOptionsSchema = (0, import_provider_utils27.lazySchema)(
|
|
4842
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
4843
|
+
import_v420.z.object({
|
|
4844
|
+
instructions: import_v420.z.string().nullish(),
|
|
4845
|
+
speed: import_v420.z.number().min(0.25).max(4).default(1).nullish()
|
|
4652
4846
|
})
|
|
4653
4847
|
)
|
|
4654
4848
|
);
|
|
@@ -4673,7 +4867,7 @@ var OpenAISpeechModel = class {
|
|
|
4673
4867
|
providerOptions
|
|
4674
4868
|
}) {
|
|
4675
4869
|
const warnings = [];
|
|
4676
|
-
const openAIOptions = await (0,
|
|
4870
|
+
const openAIOptions = await (0, import_provider_utils28.parseProviderOptions)({
|
|
4677
4871
|
provider: "openai",
|
|
4678
4872
|
providerOptions,
|
|
4679
4873
|
schema: openaiSpeechProviderOptionsSchema
|
|
@@ -4726,15 +4920,15 @@ var OpenAISpeechModel = class {
|
|
|
4726
4920
|
value: audio,
|
|
4727
4921
|
responseHeaders,
|
|
4728
4922
|
rawValue: rawResponse
|
|
4729
|
-
} = await (0,
|
|
4923
|
+
} = await (0, import_provider_utils28.postJsonToApi)({
|
|
4730
4924
|
url: this.config.url({
|
|
4731
4925
|
path: "/audio/speech",
|
|
4732
4926
|
modelId: this.modelId
|
|
4733
4927
|
}),
|
|
4734
|
-
headers: (0,
|
|
4928
|
+
headers: (0, import_provider_utils28.combineHeaders)(this.config.headers(), options.headers),
|
|
4735
4929
|
body: requestBody,
|
|
4736
4930
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4737
|
-
successfulResponseHandler: (0,
|
|
4931
|
+
successfulResponseHandler: (0, import_provider_utils28.createBinaryResponseHandler)(),
|
|
4738
4932
|
abortSignal: options.abortSignal,
|
|
4739
4933
|
fetch: this.config.fetch
|
|
4740
4934
|
});
|
|
@@ -4755,36 +4949,36 @@ var OpenAISpeechModel = class {
|
|
|
4755
4949
|
};
|
|
4756
4950
|
|
|
4757
4951
|
// src/transcription/openai-transcription-model.ts
|
|
4758
|
-
var
|
|
4952
|
+
var import_provider_utils31 = require("@ai-sdk/provider-utils");
|
|
4759
4953
|
|
|
4760
4954
|
// 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:
|
|
4955
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
4956
|
+
var import_v421 = require("zod/v4");
|
|
4957
|
+
var openaiTranscriptionResponseSchema = (0, import_provider_utils29.lazySchema)(
|
|
4958
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
4959
|
+
import_v421.z.object({
|
|
4960
|
+
text: import_v421.z.string(),
|
|
4961
|
+
language: import_v421.z.string().nullish(),
|
|
4962
|
+
duration: import_v421.z.number().nullish(),
|
|
4963
|
+
words: import_v421.z.array(
|
|
4964
|
+
import_v421.z.object({
|
|
4965
|
+
word: import_v421.z.string(),
|
|
4966
|
+
start: import_v421.z.number(),
|
|
4967
|
+
end: import_v421.z.number()
|
|
4774
4968
|
})
|
|
4775
4969
|
).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:
|
|
4970
|
+
segments: import_v421.z.array(
|
|
4971
|
+
import_v421.z.object({
|
|
4972
|
+
id: import_v421.z.number(),
|
|
4973
|
+
seek: import_v421.z.number(),
|
|
4974
|
+
start: import_v421.z.number(),
|
|
4975
|
+
end: import_v421.z.number(),
|
|
4976
|
+
text: import_v421.z.string(),
|
|
4977
|
+
tokens: import_v421.z.array(import_v421.z.number()),
|
|
4978
|
+
temperature: import_v421.z.number(),
|
|
4979
|
+
avg_logprob: import_v421.z.number(),
|
|
4980
|
+
compression_ratio: import_v421.z.number(),
|
|
4981
|
+
no_speech_prob: import_v421.z.number()
|
|
4788
4982
|
})
|
|
4789
4983
|
).nullish()
|
|
4790
4984
|
})
|
|
@@ -4792,33 +4986,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils28.lazySchema)(
|
|
|
4792
4986
|
);
|
|
4793
4987
|
|
|
4794
4988
|
// src/transcription/openai-transcription-options.ts
|
|
4795
|
-
var
|
|
4796
|
-
var
|
|
4797
|
-
var openAITranscriptionProviderOptions = (0,
|
|
4798
|
-
() => (0,
|
|
4799
|
-
|
|
4989
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
4990
|
+
var import_v422 = require("zod/v4");
|
|
4991
|
+
var openAITranscriptionProviderOptions = (0, import_provider_utils30.lazySchema)(
|
|
4992
|
+
() => (0, import_provider_utils30.zodSchema)(
|
|
4993
|
+
import_v422.z.object({
|
|
4800
4994
|
/**
|
|
4801
4995
|
* Additional information to include in the transcription response.
|
|
4802
4996
|
*/
|
|
4803
|
-
include:
|
|
4997
|
+
include: import_v422.z.array(import_v422.z.string()).optional(),
|
|
4804
4998
|
/**
|
|
4805
4999
|
* The language of the input audio in ISO-639-1 format.
|
|
4806
5000
|
*/
|
|
4807
|
-
language:
|
|
5001
|
+
language: import_v422.z.string().optional(),
|
|
4808
5002
|
/**
|
|
4809
5003
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
4810
5004
|
*/
|
|
4811
|
-
prompt:
|
|
5005
|
+
prompt: import_v422.z.string().optional(),
|
|
4812
5006
|
/**
|
|
4813
5007
|
* The sampling temperature, between 0 and 1.
|
|
4814
5008
|
* @default 0
|
|
4815
5009
|
*/
|
|
4816
|
-
temperature:
|
|
5010
|
+
temperature: import_v422.z.number().min(0).max(1).default(0).optional(),
|
|
4817
5011
|
/**
|
|
4818
5012
|
* The timestamp granularities to populate for this transcription.
|
|
4819
5013
|
* @default ['segment']
|
|
4820
5014
|
*/
|
|
4821
|
-
timestampGranularities:
|
|
5015
|
+
timestampGranularities: import_v422.z.array(import_v422.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
4822
5016
|
})
|
|
4823
5017
|
)
|
|
4824
5018
|
);
|
|
@@ -4898,15 +5092,15 @@ var OpenAITranscriptionModel = class {
|
|
|
4898
5092
|
providerOptions
|
|
4899
5093
|
}) {
|
|
4900
5094
|
const warnings = [];
|
|
4901
|
-
const openAIOptions = await (0,
|
|
5095
|
+
const openAIOptions = await (0, import_provider_utils31.parseProviderOptions)({
|
|
4902
5096
|
provider: "openai",
|
|
4903
5097
|
providerOptions,
|
|
4904
5098
|
schema: openAITranscriptionProviderOptions
|
|
4905
5099
|
});
|
|
4906
5100
|
const formData = new FormData();
|
|
4907
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0,
|
|
5101
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils31.convertBase64ToUint8Array)(audio)]);
|
|
4908
5102
|
formData.append("model", this.modelId);
|
|
4909
|
-
const fileExtension = (0,
|
|
5103
|
+
const fileExtension = (0, import_provider_utils31.mediaTypeToExtension)(mediaType);
|
|
4910
5104
|
formData.append(
|
|
4911
5105
|
"file",
|
|
4912
5106
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -4951,15 +5145,15 @@ var OpenAITranscriptionModel = class {
|
|
|
4951
5145
|
value: response,
|
|
4952
5146
|
responseHeaders,
|
|
4953
5147
|
rawValue: rawResponse
|
|
4954
|
-
} = await (0,
|
|
5148
|
+
} = await (0, import_provider_utils31.postFormDataToApi)({
|
|
4955
5149
|
url: this.config.url({
|
|
4956
5150
|
path: "/audio/transcriptions",
|
|
4957
5151
|
modelId: this.modelId
|
|
4958
5152
|
}),
|
|
4959
|
-
headers: (0,
|
|
5153
|
+
headers: (0, import_provider_utils31.combineHeaders)(this.config.headers(), options.headers),
|
|
4960
5154
|
formData,
|
|
4961
5155
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4962
|
-
successfulResponseHandler: (0,
|
|
5156
|
+
successfulResponseHandler: (0, import_provider_utils31.createJsonResponseHandler)(
|
|
4963
5157
|
openaiTranscriptionResponseSchema
|
|
4964
5158
|
),
|
|
4965
5159
|
abortSignal: options.abortSignal,
|
|
@@ -4991,21 +5185,21 @@ var OpenAITranscriptionModel = class {
|
|
|
4991
5185
|
};
|
|
4992
5186
|
|
|
4993
5187
|
// src/version.ts
|
|
4994
|
-
var VERSION = true ? "3.0.0-beta.
|
|
5188
|
+
var VERSION = true ? "3.0.0-beta.74" : "0.0.0-test";
|
|
4995
5189
|
|
|
4996
5190
|
// src/openai-provider.ts
|
|
4997
5191
|
function createOpenAI(options = {}) {
|
|
4998
5192
|
var _a, _b;
|
|
4999
|
-
const baseURL = (_a = (0,
|
|
5000
|
-
(0,
|
|
5193
|
+
const baseURL = (_a = (0, import_provider_utils32.withoutTrailingSlash)(
|
|
5194
|
+
(0, import_provider_utils32.loadOptionalSetting)({
|
|
5001
5195
|
settingValue: options.baseURL,
|
|
5002
5196
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
5003
5197
|
})
|
|
5004
5198
|
)) != null ? _a : "https://api.openai.com/v1";
|
|
5005
5199
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
5006
|
-
const getHeaders = () => (0,
|
|
5200
|
+
const getHeaders = () => (0, import_provider_utils32.withUserAgentSuffix)(
|
|
5007
5201
|
{
|
|
5008
|
-
Authorization: `Bearer ${(0,
|
|
5202
|
+
Authorization: `Bearer ${(0, import_provider_utils32.loadApiKey)({
|
|
5009
5203
|
apiKey: options.apiKey,
|
|
5010
5204
|
environmentVariableName: "OPENAI_API_KEY",
|
|
5011
5205
|
description: "OpenAI"
|