@ai-sdk/openai 2.0.105 → 2.0.106
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 +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +686 -624
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +637 -571
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +20 -2
- package/dist/internal/index.d.ts +20 -2
- package/dist/internal/index.js +683 -617
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +638 -570
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
|
|
29
29
|
// src/openai-provider.ts
|
|
30
|
-
var
|
|
30
|
+
var import_provider_utils31 = 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");
|
|
@@ -1631,7 +1631,7 @@ var OpenAIEmbeddingModel = class {
|
|
|
1631
1631
|
};
|
|
1632
1632
|
|
|
1633
1633
|
// src/image/openai-image-model.ts
|
|
1634
|
-
var
|
|
1634
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
1635
1635
|
|
|
1636
1636
|
// src/image/openai-image-api.ts
|
|
1637
1637
|
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
@@ -1664,6 +1664,8 @@ var openaiImageResponseSchema = (0, import_provider_utils12.lazyValidator)(
|
|
|
1664
1664
|
);
|
|
1665
1665
|
|
|
1666
1666
|
// src/image/openai-image-options.ts
|
|
1667
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
1668
|
+
var import_v49 = require("zod/v4");
|
|
1667
1669
|
var modelMaxImagesPerCall = {
|
|
1668
1670
|
"dall-e-3": 1,
|
|
1669
1671
|
"dall-e-2": 10,
|
|
@@ -1678,6 +1680,55 @@ var hasDefaultResponseFormat = /* @__PURE__ */ new Set([
|
|
|
1678
1680
|
"gpt-image-1.5",
|
|
1679
1681
|
"gpt-image-2"
|
|
1680
1682
|
]);
|
|
1683
|
+
var baseImageModelOptionsObject = import_v49.z.object({
|
|
1684
|
+
/**
|
|
1685
|
+
* Quality of the generated image(s).
|
|
1686
|
+
*
|
|
1687
|
+
* Valid values: `standard`, `hd`, `low`, `medium`, `high`, `auto`.
|
|
1688
|
+
*/
|
|
1689
|
+
quality: import_v49.z.enum(["standard", "hd", "low", "medium", "high", "auto"]).optional(),
|
|
1690
|
+
/**
|
|
1691
|
+
* Background behavior for the generated image(s).
|
|
1692
|
+
*
|
|
1693
|
+
* If `transparent`, the output format must support transparency
|
|
1694
|
+
* (i.e. `png` or `webp`).
|
|
1695
|
+
*/
|
|
1696
|
+
background: import_v49.z.enum(["transparent", "opaque", "auto"]).optional(),
|
|
1697
|
+
/**
|
|
1698
|
+
* Format in which the generated image(s) are returned.
|
|
1699
|
+
*/
|
|
1700
|
+
outputFormat: import_v49.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
1701
|
+
/**
|
|
1702
|
+
* Compression level (0-100) for the generated image(s). Applies to the
|
|
1703
|
+
* `jpeg` and `webp` output formats.
|
|
1704
|
+
*/
|
|
1705
|
+
outputCompression: import_v49.z.number().int().min(0).max(100).optional(),
|
|
1706
|
+
/**
|
|
1707
|
+
* A unique identifier representing your end-user, which can help OpenAI
|
|
1708
|
+
* to monitor and detect abuse.
|
|
1709
|
+
*/
|
|
1710
|
+
user: import_v49.z.string().optional()
|
|
1711
|
+
});
|
|
1712
|
+
var openaiImageModelOptions = (0, import_provider_utils13.lazyValidator)(
|
|
1713
|
+
() => (0, import_provider_utils13.zodSchema)(baseImageModelOptionsObject)
|
|
1714
|
+
);
|
|
1715
|
+
var openaiImageModelGenerationOptions = (0, import_provider_utils13.lazyValidator)(
|
|
1716
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
1717
|
+
baseImageModelOptionsObject.extend({
|
|
1718
|
+
/**
|
|
1719
|
+
* Style of the generated image. `vivid` produces hyper-real and
|
|
1720
|
+
* dramatic images; `natural` produces more subdued, less hyper-real
|
|
1721
|
+
* looking images.
|
|
1722
|
+
*/
|
|
1723
|
+
style: import_v49.z.enum(["vivid", "natural"]).optional(),
|
|
1724
|
+
/**
|
|
1725
|
+
* Content moderation level for the generated image(s). `low` applies
|
|
1726
|
+
* less restrictive filtering.
|
|
1727
|
+
*/
|
|
1728
|
+
moderation: import_v49.z.enum(["auto", "low"]).optional()
|
|
1729
|
+
})
|
|
1730
|
+
)
|
|
1731
|
+
);
|
|
1681
1732
|
|
|
1682
1733
|
// src/image/openai-image-model.ts
|
|
1683
1734
|
var OpenAIImageModel = class {
|
|
@@ -1716,22 +1767,33 @@ var OpenAIImageModel = class {
|
|
|
1716
1767
|
warnings.push({ type: "unsupported-setting", setting: "seed" });
|
|
1717
1768
|
}
|
|
1718
1769
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1719
|
-
const
|
|
1770
|
+
const openaiOptions = (_d = await (0, import_provider_utils14.parseProviderOptions)({
|
|
1771
|
+
provider: "openai",
|
|
1772
|
+
providerOptions,
|
|
1773
|
+
schema: openaiImageModelGenerationOptions
|
|
1774
|
+
})) != null ? _d : {};
|
|
1775
|
+
const { value: response, responseHeaders } = await (0, import_provider_utils14.postJsonToApi)({
|
|
1720
1776
|
url: this.config.url({
|
|
1721
1777
|
path: "/images/generations",
|
|
1722
1778
|
modelId: this.modelId
|
|
1723
1779
|
}),
|
|
1724
|
-
headers: (0,
|
|
1780
|
+
headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), headers),
|
|
1725
1781
|
body: {
|
|
1726
1782
|
model: this.modelId,
|
|
1727
1783
|
prompt,
|
|
1728
1784
|
n,
|
|
1729
1785
|
size,
|
|
1730
|
-
|
|
1786
|
+
quality: openaiOptions.quality,
|
|
1787
|
+
style: openaiOptions.style,
|
|
1788
|
+
background: openaiOptions.background,
|
|
1789
|
+
moderation: openaiOptions.moderation,
|
|
1790
|
+
output_format: openaiOptions.outputFormat,
|
|
1791
|
+
output_compression: openaiOptions.outputCompression,
|
|
1792
|
+
user: openaiOptions.user,
|
|
1731
1793
|
...!hasDefaultResponseFormat.has(this.modelId) ? { response_format: "b64_json" } : {}
|
|
1732
1794
|
},
|
|
1733
1795
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
1734
|
-
successfulResponseHandler: (0,
|
|
1796
|
+
successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
|
|
1735
1797
|
openaiImageResponseSchema
|
|
1736
1798
|
),
|
|
1737
1799
|
abortSignal,
|
|
@@ -1795,41 +1857,41 @@ function distributeTokenDetails(usage, index, total) {
|
|
|
1795
1857
|
}
|
|
1796
1858
|
|
|
1797
1859
|
// src/tool/code-interpreter.ts
|
|
1798
|
-
var
|
|
1799
|
-
var
|
|
1800
|
-
var codeInterpreterInputSchema = (0,
|
|
1801
|
-
() => (0,
|
|
1802
|
-
|
|
1803
|
-
code:
|
|
1804
|
-
containerId:
|
|
1860
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
1861
|
+
var import_v410 = require("zod/v4");
|
|
1862
|
+
var codeInterpreterInputSchema = (0, import_provider_utils15.lazySchema)(
|
|
1863
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
1864
|
+
import_v410.z.object({
|
|
1865
|
+
code: import_v410.z.string().nullish(),
|
|
1866
|
+
containerId: import_v410.z.string()
|
|
1805
1867
|
})
|
|
1806
1868
|
)
|
|
1807
1869
|
);
|
|
1808
|
-
var codeInterpreterOutputSchema = (0,
|
|
1809
|
-
() => (0,
|
|
1810
|
-
|
|
1811
|
-
outputs:
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1870
|
+
var codeInterpreterOutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
1871
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
1872
|
+
import_v410.z.object({
|
|
1873
|
+
outputs: import_v410.z.array(
|
|
1874
|
+
import_v410.z.discriminatedUnion("type", [
|
|
1875
|
+
import_v410.z.object({ type: import_v410.z.literal("logs"), logs: import_v410.z.string() }),
|
|
1876
|
+
import_v410.z.object({ type: import_v410.z.literal("image"), url: import_v410.z.string() })
|
|
1815
1877
|
])
|
|
1816
1878
|
).nullish()
|
|
1817
1879
|
})
|
|
1818
1880
|
)
|
|
1819
1881
|
);
|
|
1820
|
-
var codeInterpreterArgsSchema = (0,
|
|
1821
|
-
() => (0,
|
|
1822
|
-
|
|
1823
|
-
container:
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
fileIds:
|
|
1882
|
+
var codeInterpreterArgsSchema = (0, import_provider_utils15.lazySchema)(
|
|
1883
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
1884
|
+
import_v410.z.object({
|
|
1885
|
+
container: import_v410.z.union([
|
|
1886
|
+
import_v410.z.string(),
|
|
1887
|
+
import_v410.z.object({
|
|
1888
|
+
fileIds: import_v410.z.array(import_v410.z.string()).optional()
|
|
1827
1889
|
})
|
|
1828
1890
|
]).optional()
|
|
1829
1891
|
})
|
|
1830
1892
|
)
|
|
1831
1893
|
);
|
|
1832
|
-
var codeInterpreterToolFactory = (0,
|
|
1894
|
+
var codeInterpreterToolFactory = (0, import_provider_utils15.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1833
1895
|
id: "openai.code_interpreter",
|
|
1834
1896
|
name: "code_interpreter",
|
|
1835
1897
|
inputSchema: codeInterpreterInputSchema,
|
|
@@ -1840,82 +1902,82 @@ var codeInterpreter = (args = {}) => {
|
|
|
1840
1902
|
};
|
|
1841
1903
|
|
|
1842
1904
|
// src/tool/file-search.ts
|
|
1843
|
-
var
|
|
1844
|
-
var
|
|
1845
|
-
var comparisonFilterSchema =
|
|
1846
|
-
key:
|
|
1847
|
-
type:
|
|
1848
|
-
value:
|
|
1905
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
1906
|
+
var import_v411 = require("zod/v4");
|
|
1907
|
+
var comparisonFilterSchema = import_v411.z.object({
|
|
1908
|
+
key: import_v411.z.string(),
|
|
1909
|
+
type: import_v411.z.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
1910
|
+
value: import_v411.z.union([import_v411.z.string(), import_v411.z.number(), import_v411.z.boolean(), import_v411.z.array(import_v411.z.string())])
|
|
1849
1911
|
});
|
|
1850
|
-
var compoundFilterSchema =
|
|
1851
|
-
type:
|
|
1852
|
-
filters:
|
|
1853
|
-
|
|
1912
|
+
var compoundFilterSchema = import_v411.z.object({
|
|
1913
|
+
type: import_v411.z.enum(["and", "or"]),
|
|
1914
|
+
filters: import_v411.z.array(
|
|
1915
|
+
import_v411.z.union([comparisonFilterSchema, import_v411.z.lazy(() => compoundFilterSchema)])
|
|
1854
1916
|
)
|
|
1855
1917
|
});
|
|
1856
|
-
var fileSearchArgsSchema = (0,
|
|
1857
|
-
() => (0,
|
|
1858
|
-
|
|
1859
|
-
vectorStoreIds:
|
|
1860
|
-
maxNumResults:
|
|
1861
|
-
ranking:
|
|
1862
|
-
ranker:
|
|
1863
|
-
scoreThreshold:
|
|
1918
|
+
var fileSearchArgsSchema = (0, import_provider_utils16.lazySchema)(
|
|
1919
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
1920
|
+
import_v411.z.object({
|
|
1921
|
+
vectorStoreIds: import_v411.z.array(import_v411.z.string()),
|
|
1922
|
+
maxNumResults: import_v411.z.number().optional(),
|
|
1923
|
+
ranking: import_v411.z.object({
|
|
1924
|
+
ranker: import_v411.z.string().optional(),
|
|
1925
|
+
scoreThreshold: import_v411.z.number().optional()
|
|
1864
1926
|
}).optional(),
|
|
1865
|
-
filters:
|
|
1927
|
+
filters: import_v411.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
1866
1928
|
})
|
|
1867
1929
|
)
|
|
1868
1930
|
);
|
|
1869
|
-
var fileSearchOutputSchema = (0,
|
|
1870
|
-
() => (0,
|
|
1871
|
-
|
|
1872
|
-
queries:
|
|
1873
|
-
results:
|
|
1874
|
-
|
|
1875
|
-
attributes:
|
|
1876
|
-
fileId:
|
|
1877
|
-
filename:
|
|
1878
|
-
score:
|
|
1879
|
-
text:
|
|
1931
|
+
var fileSearchOutputSchema = (0, import_provider_utils16.lazySchema)(
|
|
1932
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
1933
|
+
import_v411.z.object({
|
|
1934
|
+
queries: import_v411.z.array(import_v411.z.string()),
|
|
1935
|
+
results: import_v411.z.array(
|
|
1936
|
+
import_v411.z.object({
|
|
1937
|
+
attributes: import_v411.z.record(import_v411.z.string(), import_v411.z.unknown()),
|
|
1938
|
+
fileId: import_v411.z.string(),
|
|
1939
|
+
filename: import_v411.z.string(),
|
|
1940
|
+
score: import_v411.z.number(),
|
|
1941
|
+
text: import_v411.z.string()
|
|
1880
1942
|
})
|
|
1881
1943
|
).nullable()
|
|
1882
1944
|
})
|
|
1883
1945
|
)
|
|
1884
1946
|
);
|
|
1885
|
-
var fileSearch = (0,
|
|
1947
|
+
var fileSearch = (0, import_provider_utils16.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1886
1948
|
id: "openai.file_search",
|
|
1887
1949
|
name: "file_search",
|
|
1888
|
-
inputSchema:
|
|
1950
|
+
inputSchema: import_v411.z.object({}),
|
|
1889
1951
|
outputSchema: fileSearchOutputSchema
|
|
1890
1952
|
});
|
|
1891
1953
|
|
|
1892
1954
|
// src/tool/image-generation.ts
|
|
1893
|
-
var
|
|
1894
|
-
var
|
|
1895
|
-
var imageGenerationArgsSchema = (0,
|
|
1896
|
-
() => (0,
|
|
1897
|
-
|
|
1898
|
-
background:
|
|
1899
|
-
inputFidelity:
|
|
1900
|
-
inputImageMask:
|
|
1901
|
-
fileId:
|
|
1902
|
-
imageUrl:
|
|
1955
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
1956
|
+
var import_v412 = require("zod/v4");
|
|
1957
|
+
var imageGenerationArgsSchema = (0, import_provider_utils17.lazySchema)(
|
|
1958
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
1959
|
+
import_v412.z.object({
|
|
1960
|
+
background: import_v412.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
1961
|
+
inputFidelity: import_v412.z.enum(["low", "high"]).optional(),
|
|
1962
|
+
inputImageMask: import_v412.z.object({
|
|
1963
|
+
fileId: import_v412.z.string().optional(),
|
|
1964
|
+
imageUrl: import_v412.z.string().optional()
|
|
1903
1965
|
}).optional(),
|
|
1904
|
-
model:
|
|
1905
|
-
moderation:
|
|
1906
|
-
outputCompression:
|
|
1907
|
-
outputFormat:
|
|
1908
|
-
partialImages:
|
|
1909
|
-
quality:
|
|
1910
|
-
size:
|
|
1966
|
+
model: import_v412.z.string().optional(),
|
|
1967
|
+
moderation: import_v412.z.enum(["auto"]).optional(),
|
|
1968
|
+
outputCompression: import_v412.z.number().int().min(0).max(100).optional(),
|
|
1969
|
+
outputFormat: import_v412.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
1970
|
+
partialImages: import_v412.z.number().int().min(0).max(3).optional(),
|
|
1971
|
+
quality: import_v412.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
1972
|
+
size: import_v412.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
1911
1973
|
}).strict()
|
|
1912
1974
|
)
|
|
1913
1975
|
);
|
|
1914
|
-
var imageGenerationInputSchema = (0,
|
|
1915
|
-
var imageGenerationOutputSchema = (0,
|
|
1916
|
-
() => (0,
|
|
1976
|
+
var imageGenerationInputSchema = (0, import_provider_utils17.lazySchema)(() => (0, import_provider_utils17.zodSchema)(import_v412.z.object({})));
|
|
1977
|
+
var imageGenerationOutputSchema = (0, import_provider_utils17.lazySchema)(
|
|
1978
|
+
() => (0, import_provider_utils17.zodSchema)(import_v412.z.object({ result: import_v412.z.string() }))
|
|
1917
1979
|
);
|
|
1918
|
-
var imageGenerationToolFactory = (0,
|
|
1980
|
+
var imageGenerationToolFactory = (0, import_provider_utils17.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1919
1981
|
id: "openai.image_generation",
|
|
1920
1982
|
name: "image_generation",
|
|
1921
1983
|
inputSchema: imageGenerationInputSchema,
|
|
@@ -1926,26 +1988,26 @@ var imageGeneration = (args = {}) => {
|
|
|
1926
1988
|
};
|
|
1927
1989
|
|
|
1928
1990
|
// src/tool/local-shell.ts
|
|
1929
|
-
var
|
|
1930
|
-
var
|
|
1931
|
-
var localShellInputSchema = (0,
|
|
1932
|
-
() => (0,
|
|
1933
|
-
|
|
1934
|
-
action:
|
|
1935
|
-
type:
|
|
1936
|
-
command:
|
|
1937
|
-
timeoutMs:
|
|
1938
|
-
user:
|
|
1939
|
-
workingDirectory:
|
|
1940
|
-
env:
|
|
1991
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
1992
|
+
var import_v413 = require("zod/v4");
|
|
1993
|
+
var localShellInputSchema = (0, import_provider_utils18.lazySchema)(
|
|
1994
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
1995
|
+
import_v413.z.object({
|
|
1996
|
+
action: import_v413.z.object({
|
|
1997
|
+
type: import_v413.z.literal("exec"),
|
|
1998
|
+
command: import_v413.z.array(import_v413.z.string()),
|
|
1999
|
+
timeoutMs: import_v413.z.number().optional(),
|
|
2000
|
+
user: import_v413.z.string().optional(),
|
|
2001
|
+
workingDirectory: import_v413.z.string().optional(),
|
|
2002
|
+
env: import_v413.z.record(import_v413.z.string(), import_v413.z.string()).optional()
|
|
1941
2003
|
})
|
|
1942
2004
|
})
|
|
1943
2005
|
)
|
|
1944
2006
|
);
|
|
1945
|
-
var localShellOutputSchema = (0,
|
|
1946
|
-
() => (0,
|
|
2007
|
+
var localShellOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
2008
|
+
() => (0, import_provider_utils18.zodSchema)(import_v413.z.object({ output: import_v413.z.string() }))
|
|
1947
2009
|
);
|
|
1948
|
-
var localShell = (0,
|
|
2010
|
+
var localShell = (0, import_provider_utils18.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
1949
2011
|
id: "openai.local_shell",
|
|
1950
2012
|
name: "local_shell",
|
|
1951
2013
|
inputSchema: localShellInputSchema,
|
|
@@ -1953,66 +2015,13 @@ var localShell = (0, import_provider_utils17.createProviderDefinedToolFactoryWit
|
|
|
1953
2015
|
});
|
|
1954
2016
|
|
|
1955
2017
|
// src/tool/web-search.ts
|
|
1956
|
-
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
1957
|
-
var import_v413 = require("zod/v4");
|
|
1958
|
-
var webSearchArgsSchema = (0, import_provider_utils18.lazySchema)(
|
|
1959
|
-
() => (0, import_provider_utils18.zodSchema)(
|
|
1960
|
-
import_v413.z.object({
|
|
1961
|
-
externalWebAccess: import_v413.z.boolean().optional(),
|
|
1962
|
-
filters: import_v413.z.object({ allowedDomains: import_v413.z.array(import_v413.z.string()).optional() }).optional(),
|
|
1963
|
-
searchContextSize: import_v413.z.enum(["low", "medium", "high"]).optional(),
|
|
1964
|
-
userLocation: import_v413.z.object({
|
|
1965
|
-
type: import_v413.z.literal("approximate"),
|
|
1966
|
-
country: import_v413.z.string().optional(),
|
|
1967
|
-
city: import_v413.z.string().optional(),
|
|
1968
|
-
region: import_v413.z.string().optional(),
|
|
1969
|
-
timezone: import_v413.z.string().optional()
|
|
1970
|
-
}).optional()
|
|
1971
|
-
})
|
|
1972
|
-
)
|
|
1973
|
-
);
|
|
1974
|
-
var webSearchInputSchema = (0, import_provider_utils18.lazySchema)(() => (0, import_provider_utils18.zodSchema)(import_v413.z.object({})));
|
|
1975
|
-
var webSearchOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
1976
|
-
() => (0, import_provider_utils18.zodSchema)(
|
|
1977
|
-
import_v413.z.object({
|
|
1978
|
-
action: import_v413.z.discriminatedUnion("type", [
|
|
1979
|
-
import_v413.z.object({
|
|
1980
|
-
type: import_v413.z.literal("search"),
|
|
1981
|
-
query: import_v413.z.string().optional()
|
|
1982
|
-
}),
|
|
1983
|
-
import_v413.z.object({
|
|
1984
|
-
type: import_v413.z.literal("openPage"),
|
|
1985
|
-
url: import_v413.z.string().nullish()
|
|
1986
|
-
}),
|
|
1987
|
-
import_v413.z.object({
|
|
1988
|
-
type: import_v413.z.literal("findInPage"),
|
|
1989
|
-
url: import_v413.z.string().nullish(),
|
|
1990
|
-
pattern: import_v413.z.string().nullish()
|
|
1991
|
-
})
|
|
1992
|
-
]).optional(),
|
|
1993
|
-
sources: import_v413.z.array(
|
|
1994
|
-
import_v413.z.discriminatedUnion("type", [
|
|
1995
|
-
import_v413.z.object({ type: import_v413.z.literal("url"), url: import_v413.z.string() }),
|
|
1996
|
-
import_v413.z.object({ type: import_v413.z.literal("api"), name: import_v413.z.string() })
|
|
1997
|
-
])
|
|
1998
|
-
).optional()
|
|
1999
|
-
})
|
|
2000
|
-
)
|
|
2001
|
-
);
|
|
2002
|
-
var webSearchToolFactory = (0, import_provider_utils18.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2003
|
-
id: "openai.web_search",
|
|
2004
|
-
name: "web_search",
|
|
2005
|
-
inputSchema: webSearchInputSchema,
|
|
2006
|
-
outputSchema: webSearchOutputSchema
|
|
2007
|
-
});
|
|
2008
|
-
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2009
|
-
|
|
2010
|
-
// src/tool/web-search-preview.ts
|
|
2011
2018
|
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
2012
2019
|
var import_v414 = require("zod/v4");
|
|
2013
|
-
var
|
|
2020
|
+
var webSearchArgsSchema = (0, import_provider_utils19.lazySchema)(
|
|
2014
2021
|
() => (0, import_provider_utils19.zodSchema)(
|
|
2015
2022
|
import_v414.z.object({
|
|
2023
|
+
externalWebAccess: import_v414.z.boolean().optional(),
|
|
2024
|
+
filters: import_v414.z.object({ allowedDomains: import_v414.z.array(import_v414.z.string()).optional() }).optional(),
|
|
2016
2025
|
searchContextSize: import_v414.z.enum(["low", "medium", "high"]).optional(),
|
|
2017
2026
|
userLocation: import_v414.z.object({
|
|
2018
2027
|
type: import_v414.z.literal("approximate"),
|
|
@@ -2024,10 +2033,8 @@ var webSearchPreviewArgsSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
2024
2033
|
})
|
|
2025
2034
|
)
|
|
2026
2035
|
);
|
|
2027
|
-
var
|
|
2028
|
-
|
|
2029
|
-
);
|
|
2030
|
-
var webSearchPreviewOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
2036
|
+
var webSearchInputSchema = (0, import_provider_utils19.lazySchema)(() => (0, import_provider_utils19.zodSchema)(import_v414.z.object({})));
|
|
2037
|
+
var webSearchOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
2031
2038
|
() => (0, import_provider_utils19.zodSchema)(
|
|
2032
2039
|
import_v414.z.object({
|
|
2033
2040
|
action: import_v414.z.discriminatedUnion("type", [
|
|
@@ -2044,11 +2051,66 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
2044
2051
|
url: import_v414.z.string().nullish(),
|
|
2045
2052
|
pattern: import_v414.z.string().nullish()
|
|
2046
2053
|
})
|
|
2054
|
+
]).optional(),
|
|
2055
|
+
sources: import_v414.z.array(
|
|
2056
|
+
import_v414.z.discriminatedUnion("type", [
|
|
2057
|
+
import_v414.z.object({ type: import_v414.z.literal("url"), url: import_v414.z.string() }),
|
|
2058
|
+
import_v414.z.object({ type: import_v414.z.literal("api"), name: import_v414.z.string() })
|
|
2059
|
+
])
|
|
2060
|
+
).optional()
|
|
2061
|
+
})
|
|
2062
|
+
)
|
|
2063
|
+
);
|
|
2064
|
+
var webSearchToolFactory = (0, import_provider_utils19.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2065
|
+
id: "openai.web_search",
|
|
2066
|
+
name: "web_search",
|
|
2067
|
+
inputSchema: webSearchInputSchema,
|
|
2068
|
+
outputSchema: webSearchOutputSchema
|
|
2069
|
+
});
|
|
2070
|
+
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2071
|
+
|
|
2072
|
+
// src/tool/web-search-preview.ts
|
|
2073
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2074
|
+
var import_v415 = require("zod/v4");
|
|
2075
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils20.lazySchema)(
|
|
2076
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2077
|
+
import_v415.z.object({
|
|
2078
|
+
searchContextSize: import_v415.z.enum(["low", "medium", "high"]).optional(),
|
|
2079
|
+
userLocation: import_v415.z.object({
|
|
2080
|
+
type: import_v415.z.literal("approximate"),
|
|
2081
|
+
country: import_v415.z.string().optional(),
|
|
2082
|
+
city: import_v415.z.string().optional(),
|
|
2083
|
+
region: import_v415.z.string().optional(),
|
|
2084
|
+
timezone: import_v415.z.string().optional()
|
|
2085
|
+
}).optional()
|
|
2086
|
+
})
|
|
2087
|
+
)
|
|
2088
|
+
);
|
|
2089
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2090
|
+
() => (0, import_provider_utils20.zodSchema)(import_v415.z.object({}))
|
|
2091
|
+
);
|
|
2092
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2093
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2094
|
+
import_v415.z.object({
|
|
2095
|
+
action: import_v415.z.discriminatedUnion("type", [
|
|
2096
|
+
import_v415.z.object({
|
|
2097
|
+
type: import_v415.z.literal("search"),
|
|
2098
|
+
query: import_v415.z.string().optional()
|
|
2099
|
+
}),
|
|
2100
|
+
import_v415.z.object({
|
|
2101
|
+
type: import_v415.z.literal("openPage"),
|
|
2102
|
+
url: import_v415.z.string().nullish()
|
|
2103
|
+
}),
|
|
2104
|
+
import_v415.z.object({
|
|
2105
|
+
type: import_v415.z.literal("findInPage"),
|
|
2106
|
+
url: import_v415.z.string().nullish(),
|
|
2107
|
+
pattern: import_v415.z.string().nullish()
|
|
2108
|
+
})
|
|
2047
2109
|
]).optional()
|
|
2048
2110
|
})
|
|
2049
2111
|
)
|
|
2050
2112
|
);
|
|
2051
|
-
var webSearchPreview = (0,
|
|
2113
|
+
var webSearchPreview = (0, import_provider_utils20.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2052
2114
|
id: "openai.web_search_preview",
|
|
2053
2115
|
name: "web_search_preview",
|
|
2054
2116
|
inputSchema: webSearchPreviewInputSchema,
|
|
@@ -2130,12 +2192,12 @@ var openaiTools = {
|
|
|
2130
2192
|
|
|
2131
2193
|
// src/responses/openai-responses-language-model.ts
|
|
2132
2194
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2133
|
-
var
|
|
2195
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
2134
2196
|
|
|
2135
2197
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2136
2198
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2137
|
-
var
|
|
2138
|
-
var
|
|
2199
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2200
|
+
var import_v416 = require("zod/v4");
|
|
2139
2201
|
function isFileId(data, prefixes) {
|
|
2140
2202
|
if (!prefixes) return false;
|
|
2141
2203
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2193,7 +2255,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2193
2255
|
return {
|
|
2194
2256
|
type: "input_image",
|
|
2195
2257
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2196
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2258
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
|
|
2197
2259
|
},
|
|
2198
2260
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
|
|
2199
2261
|
};
|
|
@@ -2208,7 +2270,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2208
2270
|
type: "input_file",
|
|
2209
2271
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2210
2272
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2211
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2273
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
|
|
2212
2274
|
}
|
|
2213
2275
|
};
|
|
2214
2276
|
} else {
|
|
@@ -2253,7 +2315,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2253
2315
|
break;
|
|
2254
2316
|
}
|
|
2255
2317
|
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2256
|
-
const parsedInput = await (0,
|
|
2318
|
+
const parsedInput = await (0, import_provider_utils21.validateTypes)({
|
|
2257
2319
|
value: part.input,
|
|
2258
2320
|
schema: localShellInputSchema
|
|
2259
2321
|
});
|
|
@@ -2294,7 +2356,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2294
2356
|
break;
|
|
2295
2357
|
}
|
|
2296
2358
|
case "reasoning": {
|
|
2297
|
-
const providerOptions = await (0,
|
|
2359
|
+
const providerOptions = await (0, import_provider_utils21.parseProviderOptions)({
|
|
2298
2360
|
provider: "openai",
|
|
2299
2361
|
providerOptions: part.providerOptions,
|
|
2300
2362
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2355,7 +2417,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2355
2417
|
for (const part of content) {
|
|
2356
2418
|
const output = part.output;
|
|
2357
2419
|
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2358
|
-
const parsedOutput = await (0,
|
|
2420
|
+
const parsedOutput = await (0, import_provider_utils21.validateTypes)({
|
|
2359
2421
|
value: output.value,
|
|
2360
2422
|
schema: localShellOutputSchema
|
|
2361
2423
|
});
|
|
@@ -2423,9 +2485,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2423
2485
|
}
|
|
2424
2486
|
return { input, warnings };
|
|
2425
2487
|
}
|
|
2426
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2427
|
-
itemId:
|
|
2428
|
-
reasoningEncryptedContent:
|
|
2488
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v416.z.object({
|
|
2489
|
+
itemId: import_v416.z.string().nullish(),
|
|
2490
|
+
reasoningEncryptedContent: import_v416.z.string().nullish()
|
|
2429
2491
|
});
|
|
2430
2492
|
|
|
2431
2493
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2447,275 +2509,275 @@ function mapOpenAIResponseFinishReason({
|
|
|
2447
2509
|
}
|
|
2448
2510
|
|
|
2449
2511
|
// src/responses/openai-responses-api.ts
|
|
2450
|
-
var
|
|
2451
|
-
var
|
|
2452
|
-
var openaiResponsesChunkSchema = (0,
|
|
2453
|
-
() => (0,
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
type:
|
|
2457
|
-
item_id:
|
|
2458
|
-
delta:
|
|
2459
|
-
logprobs:
|
|
2460
|
-
|
|
2461
|
-
token:
|
|
2462
|
-
logprob:
|
|
2463
|
-
top_logprobs:
|
|
2464
|
-
|
|
2465
|
-
token:
|
|
2466
|
-
logprob:
|
|
2512
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2513
|
+
var import_v417 = require("zod/v4");
|
|
2514
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils22.lazyValidator)(
|
|
2515
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2516
|
+
import_v417.z.union([
|
|
2517
|
+
import_v417.z.object({
|
|
2518
|
+
type: import_v417.z.literal("response.output_text.delta"),
|
|
2519
|
+
item_id: import_v417.z.string(),
|
|
2520
|
+
delta: import_v417.z.string(),
|
|
2521
|
+
logprobs: import_v417.z.array(
|
|
2522
|
+
import_v417.z.object({
|
|
2523
|
+
token: import_v417.z.string(),
|
|
2524
|
+
logprob: import_v417.z.number(),
|
|
2525
|
+
top_logprobs: import_v417.z.array(
|
|
2526
|
+
import_v417.z.object({
|
|
2527
|
+
token: import_v417.z.string(),
|
|
2528
|
+
logprob: import_v417.z.number()
|
|
2467
2529
|
})
|
|
2468
2530
|
)
|
|
2469
2531
|
})
|
|
2470
2532
|
).nullish()
|
|
2471
2533
|
}),
|
|
2472
|
-
|
|
2473
|
-
type:
|
|
2474
|
-
response:
|
|
2475
|
-
incomplete_details:
|
|
2476
|
-
usage:
|
|
2477
|
-
input_tokens:
|
|
2478
|
-
input_tokens_details:
|
|
2479
|
-
output_tokens:
|
|
2480
|
-
output_tokens_details:
|
|
2534
|
+
import_v417.z.object({
|
|
2535
|
+
type: import_v417.z.enum(["response.completed", "response.incomplete"]),
|
|
2536
|
+
response: import_v417.z.object({
|
|
2537
|
+
incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
|
|
2538
|
+
usage: import_v417.z.object({
|
|
2539
|
+
input_tokens: import_v417.z.number(),
|
|
2540
|
+
input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
|
|
2541
|
+
output_tokens: import_v417.z.number(),
|
|
2542
|
+
output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
|
|
2481
2543
|
}),
|
|
2482
|
-
service_tier:
|
|
2544
|
+
service_tier: import_v417.z.string().nullish()
|
|
2483
2545
|
})
|
|
2484
2546
|
}),
|
|
2485
|
-
|
|
2486
|
-
type:
|
|
2487
|
-
response:
|
|
2488
|
-
id:
|
|
2489
|
-
created_at:
|
|
2490
|
-
model:
|
|
2491
|
-
service_tier:
|
|
2547
|
+
import_v417.z.object({
|
|
2548
|
+
type: import_v417.z.literal("response.created"),
|
|
2549
|
+
response: import_v417.z.object({
|
|
2550
|
+
id: import_v417.z.string(),
|
|
2551
|
+
created_at: import_v417.z.number(),
|
|
2552
|
+
model: import_v417.z.string(),
|
|
2553
|
+
service_tier: import_v417.z.string().nullish()
|
|
2492
2554
|
})
|
|
2493
2555
|
}),
|
|
2494
|
-
|
|
2495
|
-
type:
|
|
2496
|
-
output_index:
|
|
2497
|
-
item:
|
|
2498
|
-
|
|
2499
|
-
type:
|
|
2500
|
-
id:
|
|
2501
|
-
phase:
|
|
2556
|
+
import_v417.z.object({
|
|
2557
|
+
type: import_v417.z.literal("response.output_item.added"),
|
|
2558
|
+
output_index: import_v417.z.number(),
|
|
2559
|
+
item: import_v417.z.discriminatedUnion("type", [
|
|
2560
|
+
import_v417.z.object({
|
|
2561
|
+
type: import_v417.z.literal("message"),
|
|
2562
|
+
id: import_v417.z.string(),
|
|
2563
|
+
phase: import_v417.z.enum(["commentary", "final_answer"]).nullish()
|
|
2502
2564
|
}),
|
|
2503
|
-
|
|
2504
|
-
type:
|
|
2505
|
-
id:
|
|
2506
|
-
encrypted_content:
|
|
2565
|
+
import_v417.z.object({
|
|
2566
|
+
type: import_v417.z.literal("reasoning"),
|
|
2567
|
+
id: import_v417.z.string(),
|
|
2568
|
+
encrypted_content: import_v417.z.string().nullish()
|
|
2507
2569
|
}),
|
|
2508
|
-
|
|
2509
|
-
type:
|
|
2510
|
-
id:
|
|
2511
|
-
call_id:
|
|
2512
|
-
name:
|
|
2513
|
-
arguments:
|
|
2570
|
+
import_v417.z.object({
|
|
2571
|
+
type: import_v417.z.literal("function_call"),
|
|
2572
|
+
id: import_v417.z.string(),
|
|
2573
|
+
call_id: import_v417.z.string(),
|
|
2574
|
+
name: import_v417.z.string(),
|
|
2575
|
+
arguments: import_v417.z.string()
|
|
2514
2576
|
}),
|
|
2515
|
-
|
|
2516
|
-
type:
|
|
2517
|
-
id:
|
|
2518
|
-
status:
|
|
2577
|
+
import_v417.z.object({
|
|
2578
|
+
type: import_v417.z.literal("web_search_call"),
|
|
2579
|
+
id: import_v417.z.string(),
|
|
2580
|
+
status: import_v417.z.string()
|
|
2519
2581
|
}),
|
|
2520
|
-
|
|
2521
|
-
type:
|
|
2522
|
-
id:
|
|
2523
|
-
status:
|
|
2582
|
+
import_v417.z.object({
|
|
2583
|
+
type: import_v417.z.literal("computer_call"),
|
|
2584
|
+
id: import_v417.z.string(),
|
|
2585
|
+
status: import_v417.z.string()
|
|
2524
2586
|
}),
|
|
2525
|
-
|
|
2526
|
-
type:
|
|
2527
|
-
id:
|
|
2587
|
+
import_v417.z.object({
|
|
2588
|
+
type: import_v417.z.literal("file_search_call"),
|
|
2589
|
+
id: import_v417.z.string()
|
|
2528
2590
|
}),
|
|
2529
|
-
|
|
2530
|
-
type:
|
|
2531
|
-
id:
|
|
2591
|
+
import_v417.z.object({
|
|
2592
|
+
type: import_v417.z.literal("image_generation_call"),
|
|
2593
|
+
id: import_v417.z.string()
|
|
2532
2594
|
}),
|
|
2533
|
-
|
|
2534
|
-
type:
|
|
2535
|
-
id:
|
|
2536
|
-
container_id:
|
|
2537
|
-
code:
|
|
2538
|
-
outputs:
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2595
|
+
import_v417.z.object({
|
|
2596
|
+
type: import_v417.z.literal("code_interpreter_call"),
|
|
2597
|
+
id: import_v417.z.string(),
|
|
2598
|
+
container_id: import_v417.z.string(),
|
|
2599
|
+
code: import_v417.z.string().nullable(),
|
|
2600
|
+
outputs: import_v417.z.array(
|
|
2601
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2602
|
+
import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
|
|
2603
|
+
import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
|
|
2542
2604
|
])
|
|
2543
2605
|
).nullable(),
|
|
2544
|
-
status:
|
|
2606
|
+
status: import_v417.z.string()
|
|
2545
2607
|
})
|
|
2546
2608
|
])
|
|
2547
2609
|
}),
|
|
2548
|
-
|
|
2549
|
-
type:
|
|
2550
|
-
output_index:
|
|
2551
|
-
item:
|
|
2552
|
-
|
|
2553
|
-
type:
|
|
2554
|
-
id:
|
|
2555
|
-
phase:
|
|
2610
|
+
import_v417.z.object({
|
|
2611
|
+
type: import_v417.z.literal("response.output_item.done"),
|
|
2612
|
+
output_index: import_v417.z.number(),
|
|
2613
|
+
item: import_v417.z.discriminatedUnion("type", [
|
|
2614
|
+
import_v417.z.object({
|
|
2615
|
+
type: import_v417.z.literal("message"),
|
|
2616
|
+
id: import_v417.z.string(),
|
|
2617
|
+
phase: import_v417.z.enum(["commentary", "final_answer"]).nullish()
|
|
2556
2618
|
}),
|
|
2557
|
-
|
|
2558
|
-
type:
|
|
2559
|
-
id:
|
|
2560
|
-
encrypted_content:
|
|
2619
|
+
import_v417.z.object({
|
|
2620
|
+
type: import_v417.z.literal("reasoning"),
|
|
2621
|
+
id: import_v417.z.string(),
|
|
2622
|
+
encrypted_content: import_v417.z.string().nullish()
|
|
2561
2623
|
}),
|
|
2562
|
-
|
|
2563
|
-
type:
|
|
2564
|
-
id:
|
|
2565
|
-
call_id:
|
|
2566
|
-
name:
|
|
2567
|
-
arguments:
|
|
2568
|
-
status:
|
|
2624
|
+
import_v417.z.object({
|
|
2625
|
+
type: import_v417.z.literal("function_call"),
|
|
2626
|
+
id: import_v417.z.string(),
|
|
2627
|
+
call_id: import_v417.z.string(),
|
|
2628
|
+
name: import_v417.z.string(),
|
|
2629
|
+
arguments: import_v417.z.string(),
|
|
2630
|
+
status: import_v417.z.literal("completed")
|
|
2569
2631
|
}),
|
|
2570
|
-
|
|
2571
|
-
type:
|
|
2572
|
-
id:
|
|
2573
|
-
code:
|
|
2574
|
-
container_id:
|
|
2575
|
-
outputs:
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2632
|
+
import_v417.z.object({
|
|
2633
|
+
type: import_v417.z.literal("code_interpreter_call"),
|
|
2634
|
+
id: import_v417.z.string(),
|
|
2635
|
+
code: import_v417.z.string().nullable(),
|
|
2636
|
+
container_id: import_v417.z.string(),
|
|
2637
|
+
outputs: import_v417.z.array(
|
|
2638
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2639
|
+
import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
|
|
2640
|
+
import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
|
|
2579
2641
|
])
|
|
2580
2642
|
).nullable()
|
|
2581
2643
|
}),
|
|
2582
|
-
|
|
2583
|
-
type:
|
|
2584
|
-
id:
|
|
2585
|
-
result:
|
|
2644
|
+
import_v417.z.object({
|
|
2645
|
+
type: import_v417.z.literal("image_generation_call"),
|
|
2646
|
+
id: import_v417.z.string(),
|
|
2647
|
+
result: import_v417.z.string()
|
|
2586
2648
|
}),
|
|
2587
|
-
|
|
2588
|
-
type:
|
|
2589
|
-
id:
|
|
2590
|
-
status:
|
|
2591
|
-
action:
|
|
2592
|
-
|
|
2593
|
-
type:
|
|
2594
|
-
query:
|
|
2595
|
-
sources:
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2649
|
+
import_v417.z.object({
|
|
2650
|
+
type: import_v417.z.literal("web_search_call"),
|
|
2651
|
+
id: import_v417.z.string(),
|
|
2652
|
+
status: import_v417.z.string(),
|
|
2653
|
+
action: import_v417.z.discriminatedUnion("type", [
|
|
2654
|
+
import_v417.z.object({
|
|
2655
|
+
type: import_v417.z.literal("search"),
|
|
2656
|
+
query: import_v417.z.string().nullish(),
|
|
2657
|
+
sources: import_v417.z.array(
|
|
2658
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2659
|
+
import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
|
|
2660
|
+
import_v417.z.object({ type: import_v417.z.literal("api"), name: import_v417.z.string() })
|
|
2599
2661
|
])
|
|
2600
2662
|
).nullish()
|
|
2601
2663
|
}),
|
|
2602
|
-
|
|
2603
|
-
type:
|
|
2604
|
-
url:
|
|
2664
|
+
import_v417.z.object({
|
|
2665
|
+
type: import_v417.z.literal("open_page"),
|
|
2666
|
+
url: import_v417.z.string().nullish()
|
|
2605
2667
|
}),
|
|
2606
|
-
|
|
2607
|
-
type:
|
|
2608
|
-
url:
|
|
2609
|
-
pattern:
|
|
2668
|
+
import_v417.z.object({
|
|
2669
|
+
type: import_v417.z.literal("find_in_page"),
|
|
2670
|
+
url: import_v417.z.string().nullish(),
|
|
2671
|
+
pattern: import_v417.z.string().nullish()
|
|
2610
2672
|
})
|
|
2611
2673
|
]).nullish()
|
|
2612
2674
|
}),
|
|
2613
|
-
|
|
2614
|
-
type:
|
|
2615
|
-
id:
|
|
2616
|
-
queries:
|
|
2617
|
-
results:
|
|
2618
|
-
|
|
2619
|
-
attributes:
|
|
2620
|
-
file_id:
|
|
2621
|
-
filename:
|
|
2622
|
-
score:
|
|
2623
|
-
text:
|
|
2675
|
+
import_v417.z.object({
|
|
2676
|
+
type: import_v417.z.literal("file_search_call"),
|
|
2677
|
+
id: import_v417.z.string(),
|
|
2678
|
+
queries: import_v417.z.array(import_v417.z.string()),
|
|
2679
|
+
results: import_v417.z.array(
|
|
2680
|
+
import_v417.z.object({
|
|
2681
|
+
attributes: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()),
|
|
2682
|
+
file_id: import_v417.z.string(),
|
|
2683
|
+
filename: import_v417.z.string(),
|
|
2684
|
+
score: import_v417.z.number(),
|
|
2685
|
+
text: import_v417.z.string()
|
|
2624
2686
|
})
|
|
2625
2687
|
).nullish()
|
|
2626
2688
|
}),
|
|
2627
|
-
|
|
2628
|
-
type:
|
|
2629
|
-
id:
|
|
2630
|
-
call_id:
|
|
2631
|
-
action:
|
|
2632
|
-
type:
|
|
2633
|
-
command:
|
|
2634
|
-
timeout_ms:
|
|
2635
|
-
user:
|
|
2636
|
-
working_directory:
|
|
2637
|
-
env:
|
|
2689
|
+
import_v417.z.object({
|
|
2690
|
+
type: import_v417.z.literal("local_shell_call"),
|
|
2691
|
+
id: import_v417.z.string(),
|
|
2692
|
+
call_id: import_v417.z.string(),
|
|
2693
|
+
action: import_v417.z.object({
|
|
2694
|
+
type: import_v417.z.literal("exec"),
|
|
2695
|
+
command: import_v417.z.array(import_v417.z.string()),
|
|
2696
|
+
timeout_ms: import_v417.z.number().optional(),
|
|
2697
|
+
user: import_v417.z.string().optional(),
|
|
2698
|
+
working_directory: import_v417.z.string().optional(),
|
|
2699
|
+
env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
|
|
2638
2700
|
})
|
|
2639
2701
|
}),
|
|
2640
|
-
|
|
2641
|
-
type:
|
|
2642
|
-
id:
|
|
2643
|
-
status:
|
|
2702
|
+
import_v417.z.object({
|
|
2703
|
+
type: import_v417.z.literal("computer_call"),
|
|
2704
|
+
id: import_v417.z.string(),
|
|
2705
|
+
status: import_v417.z.literal("completed")
|
|
2644
2706
|
})
|
|
2645
2707
|
])
|
|
2646
2708
|
}),
|
|
2647
|
-
|
|
2648
|
-
type:
|
|
2649
|
-
item_id:
|
|
2650
|
-
output_index:
|
|
2651
|
-
delta:
|
|
2709
|
+
import_v417.z.object({
|
|
2710
|
+
type: import_v417.z.literal("response.function_call_arguments.delta"),
|
|
2711
|
+
item_id: import_v417.z.string(),
|
|
2712
|
+
output_index: import_v417.z.number(),
|
|
2713
|
+
delta: import_v417.z.string()
|
|
2652
2714
|
}),
|
|
2653
|
-
|
|
2654
|
-
type:
|
|
2655
|
-
item_id:
|
|
2656
|
-
output_index:
|
|
2657
|
-
partial_image_b64:
|
|
2715
|
+
import_v417.z.object({
|
|
2716
|
+
type: import_v417.z.literal("response.image_generation_call.partial_image"),
|
|
2717
|
+
item_id: import_v417.z.string(),
|
|
2718
|
+
output_index: import_v417.z.number(),
|
|
2719
|
+
partial_image_b64: import_v417.z.string()
|
|
2658
2720
|
}),
|
|
2659
|
-
|
|
2660
|
-
type:
|
|
2661
|
-
item_id:
|
|
2662
|
-
output_index:
|
|
2663
|
-
delta:
|
|
2721
|
+
import_v417.z.object({
|
|
2722
|
+
type: import_v417.z.literal("response.code_interpreter_call_code.delta"),
|
|
2723
|
+
item_id: import_v417.z.string(),
|
|
2724
|
+
output_index: import_v417.z.number(),
|
|
2725
|
+
delta: import_v417.z.string()
|
|
2664
2726
|
}),
|
|
2665
|
-
|
|
2666
|
-
type:
|
|
2667
|
-
item_id:
|
|
2668
|
-
output_index:
|
|
2669
|
-
code:
|
|
2727
|
+
import_v417.z.object({
|
|
2728
|
+
type: import_v417.z.literal("response.code_interpreter_call_code.done"),
|
|
2729
|
+
item_id: import_v417.z.string(),
|
|
2730
|
+
output_index: import_v417.z.number(),
|
|
2731
|
+
code: import_v417.z.string()
|
|
2670
2732
|
}),
|
|
2671
|
-
|
|
2672
|
-
type:
|
|
2673
|
-
annotation:
|
|
2674
|
-
|
|
2675
|
-
type:
|
|
2676
|
-
start_index:
|
|
2677
|
-
end_index:
|
|
2678
|
-
url:
|
|
2679
|
-
title:
|
|
2733
|
+
import_v417.z.object({
|
|
2734
|
+
type: import_v417.z.literal("response.output_text.annotation.added"),
|
|
2735
|
+
annotation: import_v417.z.discriminatedUnion("type", [
|
|
2736
|
+
import_v417.z.object({
|
|
2737
|
+
type: import_v417.z.literal("url_citation"),
|
|
2738
|
+
start_index: import_v417.z.number(),
|
|
2739
|
+
end_index: import_v417.z.number(),
|
|
2740
|
+
url: import_v417.z.string(),
|
|
2741
|
+
title: import_v417.z.string()
|
|
2680
2742
|
}),
|
|
2681
|
-
|
|
2682
|
-
type:
|
|
2683
|
-
file_id:
|
|
2684
|
-
filename:
|
|
2685
|
-
index:
|
|
2686
|
-
start_index:
|
|
2687
|
-
end_index:
|
|
2688
|
-
quote:
|
|
2743
|
+
import_v417.z.object({
|
|
2744
|
+
type: import_v417.z.literal("file_citation"),
|
|
2745
|
+
file_id: import_v417.z.string(),
|
|
2746
|
+
filename: import_v417.z.string().nullish(),
|
|
2747
|
+
index: import_v417.z.number().nullish(),
|
|
2748
|
+
start_index: import_v417.z.number().nullish(),
|
|
2749
|
+
end_index: import_v417.z.number().nullish(),
|
|
2750
|
+
quote: import_v417.z.string().nullish()
|
|
2689
2751
|
})
|
|
2690
2752
|
])
|
|
2691
2753
|
}),
|
|
2692
|
-
|
|
2693
|
-
type:
|
|
2694
|
-
item_id:
|
|
2695
|
-
summary_index:
|
|
2754
|
+
import_v417.z.object({
|
|
2755
|
+
type: import_v417.z.literal("response.reasoning_summary_part.added"),
|
|
2756
|
+
item_id: import_v417.z.string(),
|
|
2757
|
+
summary_index: import_v417.z.number()
|
|
2696
2758
|
}),
|
|
2697
|
-
|
|
2698
|
-
type:
|
|
2699
|
-
item_id:
|
|
2700
|
-
summary_index:
|
|
2701
|
-
delta:
|
|
2759
|
+
import_v417.z.object({
|
|
2760
|
+
type: import_v417.z.literal("response.reasoning_summary_text.delta"),
|
|
2761
|
+
item_id: import_v417.z.string(),
|
|
2762
|
+
summary_index: import_v417.z.number(),
|
|
2763
|
+
delta: import_v417.z.string()
|
|
2702
2764
|
}),
|
|
2703
|
-
|
|
2704
|
-
type:
|
|
2705
|
-
item_id:
|
|
2706
|
-
summary_index:
|
|
2765
|
+
import_v417.z.object({
|
|
2766
|
+
type: import_v417.z.literal("response.reasoning_summary_part.done"),
|
|
2767
|
+
item_id: import_v417.z.string(),
|
|
2768
|
+
summary_index: import_v417.z.number()
|
|
2707
2769
|
}),
|
|
2708
|
-
|
|
2709
|
-
type:
|
|
2710
|
-
sequence_number:
|
|
2711
|
-
error:
|
|
2712
|
-
type:
|
|
2713
|
-
code:
|
|
2714
|
-
message:
|
|
2715
|
-
param:
|
|
2770
|
+
import_v417.z.object({
|
|
2771
|
+
type: import_v417.z.literal("error"),
|
|
2772
|
+
sequence_number: import_v417.z.number(),
|
|
2773
|
+
error: import_v417.z.object({
|
|
2774
|
+
type: import_v417.z.string(),
|
|
2775
|
+
code: import_v417.z.string(),
|
|
2776
|
+
message: import_v417.z.string(),
|
|
2777
|
+
param: import_v417.z.string().nullish()
|
|
2716
2778
|
})
|
|
2717
2779
|
}),
|
|
2718
|
-
|
|
2780
|
+
import_v417.z.object({ type: import_v417.z.string() }).loose().transform((value) => ({
|
|
2719
2781
|
type: "unknown_chunk",
|
|
2720
2782
|
message: value.type
|
|
2721
2783
|
}))
|
|
@@ -2723,194 +2785,194 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazyValidator)(
|
|
|
2723
2785
|
])
|
|
2724
2786
|
)
|
|
2725
2787
|
);
|
|
2726
|
-
var openaiResponsesResponseSchema = (0,
|
|
2727
|
-
() => (0,
|
|
2728
|
-
|
|
2729
|
-
id:
|
|
2730
|
-
created_at:
|
|
2731
|
-
error:
|
|
2732
|
-
message:
|
|
2733
|
-
type:
|
|
2734
|
-
param:
|
|
2735
|
-
code:
|
|
2788
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils22.lazyValidator)(
|
|
2789
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2790
|
+
import_v417.z.object({
|
|
2791
|
+
id: import_v417.z.string().optional(),
|
|
2792
|
+
created_at: import_v417.z.number().optional(),
|
|
2793
|
+
error: import_v417.z.object({
|
|
2794
|
+
message: import_v417.z.string(),
|
|
2795
|
+
type: import_v417.z.string(),
|
|
2796
|
+
param: import_v417.z.string().nullish(),
|
|
2797
|
+
code: import_v417.z.string()
|
|
2736
2798
|
}).nullish(),
|
|
2737
|
-
model:
|
|
2738
|
-
output:
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
type:
|
|
2742
|
-
role:
|
|
2743
|
-
id:
|
|
2744
|
-
phase:
|
|
2745
|
-
content:
|
|
2746
|
-
|
|
2747
|
-
type:
|
|
2748
|
-
text:
|
|
2749
|
-
logprobs:
|
|
2750
|
-
|
|
2751
|
-
token:
|
|
2752
|
-
logprob:
|
|
2753
|
-
top_logprobs:
|
|
2754
|
-
|
|
2755
|
-
token:
|
|
2756
|
-
logprob:
|
|
2799
|
+
model: import_v417.z.string().optional(),
|
|
2800
|
+
output: import_v417.z.array(
|
|
2801
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2802
|
+
import_v417.z.object({
|
|
2803
|
+
type: import_v417.z.literal("message"),
|
|
2804
|
+
role: import_v417.z.literal("assistant"),
|
|
2805
|
+
id: import_v417.z.string(),
|
|
2806
|
+
phase: import_v417.z.enum(["commentary", "final_answer"]).nullish(),
|
|
2807
|
+
content: import_v417.z.array(
|
|
2808
|
+
import_v417.z.object({
|
|
2809
|
+
type: import_v417.z.literal("output_text"),
|
|
2810
|
+
text: import_v417.z.string(),
|
|
2811
|
+
logprobs: import_v417.z.array(
|
|
2812
|
+
import_v417.z.object({
|
|
2813
|
+
token: import_v417.z.string(),
|
|
2814
|
+
logprob: import_v417.z.number(),
|
|
2815
|
+
top_logprobs: import_v417.z.array(
|
|
2816
|
+
import_v417.z.object({
|
|
2817
|
+
token: import_v417.z.string(),
|
|
2818
|
+
logprob: import_v417.z.number()
|
|
2757
2819
|
})
|
|
2758
2820
|
)
|
|
2759
2821
|
})
|
|
2760
2822
|
).nullish(),
|
|
2761
|
-
annotations:
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
type:
|
|
2765
|
-
start_index:
|
|
2766
|
-
end_index:
|
|
2767
|
-
url:
|
|
2768
|
-
title:
|
|
2823
|
+
annotations: import_v417.z.array(
|
|
2824
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2825
|
+
import_v417.z.object({
|
|
2826
|
+
type: import_v417.z.literal("url_citation"),
|
|
2827
|
+
start_index: import_v417.z.number(),
|
|
2828
|
+
end_index: import_v417.z.number(),
|
|
2829
|
+
url: import_v417.z.string(),
|
|
2830
|
+
title: import_v417.z.string()
|
|
2769
2831
|
}),
|
|
2770
|
-
|
|
2771
|
-
type:
|
|
2772
|
-
file_id:
|
|
2773
|
-
filename:
|
|
2774
|
-
index:
|
|
2775
|
-
start_index:
|
|
2776
|
-
end_index:
|
|
2777
|
-
quote:
|
|
2832
|
+
import_v417.z.object({
|
|
2833
|
+
type: import_v417.z.literal("file_citation"),
|
|
2834
|
+
file_id: import_v417.z.string(),
|
|
2835
|
+
filename: import_v417.z.string().nullish(),
|
|
2836
|
+
index: import_v417.z.number().nullish(),
|
|
2837
|
+
start_index: import_v417.z.number().nullish(),
|
|
2838
|
+
end_index: import_v417.z.number().nullish(),
|
|
2839
|
+
quote: import_v417.z.string().nullish()
|
|
2778
2840
|
}),
|
|
2779
|
-
|
|
2780
|
-
type:
|
|
2781
|
-
container_id:
|
|
2782
|
-
file_id:
|
|
2783
|
-
filename:
|
|
2784
|
-
start_index:
|
|
2785
|
-
end_index:
|
|
2786
|
-
index:
|
|
2841
|
+
import_v417.z.object({
|
|
2842
|
+
type: import_v417.z.literal("container_file_citation"),
|
|
2843
|
+
container_id: import_v417.z.string(),
|
|
2844
|
+
file_id: import_v417.z.string(),
|
|
2845
|
+
filename: import_v417.z.string().nullish(),
|
|
2846
|
+
start_index: import_v417.z.number().nullish(),
|
|
2847
|
+
end_index: import_v417.z.number().nullish(),
|
|
2848
|
+
index: import_v417.z.number().nullish()
|
|
2787
2849
|
}),
|
|
2788
|
-
|
|
2789
|
-
type:
|
|
2790
|
-
file_id:
|
|
2791
|
-
index:
|
|
2850
|
+
import_v417.z.object({
|
|
2851
|
+
type: import_v417.z.literal("file_path"),
|
|
2852
|
+
file_id: import_v417.z.string(),
|
|
2853
|
+
index: import_v417.z.number().nullish()
|
|
2792
2854
|
})
|
|
2793
2855
|
])
|
|
2794
2856
|
)
|
|
2795
2857
|
})
|
|
2796
2858
|
)
|
|
2797
2859
|
}),
|
|
2798
|
-
|
|
2799
|
-
type:
|
|
2800
|
-
id:
|
|
2801
|
-
status:
|
|
2802
|
-
action:
|
|
2803
|
-
|
|
2804
|
-
type:
|
|
2805
|
-
query:
|
|
2806
|
-
sources:
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
type:
|
|
2811
|
-
name:
|
|
2860
|
+
import_v417.z.object({
|
|
2861
|
+
type: import_v417.z.literal("web_search_call"),
|
|
2862
|
+
id: import_v417.z.string(),
|
|
2863
|
+
status: import_v417.z.string(),
|
|
2864
|
+
action: import_v417.z.discriminatedUnion("type", [
|
|
2865
|
+
import_v417.z.object({
|
|
2866
|
+
type: import_v417.z.literal("search"),
|
|
2867
|
+
query: import_v417.z.string().nullish(),
|
|
2868
|
+
sources: import_v417.z.array(
|
|
2869
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2870
|
+
import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
|
|
2871
|
+
import_v417.z.object({
|
|
2872
|
+
type: import_v417.z.literal("api"),
|
|
2873
|
+
name: import_v417.z.string()
|
|
2812
2874
|
})
|
|
2813
2875
|
])
|
|
2814
2876
|
).nullish()
|
|
2815
2877
|
}),
|
|
2816
|
-
|
|
2817
|
-
type:
|
|
2818
|
-
url:
|
|
2878
|
+
import_v417.z.object({
|
|
2879
|
+
type: import_v417.z.literal("open_page"),
|
|
2880
|
+
url: import_v417.z.string().nullish()
|
|
2819
2881
|
}),
|
|
2820
|
-
|
|
2821
|
-
type:
|
|
2822
|
-
url:
|
|
2823
|
-
pattern:
|
|
2882
|
+
import_v417.z.object({
|
|
2883
|
+
type: import_v417.z.literal("find_in_page"),
|
|
2884
|
+
url: import_v417.z.string().nullish(),
|
|
2885
|
+
pattern: import_v417.z.string().nullish()
|
|
2824
2886
|
})
|
|
2825
2887
|
]).nullish()
|
|
2826
2888
|
}),
|
|
2827
|
-
|
|
2828
|
-
type:
|
|
2829
|
-
id:
|
|
2830
|
-
queries:
|
|
2831
|
-
results:
|
|
2832
|
-
|
|
2833
|
-
attributes:
|
|
2834
|
-
|
|
2835
|
-
|
|
2889
|
+
import_v417.z.object({
|
|
2890
|
+
type: import_v417.z.literal("file_search_call"),
|
|
2891
|
+
id: import_v417.z.string(),
|
|
2892
|
+
queries: import_v417.z.array(import_v417.z.string()),
|
|
2893
|
+
results: import_v417.z.array(
|
|
2894
|
+
import_v417.z.object({
|
|
2895
|
+
attributes: import_v417.z.record(
|
|
2896
|
+
import_v417.z.string(),
|
|
2897
|
+
import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
|
|
2836
2898
|
),
|
|
2837
|
-
file_id:
|
|
2838
|
-
filename:
|
|
2839
|
-
score:
|
|
2840
|
-
text:
|
|
2899
|
+
file_id: import_v417.z.string(),
|
|
2900
|
+
filename: import_v417.z.string(),
|
|
2901
|
+
score: import_v417.z.number(),
|
|
2902
|
+
text: import_v417.z.string()
|
|
2841
2903
|
})
|
|
2842
2904
|
).nullish()
|
|
2843
2905
|
}),
|
|
2844
|
-
|
|
2845
|
-
type:
|
|
2846
|
-
id:
|
|
2847
|
-
code:
|
|
2848
|
-
container_id:
|
|
2849
|
-
outputs:
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2906
|
+
import_v417.z.object({
|
|
2907
|
+
type: import_v417.z.literal("code_interpreter_call"),
|
|
2908
|
+
id: import_v417.z.string(),
|
|
2909
|
+
code: import_v417.z.string().nullable(),
|
|
2910
|
+
container_id: import_v417.z.string(),
|
|
2911
|
+
outputs: import_v417.z.array(
|
|
2912
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2913
|
+
import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
|
|
2914
|
+
import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
|
|
2853
2915
|
])
|
|
2854
2916
|
).nullable()
|
|
2855
2917
|
}),
|
|
2856
|
-
|
|
2857
|
-
type:
|
|
2858
|
-
id:
|
|
2859
|
-
result:
|
|
2918
|
+
import_v417.z.object({
|
|
2919
|
+
type: import_v417.z.literal("image_generation_call"),
|
|
2920
|
+
id: import_v417.z.string(),
|
|
2921
|
+
result: import_v417.z.string()
|
|
2860
2922
|
}),
|
|
2861
|
-
|
|
2862
|
-
type:
|
|
2863
|
-
id:
|
|
2864
|
-
call_id:
|
|
2865
|
-
action:
|
|
2866
|
-
type:
|
|
2867
|
-
command:
|
|
2868
|
-
timeout_ms:
|
|
2869
|
-
user:
|
|
2870
|
-
working_directory:
|
|
2871
|
-
env:
|
|
2923
|
+
import_v417.z.object({
|
|
2924
|
+
type: import_v417.z.literal("local_shell_call"),
|
|
2925
|
+
id: import_v417.z.string(),
|
|
2926
|
+
call_id: import_v417.z.string(),
|
|
2927
|
+
action: import_v417.z.object({
|
|
2928
|
+
type: import_v417.z.literal("exec"),
|
|
2929
|
+
command: import_v417.z.array(import_v417.z.string()),
|
|
2930
|
+
timeout_ms: import_v417.z.number().optional(),
|
|
2931
|
+
user: import_v417.z.string().optional(),
|
|
2932
|
+
working_directory: import_v417.z.string().optional(),
|
|
2933
|
+
env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
|
|
2872
2934
|
})
|
|
2873
2935
|
}),
|
|
2874
|
-
|
|
2875
|
-
type:
|
|
2876
|
-
call_id:
|
|
2877
|
-
name:
|
|
2878
|
-
arguments:
|
|
2879
|
-
id:
|
|
2936
|
+
import_v417.z.object({
|
|
2937
|
+
type: import_v417.z.literal("function_call"),
|
|
2938
|
+
call_id: import_v417.z.string(),
|
|
2939
|
+
name: import_v417.z.string(),
|
|
2940
|
+
arguments: import_v417.z.string(),
|
|
2941
|
+
id: import_v417.z.string()
|
|
2880
2942
|
}),
|
|
2881
|
-
|
|
2882
|
-
type:
|
|
2883
|
-
id:
|
|
2884
|
-
status:
|
|
2943
|
+
import_v417.z.object({
|
|
2944
|
+
type: import_v417.z.literal("computer_call"),
|
|
2945
|
+
id: import_v417.z.string(),
|
|
2946
|
+
status: import_v417.z.string().optional()
|
|
2885
2947
|
}),
|
|
2886
|
-
|
|
2887
|
-
type:
|
|
2888
|
-
id:
|
|
2889
|
-
encrypted_content:
|
|
2890
|
-
summary:
|
|
2891
|
-
|
|
2892
|
-
type:
|
|
2893
|
-
text:
|
|
2948
|
+
import_v417.z.object({
|
|
2949
|
+
type: import_v417.z.literal("reasoning"),
|
|
2950
|
+
id: import_v417.z.string(),
|
|
2951
|
+
encrypted_content: import_v417.z.string().nullish(),
|
|
2952
|
+
summary: import_v417.z.array(
|
|
2953
|
+
import_v417.z.object({
|
|
2954
|
+
type: import_v417.z.literal("summary_text"),
|
|
2955
|
+
text: import_v417.z.string()
|
|
2894
2956
|
})
|
|
2895
2957
|
)
|
|
2896
2958
|
})
|
|
2897
2959
|
])
|
|
2898
2960
|
).optional(),
|
|
2899
|
-
service_tier:
|
|
2900
|
-
incomplete_details:
|
|
2901
|
-
usage:
|
|
2902
|
-
input_tokens:
|
|
2903
|
-
input_tokens_details:
|
|
2904
|
-
output_tokens:
|
|
2905
|
-
output_tokens_details:
|
|
2961
|
+
service_tier: import_v417.z.string().nullish(),
|
|
2962
|
+
incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
|
|
2963
|
+
usage: import_v417.z.object({
|
|
2964
|
+
input_tokens: import_v417.z.number(),
|
|
2965
|
+
input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
|
|
2966
|
+
output_tokens: import_v417.z.number(),
|
|
2967
|
+
output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
|
|
2906
2968
|
}).optional()
|
|
2907
2969
|
})
|
|
2908
2970
|
)
|
|
2909
2971
|
);
|
|
2910
2972
|
|
|
2911
2973
|
// src/responses/openai-responses-options.ts
|
|
2912
|
-
var
|
|
2913
|
-
var
|
|
2974
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2975
|
+
var import_v418 = require("zod/v4");
|
|
2914
2976
|
var TOP_LOGPROBS_MAX = 20;
|
|
2915
2977
|
var openaiResponsesReasoningModelIds = [
|
|
2916
2978
|
"o1",
|
|
@@ -2992,19 +3054,19 @@ var openaiResponsesModelIds = [
|
|
|
2992
3054
|
"gpt-5-chat-latest",
|
|
2993
3055
|
...openaiResponsesReasoningModelIds
|
|
2994
3056
|
];
|
|
2995
|
-
var openaiResponsesProviderOptionsSchema = (0,
|
|
2996
|
-
() => (0,
|
|
2997
|
-
|
|
2998
|
-
conversation:
|
|
2999
|
-
include:
|
|
3000
|
-
|
|
3057
|
+
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazyValidator)(
|
|
3058
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
3059
|
+
import_v418.z.object({
|
|
3060
|
+
conversation: import_v418.z.string().nullish(),
|
|
3061
|
+
include: import_v418.z.array(
|
|
3062
|
+
import_v418.z.enum([
|
|
3001
3063
|
"reasoning.encrypted_content",
|
|
3002
3064
|
// handled internally by default, only needed for unknown reasoning models
|
|
3003
3065
|
"file_search_call.results",
|
|
3004
3066
|
"message.output_text.logprobs"
|
|
3005
3067
|
])
|
|
3006
3068
|
).nullish(),
|
|
3007
|
-
instructions:
|
|
3069
|
+
instructions: import_v418.z.string().nullish(),
|
|
3008
3070
|
/**
|
|
3009
3071
|
* Return the log probabilities of the tokens.
|
|
3010
3072
|
*
|
|
@@ -3017,17 +3079,17 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazyValid
|
|
|
3017
3079
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3018
3080
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3019
3081
|
*/
|
|
3020
|
-
logprobs:
|
|
3082
|
+
logprobs: import_v418.z.union([import_v418.z.boolean(), import_v418.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3021
3083
|
/**
|
|
3022
3084
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3023
3085
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3024
3086
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3025
3087
|
*/
|
|
3026
|
-
maxToolCalls:
|
|
3027
|
-
metadata:
|
|
3028
|
-
parallelToolCalls:
|
|
3029
|
-
previousResponseId:
|
|
3030
|
-
promptCacheKey:
|
|
3088
|
+
maxToolCalls: import_v418.z.number().nullish(),
|
|
3089
|
+
metadata: import_v418.z.any().nullish(),
|
|
3090
|
+
parallelToolCalls: import_v418.z.boolean().nullish(),
|
|
3091
|
+
previousResponseId: import_v418.z.string().nullish(),
|
|
3092
|
+
promptCacheKey: import_v418.z.string().nullish(),
|
|
3031
3093
|
/**
|
|
3032
3094
|
* The retention policy for the prompt cache.
|
|
3033
3095
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -3036,7 +3098,7 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazyValid
|
|
|
3036
3098
|
*
|
|
3037
3099
|
* @default 'in_memory'
|
|
3038
3100
|
*/
|
|
3039
|
-
promptCacheRetention:
|
|
3101
|
+
promptCacheRetention: import_v418.z.enum(["in_memory", "24h"]).nullish(),
|
|
3040
3102
|
/**
|
|
3041
3103
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3042
3104
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -3047,22 +3109,22 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazyValid
|
|
|
3047
3109
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
3048
3110
|
* an error.
|
|
3049
3111
|
*/
|
|
3050
|
-
reasoningEffort:
|
|
3051
|
-
reasoningSummary:
|
|
3052
|
-
safetyIdentifier:
|
|
3053
|
-
serviceTier:
|
|
3054
|
-
store:
|
|
3055
|
-
strictJsonSchema:
|
|
3056
|
-
textVerbosity:
|
|
3057
|
-
truncation:
|
|
3058
|
-
user:
|
|
3112
|
+
reasoningEffort: import_v418.z.string().nullish(),
|
|
3113
|
+
reasoningSummary: import_v418.z.string().nullish(),
|
|
3114
|
+
safetyIdentifier: import_v418.z.string().nullish(),
|
|
3115
|
+
serviceTier: import_v418.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3116
|
+
store: import_v418.z.boolean().nullish(),
|
|
3117
|
+
strictJsonSchema: import_v418.z.boolean().nullish(),
|
|
3118
|
+
textVerbosity: import_v418.z.enum(["low", "medium", "high"]).nullish(),
|
|
3119
|
+
truncation: import_v418.z.enum(["auto", "disabled"]).nullish(),
|
|
3120
|
+
user: import_v418.z.string().nullish()
|
|
3059
3121
|
})
|
|
3060
3122
|
)
|
|
3061
3123
|
);
|
|
3062
3124
|
|
|
3063
3125
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3064
3126
|
var import_provider7 = require("@ai-sdk/provider");
|
|
3065
|
-
var
|
|
3127
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
3066
3128
|
async function prepareResponsesTools({
|
|
3067
3129
|
tools,
|
|
3068
3130
|
toolChoice,
|
|
@@ -3088,7 +3150,7 @@ async function prepareResponsesTools({
|
|
|
3088
3150
|
case "provider-defined": {
|
|
3089
3151
|
switch (tool.id) {
|
|
3090
3152
|
case "openai.file_search": {
|
|
3091
|
-
const args = await (0,
|
|
3153
|
+
const args = await (0, import_provider_utils24.validateTypes)({
|
|
3092
3154
|
value: tool.args,
|
|
3093
3155
|
schema: fileSearchArgsSchema
|
|
3094
3156
|
});
|
|
@@ -3111,7 +3173,7 @@ async function prepareResponsesTools({
|
|
|
3111
3173
|
break;
|
|
3112
3174
|
}
|
|
3113
3175
|
case "openai.web_search_preview": {
|
|
3114
|
-
const args = await (0,
|
|
3176
|
+
const args = await (0, import_provider_utils24.validateTypes)({
|
|
3115
3177
|
value: tool.args,
|
|
3116
3178
|
schema: webSearchPreviewArgsSchema
|
|
3117
3179
|
});
|
|
@@ -3123,7 +3185,7 @@ async function prepareResponsesTools({
|
|
|
3123
3185
|
break;
|
|
3124
3186
|
}
|
|
3125
3187
|
case "openai.web_search": {
|
|
3126
|
-
const args = await (0,
|
|
3188
|
+
const args = await (0, import_provider_utils24.validateTypes)({
|
|
3127
3189
|
value: tool.args,
|
|
3128
3190
|
schema: webSearchArgsSchema
|
|
3129
3191
|
});
|
|
@@ -3137,7 +3199,7 @@ async function prepareResponsesTools({
|
|
|
3137
3199
|
break;
|
|
3138
3200
|
}
|
|
3139
3201
|
case "openai.code_interpreter": {
|
|
3140
|
-
const args = await (0,
|
|
3202
|
+
const args = await (0, import_provider_utils24.validateTypes)({
|
|
3141
3203
|
value: tool.args,
|
|
3142
3204
|
schema: codeInterpreterArgsSchema
|
|
3143
3205
|
});
|
|
@@ -3148,7 +3210,7 @@ async function prepareResponsesTools({
|
|
|
3148
3210
|
break;
|
|
3149
3211
|
}
|
|
3150
3212
|
case "openai.image_generation": {
|
|
3151
|
-
const args = await (0,
|
|
3213
|
+
const args = await (0, import_provider_utils24.validateTypes)({
|
|
3152
3214
|
value: tool.args,
|
|
3153
3215
|
schema: imageGenerationArgsSchema
|
|
3154
3216
|
});
|
|
@@ -3254,7 +3316,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3254
3316
|
if (stopSequences != null) {
|
|
3255
3317
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
3256
3318
|
}
|
|
3257
|
-
const openaiOptions = await (0,
|
|
3319
|
+
const openaiOptions = await (0, import_provider_utils25.parseProviderOptions)({
|
|
3258
3320
|
provider: "openai",
|
|
3259
3321
|
providerOptions,
|
|
3260
3322
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -3442,12 +3504,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3442
3504
|
responseHeaders,
|
|
3443
3505
|
value: response,
|
|
3444
3506
|
rawValue: rawResponse
|
|
3445
|
-
} = await (0,
|
|
3507
|
+
} = await (0, import_provider_utils25.postJsonToApi)({
|
|
3446
3508
|
url,
|
|
3447
|
-
headers: (0,
|
|
3509
|
+
headers: (0, import_provider_utils25.combineHeaders)(this.config.headers(), options.headers),
|
|
3448
3510
|
body,
|
|
3449
3511
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3450
|
-
successfulResponseHandler: (0,
|
|
3512
|
+
successfulResponseHandler: (0, import_provider_utils25.createJsonResponseHandler)(
|
|
3451
3513
|
openaiResponsesResponseSchema
|
|
3452
3514
|
),
|
|
3453
3515
|
abortSignal: options.abortSignal,
|
|
@@ -3542,7 +3604,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3542
3604
|
content.push({
|
|
3543
3605
|
type: "source",
|
|
3544
3606
|
sourceType: "url",
|
|
3545
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
3607
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils25.generateId)(),
|
|
3546
3608
|
url: annotation.url,
|
|
3547
3609
|
title: annotation.title
|
|
3548
3610
|
});
|
|
@@ -3550,7 +3612,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3550
3612
|
content.push({
|
|
3551
3613
|
type: "source",
|
|
3552
3614
|
sourceType: "document",
|
|
3553
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
3615
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils25.generateId)(),
|
|
3554
3616
|
mediaType: "text/plain",
|
|
3555
3617
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
3556
3618
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
|
|
@@ -3566,7 +3628,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3566
3628
|
content.push({
|
|
3567
3629
|
type: "source",
|
|
3568
3630
|
sourceType: "document",
|
|
3569
|
-
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0,
|
|
3631
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils25.generateId)(),
|
|
3570
3632
|
mediaType: "text/plain",
|
|
3571
3633
|
title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
|
|
3572
3634
|
filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
|
|
@@ -3582,7 +3644,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3582
3644
|
content.push({
|
|
3583
3645
|
type: "source",
|
|
3584
3646
|
sourceType: "document",
|
|
3585
|
-
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0,
|
|
3647
|
+
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils25.generateId)(),
|
|
3586
3648
|
mediaType: "application/octet-stream",
|
|
3587
3649
|
title: annotation.file_id,
|
|
3588
3650
|
filename: annotation.file_id,
|
|
@@ -3744,18 +3806,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3744
3806
|
webSearchToolName,
|
|
3745
3807
|
store
|
|
3746
3808
|
} = await this.getArgs(options);
|
|
3747
|
-
const { responseHeaders, value: response } = await (0,
|
|
3809
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils25.postJsonToApi)({
|
|
3748
3810
|
url: this.config.url({
|
|
3749
3811
|
path: "/responses",
|
|
3750
3812
|
modelId: this.modelId
|
|
3751
3813
|
}),
|
|
3752
|
-
headers: (0,
|
|
3814
|
+
headers: (0, import_provider_utils25.combineHeaders)(this.config.headers(), options.headers),
|
|
3753
3815
|
body: {
|
|
3754
3816
|
...body,
|
|
3755
3817
|
stream: true
|
|
3756
3818
|
},
|
|
3757
3819
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3758
|
-
successfulResponseHandler: (0,
|
|
3820
|
+
successfulResponseHandler: (0, import_provider_utils25.createEventSourceResponseHandler)(
|
|
3759
3821
|
openaiResponsesChunkSchema
|
|
3760
3822
|
),
|
|
3761
3823
|
abortSignal: options.abortSignal,
|
|
@@ -4183,7 +4245,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4183
4245
|
controller.enqueue({
|
|
4184
4246
|
type: "source",
|
|
4185
4247
|
sourceType: "url",
|
|
4186
|
-
id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0,
|
|
4248
|
+
id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils25.generateId)(),
|
|
4187
4249
|
url: value.annotation.url,
|
|
4188
4250
|
title: value.annotation.title
|
|
4189
4251
|
});
|
|
@@ -4191,7 +4253,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4191
4253
|
controller.enqueue({
|
|
4192
4254
|
type: "source",
|
|
4193
4255
|
sourceType: "document",
|
|
4194
|
-
id: (_u = (_t = (_s = self.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0,
|
|
4256
|
+
id: (_u = (_t = (_s = self.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils25.generateId)(),
|
|
4195
4257
|
mediaType: "text/plain",
|
|
4196
4258
|
title: (_w = (_v = value.annotation.quote) != null ? _v : value.annotation.filename) != null ? _w : "Document",
|
|
4197
4259
|
filename: (_x = value.annotation.filename) != null ? _x : value.annotation.file_id,
|
|
@@ -4290,16 +4352,16 @@ function mapWebSearchOutput(action) {
|
|
|
4290
4352
|
}
|
|
4291
4353
|
|
|
4292
4354
|
// src/speech/openai-speech-model.ts
|
|
4293
|
-
var
|
|
4355
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
4294
4356
|
|
|
4295
4357
|
// src/speech/openai-speech-options.ts
|
|
4296
|
-
var
|
|
4297
|
-
var
|
|
4298
|
-
var openaiSpeechProviderOptionsSchema = (0,
|
|
4299
|
-
() => (0,
|
|
4300
|
-
|
|
4301
|
-
instructions:
|
|
4302
|
-
speed:
|
|
4358
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
4359
|
+
var import_v419 = require("zod/v4");
|
|
4360
|
+
var openaiSpeechProviderOptionsSchema = (0, import_provider_utils26.lazyValidator)(
|
|
4361
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
4362
|
+
import_v419.z.object({
|
|
4363
|
+
instructions: import_v419.z.string().nullish(),
|
|
4364
|
+
speed: import_v419.z.number().min(0.25).max(4).default(1).nullish()
|
|
4303
4365
|
})
|
|
4304
4366
|
)
|
|
4305
4367
|
);
|
|
@@ -4324,7 +4386,7 @@ var OpenAISpeechModel = class {
|
|
|
4324
4386
|
providerOptions
|
|
4325
4387
|
}) {
|
|
4326
4388
|
const warnings = [];
|
|
4327
|
-
const openAIOptions = await (0,
|
|
4389
|
+
const openAIOptions = await (0, import_provider_utils27.parseProviderOptions)({
|
|
4328
4390
|
provider: "openai",
|
|
4329
4391
|
providerOptions,
|
|
4330
4392
|
schema: openaiSpeechProviderOptionsSchema
|
|
@@ -4377,15 +4439,15 @@ var OpenAISpeechModel = class {
|
|
|
4377
4439
|
value: audio,
|
|
4378
4440
|
responseHeaders,
|
|
4379
4441
|
rawValue: rawResponse
|
|
4380
|
-
} = await (0,
|
|
4442
|
+
} = await (0, import_provider_utils27.postJsonToApi)({
|
|
4381
4443
|
url: this.config.url({
|
|
4382
4444
|
path: "/audio/speech",
|
|
4383
4445
|
modelId: this.modelId
|
|
4384
4446
|
}),
|
|
4385
|
-
headers: (0,
|
|
4447
|
+
headers: (0, import_provider_utils27.combineHeaders)(this.config.headers(), options.headers),
|
|
4386
4448
|
body: requestBody,
|
|
4387
4449
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4388
|
-
successfulResponseHandler: (0,
|
|
4450
|
+
successfulResponseHandler: (0, import_provider_utils27.createBinaryResponseHandler)(),
|
|
4389
4451
|
abortSignal: options.abortSignal,
|
|
4390
4452
|
fetch: this.config.fetch
|
|
4391
4453
|
});
|
|
@@ -4406,36 +4468,36 @@ var OpenAISpeechModel = class {
|
|
|
4406
4468
|
};
|
|
4407
4469
|
|
|
4408
4470
|
// src/transcription/openai-transcription-model.ts
|
|
4409
|
-
var
|
|
4471
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
4410
4472
|
|
|
4411
4473
|
// src/transcription/openai-transcription-api.ts
|
|
4412
|
-
var
|
|
4413
|
-
var
|
|
4414
|
-
var openaiTranscriptionResponseSchema = (0,
|
|
4415
|
-
() => (0,
|
|
4416
|
-
|
|
4417
|
-
text:
|
|
4418
|
-
language:
|
|
4419
|
-
duration:
|
|
4420
|
-
words:
|
|
4421
|
-
|
|
4422
|
-
word:
|
|
4423
|
-
start:
|
|
4424
|
-
end:
|
|
4474
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
4475
|
+
var import_v420 = require("zod/v4");
|
|
4476
|
+
var openaiTranscriptionResponseSchema = (0, import_provider_utils28.lazyValidator)(
|
|
4477
|
+
() => (0, import_provider_utils28.zodSchema)(
|
|
4478
|
+
import_v420.z.object({
|
|
4479
|
+
text: import_v420.z.string(),
|
|
4480
|
+
language: import_v420.z.string().nullish(),
|
|
4481
|
+
duration: import_v420.z.number().nullish(),
|
|
4482
|
+
words: import_v420.z.array(
|
|
4483
|
+
import_v420.z.object({
|
|
4484
|
+
word: import_v420.z.string(),
|
|
4485
|
+
start: import_v420.z.number(),
|
|
4486
|
+
end: import_v420.z.number()
|
|
4425
4487
|
})
|
|
4426
4488
|
).nullish(),
|
|
4427
|
-
segments:
|
|
4428
|
-
|
|
4429
|
-
id:
|
|
4430
|
-
seek:
|
|
4431
|
-
start:
|
|
4432
|
-
end:
|
|
4433
|
-
text:
|
|
4434
|
-
tokens:
|
|
4435
|
-
temperature:
|
|
4436
|
-
avg_logprob:
|
|
4437
|
-
compression_ratio:
|
|
4438
|
-
no_speech_prob:
|
|
4489
|
+
segments: import_v420.z.array(
|
|
4490
|
+
import_v420.z.object({
|
|
4491
|
+
id: import_v420.z.number(),
|
|
4492
|
+
seek: import_v420.z.number(),
|
|
4493
|
+
start: import_v420.z.number(),
|
|
4494
|
+
end: import_v420.z.number(),
|
|
4495
|
+
text: import_v420.z.string(),
|
|
4496
|
+
tokens: import_v420.z.array(import_v420.z.number()),
|
|
4497
|
+
temperature: import_v420.z.number(),
|
|
4498
|
+
avg_logprob: import_v420.z.number(),
|
|
4499
|
+
compression_ratio: import_v420.z.number(),
|
|
4500
|
+
no_speech_prob: import_v420.z.number()
|
|
4439
4501
|
})
|
|
4440
4502
|
).nullish()
|
|
4441
4503
|
})
|
|
@@ -4443,33 +4505,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils27.lazyValidato
|
|
|
4443
4505
|
);
|
|
4444
4506
|
|
|
4445
4507
|
// src/transcription/openai-transcription-options.ts
|
|
4446
|
-
var
|
|
4447
|
-
var
|
|
4448
|
-
var openAITranscriptionProviderOptions = (0,
|
|
4449
|
-
() => (0,
|
|
4450
|
-
|
|
4508
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
4509
|
+
var import_v421 = require("zod/v4");
|
|
4510
|
+
var openAITranscriptionProviderOptions = (0, import_provider_utils29.lazyValidator)(
|
|
4511
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
4512
|
+
import_v421.z.object({
|
|
4451
4513
|
/**
|
|
4452
4514
|
* Additional information to include in the transcription response.
|
|
4453
4515
|
*/
|
|
4454
|
-
include:
|
|
4516
|
+
include: import_v421.z.array(import_v421.z.string()).optional(),
|
|
4455
4517
|
/**
|
|
4456
4518
|
* The language of the input audio in ISO-639-1 format.
|
|
4457
4519
|
*/
|
|
4458
|
-
language:
|
|
4520
|
+
language: import_v421.z.string().optional(),
|
|
4459
4521
|
/**
|
|
4460
4522
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
4461
4523
|
*/
|
|
4462
|
-
prompt:
|
|
4524
|
+
prompt: import_v421.z.string().optional(),
|
|
4463
4525
|
/**
|
|
4464
4526
|
* The sampling temperature, between 0 and 1.
|
|
4465
4527
|
* @default 0
|
|
4466
4528
|
*/
|
|
4467
|
-
temperature:
|
|
4529
|
+
temperature: import_v421.z.number().min(0).max(1).default(0).optional(),
|
|
4468
4530
|
/**
|
|
4469
4531
|
* The timestamp granularities to populate for this transcription.
|
|
4470
4532
|
* @default ['segment']
|
|
4471
4533
|
*/
|
|
4472
|
-
timestampGranularities:
|
|
4534
|
+
timestampGranularities: import_v421.z.array(import_v421.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
4473
4535
|
})
|
|
4474
4536
|
)
|
|
4475
4537
|
);
|
|
@@ -4549,15 +4611,15 @@ var OpenAITranscriptionModel = class {
|
|
|
4549
4611
|
providerOptions
|
|
4550
4612
|
}) {
|
|
4551
4613
|
const warnings = [];
|
|
4552
|
-
const openAIOptions = await (0,
|
|
4614
|
+
const openAIOptions = await (0, import_provider_utils30.parseProviderOptions)({
|
|
4553
4615
|
provider: "openai",
|
|
4554
4616
|
providerOptions,
|
|
4555
4617
|
schema: openAITranscriptionProviderOptions
|
|
4556
4618
|
});
|
|
4557
4619
|
const formData = new FormData();
|
|
4558
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0,
|
|
4620
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils30.convertBase64ToUint8Array)(audio)]);
|
|
4559
4621
|
formData.append("model", this.modelId);
|
|
4560
|
-
const fileExtension = (0,
|
|
4622
|
+
const fileExtension = (0, import_provider_utils30.mediaTypeToExtension)(mediaType);
|
|
4561
4623
|
formData.append(
|
|
4562
4624
|
"file",
|
|
4563
4625
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -4602,15 +4664,15 @@ var OpenAITranscriptionModel = class {
|
|
|
4602
4664
|
value: response,
|
|
4603
4665
|
responseHeaders,
|
|
4604
4666
|
rawValue: rawResponse
|
|
4605
|
-
} = await (0,
|
|
4667
|
+
} = await (0, import_provider_utils30.postFormDataToApi)({
|
|
4606
4668
|
url: this.config.url({
|
|
4607
4669
|
path: "/audio/transcriptions",
|
|
4608
4670
|
modelId: this.modelId
|
|
4609
4671
|
}),
|
|
4610
|
-
headers: (0,
|
|
4672
|
+
headers: (0, import_provider_utils30.combineHeaders)(this.config.headers(), options.headers),
|
|
4611
4673
|
formData,
|
|
4612
4674
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4613
|
-
successfulResponseHandler: (0,
|
|
4675
|
+
successfulResponseHandler: (0, import_provider_utils30.createJsonResponseHandler)(
|
|
4614
4676
|
openaiTranscriptionResponseSchema
|
|
4615
4677
|
),
|
|
4616
4678
|
abortSignal: options.abortSignal,
|
|
@@ -4642,21 +4704,21 @@ var OpenAITranscriptionModel = class {
|
|
|
4642
4704
|
};
|
|
4643
4705
|
|
|
4644
4706
|
// src/version.ts
|
|
4645
|
-
var VERSION = true ? "2.0.
|
|
4707
|
+
var VERSION = true ? "2.0.106" : "0.0.0-test";
|
|
4646
4708
|
|
|
4647
4709
|
// src/openai-provider.ts
|
|
4648
4710
|
function createOpenAI(options = {}) {
|
|
4649
4711
|
var _a, _b;
|
|
4650
|
-
const baseURL = (_a = (0,
|
|
4651
|
-
(0,
|
|
4712
|
+
const baseURL = (_a = (0, import_provider_utils31.withoutTrailingSlash)(
|
|
4713
|
+
(0, import_provider_utils31.loadOptionalSetting)({
|
|
4652
4714
|
settingValue: options.baseURL,
|
|
4653
4715
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
4654
4716
|
})
|
|
4655
4717
|
)) != null ? _a : "https://api.openai.com/v1";
|
|
4656
4718
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
4657
|
-
const getHeaders = () => (0,
|
|
4719
|
+
const getHeaders = () => (0, import_provider_utils31.withUserAgentSuffix)(
|
|
4658
4720
|
{
|
|
4659
|
-
Authorization: `Bearer ${(0,
|
|
4721
|
+
Authorization: `Bearer ${(0, import_provider_utils31.loadApiKey)({
|
|
4660
4722
|
apiKey: options.apiKey,
|
|
4661
4723
|
environmentVariableName: "OPENAI_API_KEY",
|
|
4662
4724
|
description: "OpenAI"
|