@ai-sdk/openai 2.0.104 → 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 +15 -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 +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1656,6 +1656,7 @@ var OpenAIEmbeddingModel = class {
|
|
|
1656
1656
|
import {
|
|
1657
1657
|
combineHeaders as combineHeaders4,
|
|
1658
1658
|
createJsonResponseHandler as createJsonResponseHandler4,
|
|
1659
|
+
parseProviderOptions as parseProviderOptions4,
|
|
1659
1660
|
postJsonToApi as postJsonToApi4
|
|
1660
1661
|
} from "@ai-sdk/provider-utils";
|
|
1661
1662
|
|
|
@@ -1690,6 +1691,11 @@ var openaiImageResponseSchema = lazyValidator7(
|
|
|
1690
1691
|
);
|
|
1691
1692
|
|
|
1692
1693
|
// src/image/openai-image-options.ts
|
|
1694
|
+
import {
|
|
1695
|
+
lazyValidator as lazyValidator8,
|
|
1696
|
+
zodSchema as zodSchema8
|
|
1697
|
+
} from "@ai-sdk/provider-utils";
|
|
1698
|
+
import { z as z9 } from "zod/v4";
|
|
1693
1699
|
var modelMaxImagesPerCall = {
|
|
1694
1700
|
"dall-e-3": 1,
|
|
1695
1701
|
"dall-e-2": 10,
|
|
@@ -1704,6 +1710,55 @@ var hasDefaultResponseFormat = /* @__PURE__ */ new Set([
|
|
|
1704
1710
|
"gpt-image-1.5",
|
|
1705
1711
|
"gpt-image-2"
|
|
1706
1712
|
]);
|
|
1713
|
+
var baseImageModelOptionsObject = z9.object({
|
|
1714
|
+
/**
|
|
1715
|
+
* Quality of the generated image(s).
|
|
1716
|
+
*
|
|
1717
|
+
* Valid values: `standard`, `hd`, `low`, `medium`, `high`, `auto`.
|
|
1718
|
+
*/
|
|
1719
|
+
quality: z9.enum(["standard", "hd", "low", "medium", "high", "auto"]).optional(),
|
|
1720
|
+
/**
|
|
1721
|
+
* Background behavior for the generated image(s).
|
|
1722
|
+
*
|
|
1723
|
+
* If `transparent`, the output format must support transparency
|
|
1724
|
+
* (i.e. `png` or `webp`).
|
|
1725
|
+
*/
|
|
1726
|
+
background: z9.enum(["transparent", "opaque", "auto"]).optional(),
|
|
1727
|
+
/**
|
|
1728
|
+
* Format in which the generated image(s) are returned.
|
|
1729
|
+
*/
|
|
1730
|
+
outputFormat: z9.enum(["png", "jpeg", "webp"]).optional(),
|
|
1731
|
+
/**
|
|
1732
|
+
* Compression level (0-100) for the generated image(s). Applies to the
|
|
1733
|
+
* `jpeg` and `webp` output formats.
|
|
1734
|
+
*/
|
|
1735
|
+
outputCompression: z9.number().int().min(0).max(100).optional(),
|
|
1736
|
+
/**
|
|
1737
|
+
* A unique identifier representing your end-user, which can help OpenAI
|
|
1738
|
+
* to monitor and detect abuse.
|
|
1739
|
+
*/
|
|
1740
|
+
user: z9.string().optional()
|
|
1741
|
+
});
|
|
1742
|
+
var openaiImageModelOptions = lazyValidator8(
|
|
1743
|
+
() => zodSchema8(baseImageModelOptionsObject)
|
|
1744
|
+
);
|
|
1745
|
+
var openaiImageModelGenerationOptions = lazyValidator8(
|
|
1746
|
+
() => zodSchema8(
|
|
1747
|
+
baseImageModelOptionsObject.extend({
|
|
1748
|
+
/**
|
|
1749
|
+
* Style of the generated image. `vivid` produces hyper-real and
|
|
1750
|
+
* dramatic images; `natural` produces more subdued, less hyper-real
|
|
1751
|
+
* looking images.
|
|
1752
|
+
*/
|
|
1753
|
+
style: z9.enum(["vivid", "natural"]).optional(),
|
|
1754
|
+
/**
|
|
1755
|
+
* Content moderation level for the generated image(s). `low` applies
|
|
1756
|
+
* less restrictive filtering.
|
|
1757
|
+
*/
|
|
1758
|
+
moderation: z9.enum(["auto", "low"]).optional()
|
|
1759
|
+
})
|
|
1760
|
+
)
|
|
1761
|
+
);
|
|
1707
1762
|
|
|
1708
1763
|
// src/image/openai-image-model.ts
|
|
1709
1764
|
var OpenAIImageModel = class {
|
|
@@ -1742,6 +1797,11 @@ var OpenAIImageModel = class {
|
|
|
1742
1797
|
warnings.push({ type: "unsupported-setting", setting: "seed" });
|
|
1743
1798
|
}
|
|
1744
1799
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1800
|
+
const openaiOptions = (_d = await parseProviderOptions4({
|
|
1801
|
+
provider: "openai",
|
|
1802
|
+
providerOptions,
|
|
1803
|
+
schema: openaiImageModelGenerationOptions
|
|
1804
|
+
})) != null ? _d : {};
|
|
1745
1805
|
const { value: response, responseHeaders } = await postJsonToApi4({
|
|
1746
1806
|
url: this.config.url({
|
|
1747
1807
|
path: "/images/generations",
|
|
@@ -1753,7 +1813,13 @@ var OpenAIImageModel = class {
|
|
|
1753
1813
|
prompt,
|
|
1754
1814
|
n,
|
|
1755
1815
|
size,
|
|
1756
|
-
|
|
1816
|
+
quality: openaiOptions.quality,
|
|
1817
|
+
style: openaiOptions.style,
|
|
1818
|
+
background: openaiOptions.background,
|
|
1819
|
+
moderation: openaiOptions.moderation,
|
|
1820
|
+
output_format: openaiOptions.outputFormat,
|
|
1821
|
+
output_compression: openaiOptions.outputCompression,
|
|
1822
|
+
user: openaiOptions.user,
|
|
1757
1823
|
...!hasDefaultResponseFormat.has(this.modelId) ? { response_format: "b64_json" } : {}
|
|
1758
1824
|
},
|
|
1759
1825
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
@@ -1824,36 +1890,36 @@ function distributeTokenDetails(usage, index, total) {
|
|
|
1824
1890
|
import {
|
|
1825
1891
|
createProviderDefinedToolFactoryWithOutputSchema,
|
|
1826
1892
|
lazySchema,
|
|
1827
|
-
zodSchema as
|
|
1893
|
+
zodSchema as zodSchema9
|
|
1828
1894
|
} from "@ai-sdk/provider-utils";
|
|
1829
|
-
import { z as
|
|
1895
|
+
import { z as z10 } from "zod/v4";
|
|
1830
1896
|
var codeInterpreterInputSchema = lazySchema(
|
|
1831
|
-
() =>
|
|
1832
|
-
|
|
1833
|
-
code:
|
|
1834
|
-
containerId:
|
|
1897
|
+
() => zodSchema9(
|
|
1898
|
+
z10.object({
|
|
1899
|
+
code: z10.string().nullish(),
|
|
1900
|
+
containerId: z10.string()
|
|
1835
1901
|
})
|
|
1836
1902
|
)
|
|
1837
1903
|
);
|
|
1838
1904
|
var codeInterpreterOutputSchema = lazySchema(
|
|
1839
|
-
() =>
|
|
1840
|
-
|
|
1841
|
-
outputs:
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1905
|
+
() => zodSchema9(
|
|
1906
|
+
z10.object({
|
|
1907
|
+
outputs: z10.array(
|
|
1908
|
+
z10.discriminatedUnion("type", [
|
|
1909
|
+
z10.object({ type: z10.literal("logs"), logs: z10.string() }),
|
|
1910
|
+
z10.object({ type: z10.literal("image"), url: z10.string() })
|
|
1845
1911
|
])
|
|
1846
1912
|
).nullish()
|
|
1847
1913
|
})
|
|
1848
1914
|
)
|
|
1849
1915
|
);
|
|
1850
1916
|
var codeInterpreterArgsSchema = lazySchema(
|
|
1851
|
-
() =>
|
|
1852
|
-
|
|
1853
|
-
container:
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
fileIds:
|
|
1917
|
+
() => zodSchema9(
|
|
1918
|
+
z10.object({
|
|
1919
|
+
container: z10.union([
|
|
1920
|
+
z10.string(),
|
|
1921
|
+
z10.object({
|
|
1922
|
+
fileIds: z10.array(z10.string()).optional()
|
|
1857
1923
|
})
|
|
1858
1924
|
]).optional()
|
|
1859
1925
|
})
|
|
@@ -1873,44 +1939,44 @@ var codeInterpreter = (args = {}) => {
|
|
|
1873
1939
|
import {
|
|
1874
1940
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
|
|
1875
1941
|
lazySchema as lazySchema2,
|
|
1876
|
-
zodSchema as
|
|
1942
|
+
zodSchema as zodSchema10
|
|
1877
1943
|
} from "@ai-sdk/provider-utils";
|
|
1878
|
-
import { z as
|
|
1879
|
-
var comparisonFilterSchema =
|
|
1880
|
-
key:
|
|
1881
|
-
type:
|
|
1882
|
-
value:
|
|
1944
|
+
import { z as z11 } from "zod/v4";
|
|
1945
|
+
var comparisonFilterSchema = z11.object({
|
|
1946
|
+
key: z11.string(),
|
|
1947
|
+
type: z11.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
1948
|
+
value: z11.union([z11.string(), z11.number(), z11.boolean(), z11.array(z11.string())])
|
|
1883
1949
|
});
|
|
1884
|
-
var compoundFilterSchema =
|
|
1885
|
-
type:
|
|
1886
|
-
filters:
|
|
1887
|
-
|
|
1950
|
+
var compoundFilterSchema = z11.object({
|
|
1951
|
+
type: z11.enum(["and", "or"]),
|
|
1952
|
+
filters: z11.array(
|
|
1953
|
+
z11.union([comparisonFilterSchema, z11.lazy(() => compoundFilterSchema)])
|
|
1888
1954
|
)
|
|
1889
1955
|
});
|
|
1890
1956
|
var fileSearchArgsSchema = lazySchema2(
|
|
1891
|
-
() =>
|
|
1892
|
-
|
|
1893
|
-
vectorStoreIds:
|
|
1894
|
-
maxNumResults:
|
|
1895
|
-
ranking:
|
|
1896
|
-
ranker:
|
|
1897
|
-
scoreThreshold:
|
|
1957
|
+
() => zodSchema10(
|
|
1958
|
+
z11.object({
|
|
1959
|
+
vectorStoreIds: z11.array(z11.string()),
|
|
1960
|
+
maxNumResults: z11.number().optional(),
|
|
1961
|
+
ranking: z11.object({
|
|
1962
|
+
ranker: z11.string().optional(),
|
|
1963
|
+
scoreThreshold: z11.number().optional()
|
|
1898
1964
|
}).optional(),
|
|
1899
|
-
filters:
|
|
1965
|
+
filters: z11.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
1900
1966
|
})
|
|
1901
1967
|
)
|
|
1902
1968
|
);
|
|
1903
1969
|
var fileSearchOutputSchema = lazySchema2(
|
|
1904
|
-
() =>
|
|
1905
|
-
|
|
1906
|
-
queries:
|
|
1907
|
-
results:
|
|
1908
|
-
|
|
1909
|
-
attributes:
|
|
1910
|
-
fileId:
|
|
1911
|
-
filename:
|
|
1912
|
-
score:
|
|
1913
|
-
text:
|
|
1970
|
+
() => zodSchema10(
|
|
1971
|
+
z11.object({
|
|
1972
|
+
queries: z11.array(z11.string()),
|
|
1973
|
+
results: z11.array(
|
|
1974
|
+
z11.object({
|
|
1975
|
+
attributes: z11.record(z11.string(), z11.unknown()),
|
|
1976
|
+
fileId: z11.string(),
|
|
1977
|
+
filename: z11.string(),
|
|
1978
|
+
score: z11.number(),
|
|
1979
|
+
text: z11.string()
|
|
1914
1980
|
})
|
|
1915
1981
|
).nullable()
|
|
1916
1982
|
})
|
|
@@ -1919,7 +1985,7 @@ var fileSearchOutputSchema = lazySchema2(
|
|
|
1919
1985
|
var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
|
|
1920
1986
|
id: "openai.file_search",
|
|
1921
1987
|
name: "file_search",
|
|
1922
|
-
inputSchema:
|
|
1988
|
+
inputSchema: z11.object({}),
|
|
1923
1989
|
outputSchema: fileSearchOutputSchema
|
|
1924
1990
|
});
|
|
1925
1991
|
|
|
@@ -1927,31 +1993,31 @@ var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
|
|
|
1927
1993
|
import {
|
|
1928
1994
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
|
|
1929
1995
|
lazySchema as lazySchema3,
|
|
1930
|
-
zodSchema as
|
|
1996
|
+
zodSchema as zodSchema11
|
|
1931
1997
|
} from "@ai-sdk/provider-utils";
|
|
1932
|
-
import { z as
|
|
1998
|
+
import { z as z12 } from "zod/v4";
|
|
1933
1999
|
var imageGenerationArgsSchema = lazySchema3(
|
|
1934
|
-
() =>
|
|
1935
|
-
|
|
1936
|
-
background:
|
|
1937
|
-
inputFidelity:
|
|
1938
|
-
inputImageMask:
|
|
1939
|
-
fileId:
|
|
1940
|
-
imageUrl:
|
|
2000
|
+
() => zodSchema11(
|
|
2001
|
+
z12.object({
|
|
2002
|
+
background: z12.enum(["auto", "opaque", "transparent"]).optional(),
|
|
2003
|
+
inputFidelity: z12.enum(["low", "high"]).optional(),
|
|
2004
|
+
inputImageMask: z12.object({
|
|
2005
|
+
fileId: z12.string().optional(),
|
|
2006
|
+
imageUrl: z12.string().optional()
|
|
1941
2007
|
}).optional(),
|
|
1942
|
-
model:
|
|
1943
|
-
moderation:
|
|
1944
|
-
outputCompression:
|
|
1945
|
-
outputFormat:
|
|
1946
|
-
partialImages:
|
|
1947
|
-
quality:
|
|
1948
|
-
size:
|
|
2008
|
+
model: z12.string().optional(),
|
|
2009
|
+
moderation: z12.enum(["auto"]).optional(),
|
|
2010
|
+
outputCompression: z12.number().int().min(0).max(100).optional(),
|
|
2011
|
+
outputFormat: z12.enum(["png", "jpeg", "webp"]).optional(),
|
|
2012
|
+
partialImages: z12.number().int().min(0).max(3).optional(),
|
|
2013
|
+
quality: z12.enum(["auto", "low", "medium", "high"]).optional(),
|
|
2014
|
+
size: z12.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
1949
2015
|
}).strict()
|
|
1950
2016
|
)
|
|
1951
2017
|
);
|
|
1952
|
-
var imageGenerationInputSchema = lazySchema3(() =>
|
|
2018
|
+
var imageGenerationInputSchema = lazySchema3(() => zodSchema11(z12.object({})));
|
|
1953
2019
|
var imageGenerationOutputSchema = lazySchema3(
|
|
1954
|
-
() =>
|
|
2020
|
+
() => zodSchema11(z12.object({ result: z12.string() }))
|
|
1955
2021
|
);
|
|
1956
2022
|
var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
|
|
1957
2023
|
id: "openai.image_generation",
|
|
@@ -1967,25 +2033,25 @@ var imageGeneration = (args = {}) => {
|
|
|
1967
2033
|
import {
|
|
1968
2034
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
|
|
1969
2035
|
lazySchema as lazySchema4,
|
|
1970
|
-
zodSchema as
|
|
2036
|
+
zodSchema as zodSchema12
|
|
1971
2037
|
} from "@ai-sdk/provider-utils";
|
|
1972
|
-
import { z as
|
|
2038
|
+
import { z as z13 } from "zod/v4";
|
|
1973
2039
|
var localShellInputSchema = lazySchema4(
|
|
1974
|
-
() =>
|
|
1975
|
-
|
|
1976
|
-
action:
|
|
1977
|
-
type:
|
|
1978
|
-
command:
|
|
1979
|
-
timeoutMs:
|
|
1980
|
-
user:
|
|
1981
|
-
workingDirectory:
|
|
1982
|
-
env:
|
|
2040
|
+
() => zodSchema12(
|
|
2041
|
+
z13.object({
|
|
2042
|
+
action: z13.object({
|
|
2043
|
+
type: z13.literal("exec"),
|
|
2044
|
+
command: z13.array(z13.string()),
|
|
2045
|
+
timeoutMs: z13.number().optional(),
|
|
2046
|
+
user: z13.string().optional(),
|
|
2047
|
+
workingDirectory: z13.string().optional(),
|
|
2048
|
+
env: z13.record(z13.string(), z13.string()).optional()
|
|
1983
2049
|
})
|
|
1984
2050
|
})
|
|
1985
2051
|
)
|
|
1986
2052
|
);
|
|
1987
2053
|
var localShellOutputSchema = lazySchema4(
|
|
1988
|
-
() =>
|
|
2054
|
+
() => zodSchema12(z13.object({ output: z13.string() }))
|
|
1989
2055
|
);
|
|
1990
2056
|
var localShell = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
1991
2057
|
id: "openai.local_shell",
|
|
@@ -1998,48 +2064,48 @@ var localShell = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
|
1998
2064
|
import {
|
|
1999
2065
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema5,
|
|
2000
2066
|
lazySchema as lazySchema5,
|
|
2001
|
-
zodSchema as
|
|
2067
|
+
zodSchema as zodSchema13
|
|
2002
2068
|
} from "@ai-sdk/provider-utils";
|
|
2003
|
-
import { z as
|
|
2069
|
+
import { z as z14 } from "zod/v4";
|
|
2004
2070
|
var webSearchArgsSchema = lazySchema5(
|
|
2005
|
-
() =>
|
|
2006
|
-
|
|
2007
|
-
externalWebAccess:
|
|
2008
|
-
filters:
|
|
2009
|
-
searchContextSize:
|
|
2010
|
-
userLocation:
|
|
2011
|
-
type:
|
|
2012
|
-
country:
|
|
2013
|
-
city:
|
|
2014
|
-
region:
|
|
2015
|
-
timezone:
|
|
2071
|
+
() => zodSchema13(
|
|
2072
|
+
z14.object({
|
|
2073
|
+
externalWebAccess: z14.boolean().optional(),
|
|
2074
|
+
filters: z14.object({ allowedDomains: z14.array(z14.string()).optional() }).optional(),
|
|
2075
|
+
searchContextSize: z14.enum(["low", "medium", "high"]).optional(),
|
|
2076
|
+
userLocation: z14.object({
|
|
2077
|
+
type: z14.literal("approximate"),
|
|
2078
|
+
country: z14.string().optional(),
|
|
2079
|
+
city: z14.string().optional(),
|
|
2080
|
+
region: z14.string().optional(),
|
|
2081
|
+
timezone: z14.string().optional()
|
|
2016
2082
|
}).optional()
|
|
2017
2083
|
})
|
|
2018
2084
|
)
|
|
2019
2085
|
);
|
|
2020
|
-
var webSearchInputSchema = lazySchema5(() =>
|
|
2086
|
+
var webSearchInputSchema = lazySchema5(() => zodSchema13(z14.object({})));
|
|
2021
2087
|
var webSearchOutputSchema = lazySchema5(
|
|
2022
|
-
() =>
|
|
2023
|
-
|
|
2024
|
-
action:
|
|
2025
|
-
|
|
2026
|
-
type:
|
|
2027
|
-
query:
|
|
2088
|
+
() => zodSchema13(
|
|
2089
|
+
z14.object({
|
|
2090
|
+
action: z14.discriminatedUnion("type", [
|
|
2091
|
+
z14.object({
|
|
2092
|
+
type: z14.literal("search"),
|
|
2093
|
+
query: z14.string().optional()
|
|
2028
2094
|
}),
|
|
2029
|
-
|
|
2030
|
-
type:
|
|
2031
|
-
url:
|
|
2095
|
+
z14.object({
|
|
2096
|
+
type: z14.literal("openPage"),
|
|
2097
|
+
url: z14.string().nullish()
|
|
2032
2098
|
}),
|
|
2033
|
-
|
|
2034
|
-
type:
|
|
2035
|
-
url:
|
|
2036
|
-
pattern:
|
|
2099
|
+
z14.object({
|
|
2100
|
+
type: z14.literal("findInPage"),
|
|
2101
|
+
url: z14.string().nullish(),
|
|
2102
|
+
pattern: z14.string().nullish()
|
|
2037
2103
|
})
|
|
2038
2104
|
]).optional(),
|
|
2039
|
-
sources:
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2105
|
+
sources: z14.array(
|
|
2106
|
+
z14.discriminatedUnion("type", [
|
|
2107
|
+
z14.object({ type: z14.literal("url"), url: z14.string() }),
|
|
2108
|
+
z14.object({ type: z14.literal("api"), name: z14.string() })
|
|
2043
2109
|
])
|
|
2044
2110
|
).optional()
|
|
2045
2111
|
})
|
|
@@ -2057,42 +2123,42 @@ var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
|
2057
2123
|
import {
|
|
2058
2124
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema6,
|
|
2059
2125
|
lazySchema as lazySchema6,
|
|
2060
|
-
zodSchema as
|
|
2126
|
+
zodSchema as zodSchema14
|
|
2061
2127
|
} from "@ai-sdk/provider-utils";
|
|
2062
|
-
import { z as
|
|
2128
|
+
import { z as z15 } from "zod/v4";
|
|
2063
2129
|
var webSearchPreviewArgsSchema = lazySchema6(
|
|
2064
|
-
() =>
|
|
2065
|
-
|
|
2066
|
-
searchContextSize:
|
|
2067
|
-
userLocation:
|
|
2068
|
-
type:
|
|
2069
|
-
country:
|
|
2070
|
-
city:
|
|
2071
|
-
region:
|
|
2072
|
-
timezone:
|
|
2130
|
+
() => zodSchema14(
|
|
2131
|
+
z15.object({
|
|
2132
|
+
searchContextSize: z15.enum(["low", "medium", "high"]).optional(),
|
|
2133
|
+
userLocation: z15.object({
|
|
2134
|
+
type: z15.literal("approximate"),
|
|
2135
|
+
country: z15.string().optional(),
|
|
2136
|
+
city: z15.string().optional(),
|
|
2137
|
+
region: z15.string().optional(),
|
|
2138
|
+
timezone: z15.string().optional()
|
|
2073
2139
|
}).optional()
|
|
2074
2140
|
})
|
|
2075
2141
|
)
|
|
2076
2142
|
);
|
|
2077
2143
|
var webSearchPreviewInputSchema = lazySchema6(
|
|
2078
|
-
() =>
|
|
2144
|
+
() => zodSchema14(z15.object({}))
|
|
2079
2145
|
);
|
|
2080
2146
|
var webSearchPreviewOutputSchema = lazySchema6(
|
|
2081
|
-
() =>
|
|
2082
|
-
|
|
2083
|
-
action:
|
|
2084
|
-
|
|
2085
|
-
type:
|
|
2086
|
-
query:
|
|
2147
|
+
() => zodSchema14(
|
|
2148
|
+
z15.object({
|
|
2149
|
+
action: z15.discriminatedUnion("type", [
|
|
2150
|
+
z15.object({
|
|
2151
|
+
type: z15.literal("search"),
|
|
2152
|
+
query: z15.string().optional()
|
|
2087
2153
|
}),
|
|
2088
|
-
|
|
2089
|
-
type:
|
|
2090
|
-
url:
|
|
2154
|
+
z15.object({
|
|
2155
|
+
type: z15.literal("openPage"),
|
|
2156
|
+
url: z15.string().nullish()
|
|
2091
2157
|
}),
|
|
2092
|
-
|
|
2093
|
-
type:
|
|
2094
|
-
url:
|
|
2095
|
-
pattern:
|
|
2158
|
+
z15.object({
|
|
2159
|
+
type: z15.literal("findInPage"),
|
|
2160
|
+
url: z15.string().nullish(),
|
|
2161
|
+
pattern: z15.string().nullish()
|
|
2096
2162
|
})
|
|
2097
2163
|
]).optional()
|
|
2098
2164
|
})
|
|
@@ -2187,7 +2253,7 @@ import {
|
|
|
2187
2253
|
createEventSourceResponseHandler as createEventSourceResponseHandler3,
|
|
2188
2254
|
createJsonResponseHandler as createJsonResponseHandler5,
|
|
2189
2255
|
generateId as generateId2,
|
|
2190
|
-
parseProviderOptions as
|
|
2256
|
+
parseProviderOptions as parseProviderOptions6,
|
|
2191
2257
|
postJsonToApi as postJsonToApi5
|
|
2192
2258
|
} from "@ai-sdk/provider-utils";
|
|
2193
2259
|
|
|
@@ -2197,10 +2263,10 @@ import {
|
|
|
2197
2263
|
} from "@ai-sdk/provider";
|
|
2198
2264
|
import {
|
|
2199
2265
|
convertToBase64 as convertToBase642,
|
|
2200
|
-
parseProviderOptions as
|
|
2266
|
+
parseProviderOptions as parseProviderOptions5,
|
|
2201
2267
|
validateTypes
|
|
2202
2268
|
} from "@ai-sdk/provider-utils";
|
|
2203
|
-
import { z as
|
|
2269
|
+
import { z as z16 } from "zod/v4";
|
|
2204
2270
|
function isFileId(data, prefixes) {
|
|
2205
2271
|
if (!prefixes) return false;
|
|
2206
2272
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2359,7 +2425,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2359
2425
|
break;
|
|
2360
2426
|
}
|
|
2361
2427
|
case "reasoning": {
|
|
2362
|
-
const providerOptions = await
|
|
2428
|
+
const providerOptions = await parseProviderOptions5({
|
|
2363
2429
|
provider: "openai",
|
|
2364
2430
|
providerOptions: part.providerOptions,
|
|
2365
2431
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2488,9 +2554,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2488
2554
|
}
|
|
2489
2555
|
return { input, warnings };
|
|
2490
2556
|
}
|
|
2491
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2492
|
-
itemId:
|
|
2493
|
-
reasoningEncryptedContent:
|
|
2557
|
+
var openaiResponsesReasoningProviderOptionsSchema = z16.object({
|
|
2558
|
+
itemId: z16.string().nullish(),
|
|
2559
|
+
reasoningEncryptedContent: z16.string().nullish()
|
|
2494
2560
|
});
|
|
2495
2561
|
|
|
2496
2562
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2513,277 +2579,277 @@ function mapOpenAIResponseFinishReason({
|
|
|
2513
2579
|
|
|
2514
2580
|
// src/responses/openai-responses-api.ts
|
|
2515
2581
|
import {
|
|
2516
|
-
lazyValidator as
|
|
2517
|
-
zodSchema as
|
|
2582
|
+
lazyValidator as lazyValidator9,
|
|
2583
|
+
zodSchema as zodSchema15
|
|
2518
2584
|
} from "@ai-sdk/provider-utils";
|
|
2519
|
-
import { z as
|
|
2520
|
-
var openaiResponsesChunkSchema =
|
|
2521
|
-
() =>
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
type:
|
|
2525
|
-
item_id:
|
|
2526
|
-
delta:
|
|
2527
|
-
logprobs:
|
|
2528
|
-
|
|
2529
|
-
token:
|
|
2530
|
-
logprob:
|
|
2531
|
-
top_logprobs:
|
|
2532
|
-
|
|
2533
|
-
token:
|
|
2534
|
-
logprob:
|
|
2585
|
+
import { z as z17 } from "zod/v4";
|
|
2586
|
+
var openaiResponsesChunkSchema = lazyValidator9(
|
|
2587
|
+
() => zodSchema15(
|
|
2588
|
+
z17.union([
|
|
2589
|
+
z17.object({
|
|
2590
|
+
type: z17.literal("response.output_text.delta"),
|
|
2591
|
+
item_id: z17.string(),
|
|
2592
|
+
delta: z17.string(),
|
|
2593
|
+
logprobs: z17.array(
|
|
2594
|
+
z17.object({
|
|
2595
|
+
token: z17.string(),
|
|
2596
|
+
logprob: z17.number(),
|
|
2597
|
+
top_logprobs: z17.array(
|
|
2598
|
+
z17.object({
|
|
2599
|
+
token: z17.string(),
|
|
2600
|
+
logprob: z17.number()
|
|
2535
2601
|
})
|
|
2536
2602
|
)
|
|
2537
2603
|
})
|
|
2538
2604
|
).nullish()
|
|
2539
2605
|
}),
|
|
2540
|
-
|
|
2541
|
-
type:
|
|
2542
|
-
response:
|
|
2543
|
-
incomplete_details:
|
|
2544
|
-
usage:
|
|
2545
|
-
input_tokens:
|
|
2546
|
-
input_tokens_details:
|
|
2547
|
-
output_tokens:
|
|
2548
|
-
output_tokens_details:
|
|
2606
|
+
z17.object({
|
|
2607
|
+
type: z17.enum(["response.completed", "response.incomplete"]),
|
|
2608
|
+
response: z17.object({
|
|
2609
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
2610
|
+
usage: z17.object({
|
|
2611
|
+
input_tokens: z17.number(),
|
|
2612
|
+
input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
|
|
2613
|
+
output_tokens: z17.number(),
|
|
2614
|
+
output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
|
|
2549
2615
|
}),
|
|
2550
|
-
service_tier:
|
|
2616
|
+
service_tier: z17.string().nullish()
|
|
2551
2617
|
})
|
|
2552
2618
|
}),
|
|
2553
|
-
|
|
2554
|
-
type:
|
|
2555
|
-
response:
|
|
2556
|
-
id:
|
|
2557
|
-
created_at:
|
|
2558
|
-
model:
|
|
2559
|
-
service_tier:
|
|
2619
|
+
z17.object({
|
|
2620
|
+
type: z17.literal("response.created"),
|
|
2621
|
+
response: z17.object({
|
|
2622
|
+
id: z17.string(),
|
|
2623
|
+
created_at: z17.number(),
|
|
2624
|
+
model: z17.string(),
|
|
2625
|
+
service_tier: z17.string().nullish()
|
|
2560
2626
|
})
|
|
2561
2627
|
}),
|
|
2562
|
-
|
|
2563
|
-
type:
|
|
2564
|
-
output_index:
|
|
2565
|
-
item:
|
|
2566
|
-
|
|
2567
|
-
type:
|
|
2568
|
-
id:
|
|
2569
|
-
phase:
|
|
2628
|
+
z17.object({
|
|
2629
|
+
type: z17.literal("response.output_item.added"),
|
|
2630
|
+
output_index: z17.number(),
|
|
2631
|
+
item: z17.discriminatedUnion("type", [
|
|
2632
|
+
z17.object({
|
|
2633
|
+
type: z17.literal("message"),
|
|
2634
|
+
id: z17.string(),
|
|
2635
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish()
|
|
2570
2636
|
}),
|
|
2571
|
-
|
|
2572
|
-
type:
|
|
2573
|
-
id:
|
|
2574
|
-
encrypted_content:
|
|
2637
|
+
z17.object({
|
|
2638
|
+
type: z17.literal("reasoning"),
|
|
2639
|
+
id: z17.string(),
|
|
2640
|
+
encrypted_content: z17.string().nullish()
|
|
2575
2641
|
}),
|
|
2576
|
-
|
|
2577
|
-
type:
|
|
2578
|
-
id:
|
|
2579
|
-
call_id:
|
|
2580
|
-
name:
|
|
2581
|
-
arguments:
|
|
2642
|
+
z17.object({
|
|
2643
|
+
type: z17.literal("function_call"),
|
|
2644
|
+
id: z17.string(),
|
|
2645
|
+
call_id: z17.string(),
|
|
2646
|
+
name: z17.string(),
|
|
2647
|
+
arguments: z17.string()
|
|
2582
2648
|
}),
|
|
2583
|
-
|
|
2584
|
-
type:
|
|
2585
|
-
id:
|
|
2586
|
-
status:
|
|
2649
|
+
z17.object({
|
|
2650
|
+
type: z17.literal("web_search_call"),
|
|
2651
|
+
id: z17.string(),
|
|
2652
|
+
status: z17.string()
|
|
2587
2653
|
}),
|
|
2588
|
-
|
|
2589
|
-
type:
|
|
2590
|
-
id:
|
|
2591
|
-
status:
|
|
2654
|
+
z17.object({
|
|
2655
|
+
type: z17.literal("computer_call"),
|
|
2656
|
+
id: z17.string(),
|
|
2657
|
+
status: z17.string()
|
|
2592
2658
|
}),
|
|
2593
|
-
|
|
2594
|
-
type:
|
|
2595
|
-
id:
|
|
2659
|
+
z17.object({
|
|
2660
|
+
type: z17.literal("file_search_call"),
|
|
2661
|
+
id: z17.string()
|
|
2596
2662
|
}),
|
|
2597
|
-
|
|
2598
|
-
type:
|
|
2599
|
-
id:
|
|
2663
|
+
z17.object({
|
|
2664
|
+
type: z17.literal("image_generation_call"),
|
|
2665
|
+
id: z17.string()
|
|
2600
2666
|
}),
|
|
2601
|
-
|
|
2602
|
-
type:
|
|
2603
|
-
id:
|
|
2604
|
-
container_id:
|
|
2605
|
-
code:
|
|
2606
|
-
outputs:
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2667
|
+
z17.object({
|
|
2668
|
+
type: z17.literal("code_interpreter_call"),
|
|
2669
|
+
id: z17.string(),
|
|
2670
|
+
container_id: z17.string(),
|
|
2671
|
+
code: z17.string().nullable(),
|
|
2672
|
+
outputs: z17.array(
|
|
2673
|
+
z17.discriminatedUnion("type", [
|
|
2674
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
2675
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
2610
2676
|
])
|
|
2611
2677
|
).nullable(),
|
|
2612
|
-
status:
|
|
2678
|
+
status: z17.string()
|
|
2613
2679
|
})
|
|
2614
2680
|
])
|
|
2615
2681
|
}),
|
|
2616
|
-
|
|
2617
|
-
type:
|
|
2618
|
-
output_index:
|
|
2619
|
-
item:
|
|
2620
|
-
|
|
2621
|
-
type:
|
|
2622
|
-
id:
|
|
2623
|
-
phase:
|
|
2682
|
+
z17.object({
|
|
2683
|
+
type: z17.literal("response.output_item.done"),
|
|
2684
|
+
output_index: z17.number(),
|
|
2685
|
+
item: z17.discriminatedUnion("type", [
|
|
2686
|
+
z17.object({
|
|
2687
|
+
type: z17.literal("message"),
|
|
2688
|
+
id: z17.string(),
|
|
2689
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish()
|
|
2624
2690
|
}),
|
|
2625
|
-
|
|
2626
|
-
type:
|
|
2627
|
-
id:
|
|
2628
|
-
encrypted_content:
|
|
2691
|
+
z17.object({
|
|
2692
|
+
type: z17.literal("reasoning"),
|
|
2693
|
+
id: z17.string(),
|
|
2694
|
+
encrypted_content: z17.string().nullish()
|
|
2629
2695
|
}),
|
|
2630
|
-
|
|
2631
|
-
type:
|
|
2632
|
-
id:
|
|
2633
|
-
call_id:
|
|
2634
|
-
name:
|
|
2635
|
-
arguments:
|
|
2636
|
-
status:
|
|
2696
|
+
z17.object({
|
|
2697
|
+
type: z17.literal("function_call"),
|
|
2698
|
+
id: z17.string(),
|
|
2699
|
+
call_id: z17.string(),
|
|
2700
|
+
name: z17.string(),
|
|
2701
|
+
arguments: z17.string(),
|
|
2702
|
+
status: z17.literal("completed")
|
|
2637
2703
|
}),
|
|
2638
|
-
|
|
2639
|
-
type:
|
|
2640
|
-
id:
|
|
2641
|
-
code:
|
|
2642
|
-
container_id:
|
|
2643
|
-
outputs:
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2704
|
+
z17.object({
|
|
2705
|
+
type: z17.literal("code_interpreter_call"),
|
|
2706
|
+
id: z17.string(),
|
|
2707
|
+
code: z17.string().nullable(),
|
|
2708
|
+
container_id: z17.string(),
|
|
2709
|
+
outputs: z17.array(
|
|
2710
|
+
z17.discriminatedUnion("type", [
|
|
2711
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
2712
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
2647
2713
|
])
|
|
2648
2714
|
).nullable()
|
|
2649
2715
|
}),
|
|
2650
|
-
|
|
2651
|
-
type:
|
|
2652
|
-
id:
|
|
2653
|
-
result:
|
|
2716
|
+
z17.object({
|
|
2717
|
+
type: z17.literal("image_generation_call"),
|
|
2718
|
+
id: z17.string(),
|
|
2719
|
+
result: z17.string()
|
|
2654
2720
|
}),
|
|
2655
|
-
|
|
2656
|
-
type:
|
|
2657
|
-
id:
|
|
2658
|
-
status:
|
|
2659
|
-
action:
|
|
2660
|
-
|
|
2661
|
-
type:
|
|
2662
|
-
query:
|
|
2663
|
-
sources:
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2721
|
+
z17.object({
|
|
2722
|
+
type: z17.literal("web_search_call"),
|
|
2723
|
+
id: z17.string(),
|
|
2724
|
+
status: z17.string(),
|
|
2725
|
+
action: z17.discriminatedUnion("type", [
|
|
2726
|
+
z17.object({
|
|
2727
|
+
type: z17.literal("search"),
|
|
2728
|
+
query: z17.string().nullish(),
|
|
2729
|
+
sources: z17.array(
|
|
2730
|
+
z17.discriminatedUnion("type", [
|
|
2731
|
+
z17.object({ type: z17.literal("url"), url: z17.string() }),
|
|
2732
|
+
z17.object({ type: z17.literal("api"), name: z17.string() })
|
|
2667
2733
|
])
|
|
2668
2734
|
).nullish()
|
|
2669
2735
|
}),
|
|
2670
|
-
|
|
2671
|
-
type:
|
|
2672
|
-
url:
|
|
2736
|
+
z17.object({
|
|
2737
|
+
type: z17.literal("open_page"),
|
|
2738
|
+
url: z17.string().nullish()
|
|
2673
2739
|
}),
|
|
2674
|
-
|
|
2675
|
-
type:
|
|
2676
|
-
url:
|
|
2677
|
-
pattern:
|
|
2740
|
+
z17.object({
|
|
2741
|
+
type: z17.literal("find_in_page"),
|
|
2742
|
+
url: z17.string().nullish(),
|
|
2743
|
+
pattern: z17.string().nullish()
|
|
2678
2744
|
})
|
|
2679
2745
|
]).nullish()
|
|
2680
2746
|
}),
|
|
2681
|
-
|
|
2682
|
-
type:
|
|
2683
|
-
id:
|
|
2684
|
-
queries:
|
|
2685
|
-
results:
|
|
2686
|
-
|
|
2687
|
-
attributes:
|
|
2688
|
-
file_id:
|
|
2689
|
-
filename:
|
|
2690
|
-
score:
|
|
2691
|
-
text:
|
|
2747
|
+
z17.object({
|
|
2748
|
+
type: z17.literal("file_search_call"),
|
|
2749
|
+
id: z17.string(),
|
|
2750
|
+
queries: z17.array(z17.string()),
|
|
2751
|
+
results: z17.array(
|
|
2752
|
+
z17.object({
|
|
2753
|
+
attributes: z17.record(z17.string(), z17.unknown()),
|
|
2754
|
+
file_id: z17.string(),
|
|
2755
|
+
filename: z17.string(),
|
|
2756
|
+
score: z17.number(),
|
|
2757
|
+
text: z17.string()
|
|
2692
2758
|
})
|
|
2693
2759
|
).nullish()
|
|
2694
2760
|
}),
|
|
2695
|
-
|
|
2696
|
-
type:
|
|
2697
|
-
id:
|
|
2698
|
-
call_id:
|
|
2699
|
-
action:
|
|
2700
|
-
type:
|
|
2701
|
-
command:
|
|
2702
|
-
timeout_ms:
|
|
2703
|
-
user:
|
|
2704
|
-
working_directory:
|
|
2705
|
-
env:
|
|
2761
|
+
z17.object({
|
|
2762
|
+
type: z17.literal("local_shell_call"),
|
|
2763
|
+
id: z17.string(),
|
|
2764
|
+
call_id: z17.string(),
|
|
2765
|
+
action: z17.object({
|
|
2766
|
+
type: z17.literal("exec"),
|
|
2767
|
+
command: z17.array(z17.string()),
|
|
2768
|
+
timeout_ms: z17.number().optional(),
|
|
2769
|
+
user: z17.string().optional(),
|
|
2770
|
+
working_directory: z17.string().optional(),
|
|
2771
|
+
env: z17.record(z17.string(), z17.string()).optional()
|
|
2706
2772
|
})
|
|
2707
2773
|
}),
|
|
2708
|
-
|
|
2709
|
-
type:
|
|
2710
|
-
id:
|
|
2711
|
-
status:
|
|
2774
|
+
z17.object({
|
|
2775
|
+
type: z17.literal("computer_call"),
|
|
2776
|
+
id: z17.string(),
|
|
2777
|
+
status: z17.literal("completed")
|
|
2712
2778
|
})
|
|
2713
2779
|
])
|
|
2714
2780
|
}),
|
|
2715
|
-
|
|
2716
|
-
type:
|
|
2717
|
-
item_id:
|
|
2718
|
-
output_index:
|
|
2719
|
-
delta:
|
|
2781
|
+
z17.object({
|
|
2782
|
+
type: z17.literal("response.function_call_arguments.delta"),
|
|
2783
|
+
item_id: z17.string(),
|
|
2784
|
+
output_index: z17.number(),
|
|
2785
|
+
delta: z17.string()
|
|
2720
2786
|
}),
|
|
2721
|
-
|
|
2722
|
-
type:
|
|
2723
|
-
item_id:
|
|
2724
|
-
output_index:
|
|
2725
|
-
partial_image_b64:
|
|
2787
|
+
z17.object({
|
|
2788
|
+
type: z17.literal("response.image_generation_call.partial_image"),
|
|
2789
|
+
item_id: z17.string(),
|
|
2790
|
+
output_index: z17.number(),
|
|
2791
|
+
partial_image_b64: z17.string()
|
|
2726
2792
|
}),
|
|
2727
|
-
|
|
2728
|
-
type:
|
|
2729
|
-
item_id:
|
|
2730
|
-
output_index:
|
|
2731
|
-
delta:
|
|
2793
|
+
z17.object({
|
|
2794
|
+
type: z17.literal("response.code_interpreter_call_code.delta"),
|
|
2795
|
+
item_id: z17.string(),
|
|
2796
|
+
output_index: z17.number(),
|
|
2797
|
+
delta: z17.string()
|
|
2732
2798
|
}),
|
|
2733
|
-
|
|
2734
|
-
type:
|
|
2735
|
-
item_id:
|
|
2736
|
-
output_index:
|
|
2737
|
-
code:
|
|
2799
|
+
z17.object({
|
|
2800
|
+
type: z17.literal("response.code_interpreter_call_code.done"),
|
|
2801
|
+
item_id: z17.string(),
|
|
2802
|
+
output_index: z17.number(),
|
|
2803
|
+
code: z17.string()
|
|
2738
2804
|
}),
|
|
2739
|
-
|
|
2740
|
-
type:
|
|
2741
|
-
annotation:
|
|
2742
|
-
|
|
2743
|
-
type:
|
|
2744
|
-
start_index:
|
|
2745
|
-
end_index:
|
|
2746
|
-
url:
|
|
2747
|
-
title:
|
|
2805
|
+
z17.object({
|
|
2806
|
+
type: z17.literal("response.output_text.annotation.added"),
|
|
2807
|
+
annotation: z17.discriminatedUnion("type", [
|
|
2808
|
+
z17.object({
|
|
2809
|
+
type: z17.literal("url_citation"),
|
|
2810
|
+
start_index: z17.number(),
|
|
2811
|
+
end_index: z17.number(),
|
|
2812
|
+
url: z17.string(),
|
|
2813
|
+
title: z17.string()
|
|
2748
2814
|
}),
|
|
2749
|
-
|
|
2750
|
-
type:
|
|
2751
|
-
file_id:
|
|
2752
|
-
filename:
|
|
2753
|
-
index:
|
|
2754
|
-
start_index:
|
|
2755
|
-
end_index:
|
|
2756
|
-
quote:
|
|
2815
|
+
z17.object({
|
|
2816
|
+
type: z17.literal("file_citation"),
|
|
2817
|
+
file_id: z17.string(),
|
|
2818
|
+
filename: z17.string().nullish(),
|
|
2819
|
+
index: z17.number().nullish(),
|
|
2820
|
+
start_index: z17.number().nullish(),
|
|
2821
|
+
end_index: z17.number().nullish(),
|
|
2822
|
+
quote: z17.string().nullish()
|
|
2757
2823
|
})
|
|
2758
2824
|
])
|
|
2759
2825
|
}),
|
|
2760
|
-
|
|
2761
|
-
type:
|
|
2762
|
-
item_id:
|
|
2763
|
-
summary_index:
|
|
2826
|
+
z17.object({
|
|
2827
|
+
type: z17.literal("response.reasoning_summary_part.added"),
|
|
2828
|
+
item_id: z17.string(),
|
|
2829
|
+
summary_index: z17.number()
|
|
2764
2830
|
}),
|
|
2765
|
-
|
|
2766
|
-
type:
|
|
2767
|
-
item_id:
|
|
2768
|
-
summary_index:
|
|
2769
|
-
delta:
|
|
2831
|
+
z17.object({
|
|
2832
|
+
type: z17.literal("response.reasoning_summary_text.delta"),
|
|
2833
|
+
item_id: z17.string(),
|
|
2834
|
+
summary_index: z17.number(),
|
|
2835
|
+
delta: z17.string()
|
|
2770
2836
|
}),
|
|
2771
|
-
|
|
2772
|
-
type:
|
|
2773
|
-
item_id:
|
|
2774
|
-
summary_index:
|
|
2837
|
+
z17.object({
|
|
2838
|
+
type: z17.literal("response.reasoning_summary_part.done"),
|
|
2839
|
+
item_id: z17.string(),
|
|
2840
|
+
summary_index: z17.number()
|
|
2775
2841
|
}),
|
|
2776
|
-
|
|
2777
|
-
type:
|
|
2778
|
-
sequence_number:
|
|
2779
|
-
error:
|
|
2780
|
-
type:
|
|
2781
|
-
code:
|
|
2782
|
-
message:
|
|
2783
|
-
param:
|
|
2842
|
+
z17.object({
|
|
2843
|
+
type: z17.literal("error"),
|
|
2844
|
+
sequence_number: z17.number(),
|
|
2845
|
+
error: z17.object({
|
|
2846
|
+
type: z17.string(),
|
|
2847
|
+
code: z17.string(),
|
|
2848
|
+
message: z17.string(),
|
|
2849
|
+
param: z17.string().nullish()
|
|
2784
2850
|
})
|
|
2785
2851
|
}),
|
|
2786
|
-
|
|
2852
|
+
z17.object({ type: z17.string() }).loose().transform((value) => ({
|
|
2787
2853
|
type: "unknown_chunk",
|
|
2788
2854
|
message: value.type
|
|
2789
2855
|
}))
|
|
@@ -2791,186 +2857,186 @@ var openaiResponsesChunkSchema = lazyValidator8(
|
|
|
2791
2857
|
])
|
|
2792
2858
|
)
|
|
2793
2859
|
);
|
|
2794
|
-
var openaiResponsesResponseSchema =
|
|
2795
|
-
() =>
|
|
2796
|
-
|
|
2797
|
-
id:
|
|
2798
|
-
created_at:
|
|
2799
|
-
error:
|
|
2800
|
-
message:
|
|
2801
|
-
type:
|
|
2802
|
-
param:
|
|
2803
|
-
code:
|
|
2860
|
+
var openaiResponsesResponseSchema = lazyValidator9(
|
|
2861
|
+
() => zodSchema15(
|
|
2862
|
+
z17.object({
|
|
2863
|
+
id: z17.string().optional(),
|
|
2864
|
+
created_at: z17.number().optional(),
|
|
2865
|
+
error: z17.object({
|
|
2866
|
+
message: z17.string(),
|
|
2867
|
+
type: z17.string(),
|
|
2868
|
+
param: z17.string().nullish(),
|
|
2869
|
+
code: z17.string()
|
|
2804
2870
|
}).nullish(),
|
|
2805
|
-
model:
|
|
2806
|
-
output:
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
type:
|
|
2810
|
-
role:
|
|
2811
|
-
id:
|
|
2812
|
-
phase:
|
|
2813
|
-
content:
|
|
2814
|
-
|
|
2815
|
-
type:
|
|
2816
|
-
text:
|
|
2817
|
-
logprobs:
|
|
2818
|
-
|
|
2819
|
-
token:
|
|
2820
|
-
logprob:
|
|
2821
|
-
top_logprobs:
|
|
2822
|
-
|
|
2823
|
-
token:
|
|
2824
|
-
logprob:
|
|
2871
|
+
model: z17.string().optional(),
|
|
2872
|
+
output: z17.array(
|
|
2873
|
+
z17.discriminatedUnion("type", [
|
|
2874
|
+
z17.object({
|
|
2875
|
+
type: z17.literal("message"),
|
|
2876
|
+
role: z17.literal("assistant"),
|
|
2877
|
+
id: z17.string(),
|
|
2878
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish(),
|
|
2879
|
+
content: z17.array(
|
|
2880
|
+
z17.object({
|
|
2881
|
+
type: z17.literal("output_text"),
|
|
2882
|
+
text: z17.string(),
|
|
2883
|
+
logprobs: z17.array(
|
|
2884
|
+
z17.object({
|
|
2885
|
+
token: z17.string(),
|
|
2886
|
+
logprob: z17.number(),
|
|
2887
|
+
top_logprobs: z17.array(
|
|
2888
|
+
z17.object({
|
|
2889
|
+
token: z17.string(),
|
|
2890
|
+
logprob: z17.number()
|
|
2825
2891
|
})
|
|
2826
2892
|
)
|
|
2827
2893
|
})
|
|
2828
2894
|
).nullish(),
|
|
2829
|
-
annotations:
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
type:
|
|
2833
|
-
start_index:
|
|
2834
|
-
end_index:
|
|
2835
|
-
url:
|
|
2836
|
-
title:
|
|
2895
|
+
annotations: z17.array(
|
|
2896
|
+
z17.discriminatedUnion("type", [
|
|
2897
|
+
z17.object({
|
|
2898
|
+
type: z17.literal("url_citation"),
|
|
2899
|
+
start_index: z17.number(),
|
|
2900
|
+
end_index: z17.number(),
|
|
2901
|
+
url: z17.string(),
|
|
2902
|
+
title: z17.string()
|
|
2837
2903
|
}),
|
|
2838
|
-
|
|
2839
|
-
type:
|
|
2840
|
-
file_id:
|
|
2841
|
-
filename:
|
|
2842
|
-
index:
|
|
2843
|
-
start_index:
|
|
2844
|
-
end_index:
|
|
2845
|
-
quote:
|
|
2904
|
+
z17.object({
|
|
2905
|
+
type: z17.literal("file_citation"),
|
|
2906
|
+
file_id: z17.string(),
|
|
2907
|
+
filename: z17.string().nullish(),
|
|
2908
|
+
index: z17.number().nullish(),
|
|
2909
|
+
start_index: z17.number().nullish(),
|
|
2910
|
+
end_index: z17.number().nullish(),
|
|
2911
|
+
quote: z17.string().nullish()
|
|
2846
2912
|
}),
|
|
2847
|
-
|
|
2848
|
-
type:
|
|
2849
|
-
container_id:
|
|
2850
|
-
file_id:
|
|
2851
|
-
filename:
|
|
2852
|
-
start_index:
|
|
2853
|
-
end_index:
|
|
2854
|
-
index:
|
|
2913
|
+
z17.object({
|
|
2914
|
+
type: z17.literal("container_file_citation"),
|
|
2915
|
+
container_id: z17.string(),
|
|
2916
|
+
file_id: z17.string(),
|
|
2917
|
+
filename: z17.string().nullish(),
|
|
2918
|
+
start_index: z17.number().nullish(),
|
|
2919
|
+
end_index: z17.number().nullish(),
|
|
2920
|
+
index: z17.number().nullish()
|
|
2855
2921
|
}),
|
|
2856
|
-
|
|
2857
|
-
type:
|
|
2858
|
-
file_id:
|
|
2859
|
-
index:
|
|
2922
|
+
z17.object({
|
|
2923
|
+
type: z17.literal("file_path"),
|
|
2924
|
+
file_id: z17.string(),
|
|
2925
|
+
index: z17.number().nullish()
|
|
2860
2926
|
})
|
|
2861
2927
|
])
|
|
2862
2928
|
)
|
|
2863
2929
|
})
|
|
2864
2930
|
)
|
|
2865
2931
|
}),
|
|
2866
|
-
|
|
2867
|
-
type:
|
|
2868
|
-
id:
|
|
2869
|
-
status:
|
|
2870
|
-
action:
|
|
2871
|
-
|
|
2872
|
-
type:
|
|
2873
|
-
query:
|
|
2874
|
-
sources:
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
type:
|
|
2879
|
-
name:
|
|
2932
|
+
z17.object({
|
|
2933
|
+
type: z17.literal("web_search_call"),
|
|
2934
|
+
id: z17.string(),
|
|
2935
|
+
status: z17.string(),
|
|
2936
|
+
action: z17.discriminatedUnion("type", [
|
|
2937
|
+
z17.object({
|
|
2938
|
+
type: z17.literal("search"),
|
|
2939
|
+
query: z17.string().nullish(),
|
|
2940
|
+
sources: z17.array(
|
|
2941
|
+
z17.discriminatedUnion("type", [
|
|
2942
|
+
z17.object({ type: z17.literal("url"), url: z17.string() }),
|
|
2943
|
+
z17.object({
|
|
2944
|
+
type: z17.literal("api"),
|
|
2945
|
+
name: z17.string()
|
|
2880
2946
|
})
|
|
2881
2947
|
])
|
|
2882
2948
|
).nullish()
|
|
2883
2949
|
}),
|
|
2884
|
-
|
|
2885
|
-
type:
|
|
2886
|
-
url:
|
|
2950
|
+
z17.object({
|
|
2951
|
+
type: z17.literal("open_page"),
|
|
2952
|
+
url: z17.string().nullish()
|
|
2887
2953
|
}),
|
|
2888
|
-
|
|
2889
|
-
type:
|
|
2890
|
-
url:
|
|
2891
|
-
pattern:
|
|
2954
|
+
z17.object({
|
|
2955
|
+
type: z17.literal("find_in_page"),
|
|
2956
|
+
url: z17.string().nullish(),
|
|
2957
|
+
pattern: z17.string().nullish()
|
|
2892
2958
|
})
|
|
2893
2959
|
]).nullish()
|
|
2894
2960
|
}),
|
|
2895
|
-
|
|
2896
|
-
type:
|
|
2897
|
-
id:
|
|
2898
|
-
queries:
|
|
2899
|
-
results:
|
|
2900
|
-
|
|
2901
|
-
attributes:
|
|
2902
|
-
|
|
2903
|
-
|
|
2961
|
+
z17.object({
|
|
2962
|
+
type: z17.literal("file_search_call"),
|
|
2963
|
+
id: z17.string(),
|
|
2964
|
+
queries: z17.array(z17.string()),
|
|
2965
|
+
results: z17.array(
|
|
2966
|
+
z17.object({
|
|
2967
|
+
attributes: z17.record(
|
|
2968
|
+
z17.string(),
|
|
2969
|
+
z17.union([z17.string(), z17.number(), z17.boolean()])
|
|
2904
2970
|
),
|
|
2905
|
-
file_id:
|
|
2906
|
-
filename:
|
|
2907
|
-
score:
|
|
2908
|
-
text:
|
|
2971
|
+
file_id: z17.string(),
|
|
2972
|
+
filename: z17.string(),
|
|
2973
|
+
score: z17.number(),
|
|
2974
|
+
text: z17.string()
|
|
2909
2975
|
})
|
|
2910
2976
|
).nullish()
|
|
2911
2977
|
}),
|
|
2912
|
-
|
|
2913
|
-
type:
|
|
2914
|
-
id:
|
|
2915
|
-
code:
|
|
2916
|
-
container_id:
|
|
2917
|
-
outputs:
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2978
|
+
z17.object({
|
|
2979
|
+
type: z17.literal("code_interpreter_call"),
|
|
2980
|
+
id: z17.string(),
|
|
2981
|
+
code: z17.string().nullable(),
|
|
2982
|
+
container_id: z17.string(),
|
|
2983
|
+
outputs: z17.array(
|
|
2984
|
+
z17.discriminatedUnion("type", [
|
|
2985
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
2986
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
2921
2987
|
])
|
|
2922
2988
|
).nullable()
|
|
2923
2989
|
}),
|
|
2924
|
-
|
|
2925
|
-
type:
|
|
2926
|
-
id:
|
|
2927
|
-
result:
|
|
2990
|
+
z17.object({
|
|
2991
|
+
type: z17.literal("image_generation_call"),
|
|
2992
|
+
id: z17.string(),
|
|
2993
|
+
result: z17.string()
|
|
2928
2994
|
}),
|
|
2929
|
-
|
|
2930
|
-
type:
|
|
2931
|
-
id:
|
|
2932
|
-
call_id:
|
|
2933
|
-
action:
|
|
2934
|
-
type:
|
|
2935
|
-
command:
|
|
2936
|
-
timeout_ms:
|
|
2937
|
-
user:
|
|
2938
|
-
working_directory:
|
|
2939
|
-
env:
|
|
2995
|
+
z17.object({
|
|
2996
|
+
type: z17.literal("local_shell_call"),
|
|
2997
|
+
id: z17.string(),
|
|
2998
|
+
call_id: z17.string(),
|
|
2999
|
+
action: z17.object({
|
|
3000
|
+
type: z17.literal("exec"),
|
|
3001
|
+
command: z17.array(z17.string()),
|
|
3002
|
+
timeout_ms: z17.number().optional(),
|
|
3003
|
+
user: z17.string().optional(),
|
|
3004
|
+
working_directory: z17.string().optional(),
|
|
3005
|
+
env: z17.record(z17.string(), z17.string()).optional()
|
|
2940
3006
|
})
|
|
2941
3007
|
}),
|
|
2942
|
-
|
|
2943
|
-
type:
|
|
2944
|
-
call_id:
|
|
2945
|
-
name:
|
|
2946
|
-
arguments:
|
|
2947
|
-
id:
|
|
3008
|
+
z17.object({
|
|
3009
|
+
type: z17.literal("function_call"),
|
|
3010
|
+
call_id: z17.string(),
|
|
3011
|
+
name: z17.string(),
|
|
3012
|
+
arguments: z17.string(),
|
|
3013
|
+
id: z17.string()
|
|
2948
3014
|
}),
|
|
2949
|
-
|
|
2950
|
-
type:
|
|
2951
|
-
id:
|
|
2952
|
-
status:
|
|
3015
|
+
z17.object({
|
|
3016
|
+
type: z17.literal("computer_call"),
|
|
3017
|
+
id: z17.string(),
|
|
3018
|
+
status: z17.string().optional()
|
|
2953
3019
|
}),
|
|
2954
|
-
|
|
2955
|
-
type:
|
|
2956
|
-
id:
|
|
2957
|
-
encrypted_content:
|
|
2958
|
-
summary:
|
|
2959
|
-
|
|
2960
|
-
type:
|
|
2961
|
-
text:
|
|
3020
|
+
z17.object({
|
|
3021
|
+
type: z17.literal("reasoning"),
|
|
3022
|
+
id: z17.string(),
|
|
3023
|
+
encrypted_content: z17.string().nullish(),
|
|
3024
|
+
summary: z17.array(
|
|
3025
|
+
z17.object({
|
|
3026
|
+
type: z17.literal("summary_text"),
|
|
3027
|
+
text: z17.string()
|
|
2962
3028
|
})
|
|
2963
3029
|
)
|
|
2964
3030
|
})
|
|
2965
3031
|
])
|
|
2966
3032
|
).optional(),
|
|
2967
|
-
service_tier:
|
|
2968
|
-
incomplete_details:
|
|
2969
|
-
usage:
|
|
2970
|
-
input_tokens:
|
|
2971
|
-
input_tokens_details:
|
|
2972
|
-
output_tokens:
|
|
2973
|
-
output_tokens_details:
|
|
3033
|
+
service_tier: z17.string().nullish(),
|
|
3034
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
3035
|
+
usage: z17.object({
|
|
3036
|
+
input_tokens: z17.number(),
|
|
3037
|
+
input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
|
|
3038
|
+
output_tokens: z17.number(),
|
|
3039
|
+
output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
|
|
2974
3040
|
}).optional()
|
|
2975
3041
|
})
|
|
2976
3042
|
)
|
|
@@ -2978,10 +3044,10 @@ var openaiResponsesResponseSchema = lazyValidator8(
|
|
|
2978
3044
|
|
|
2979
3045
|
// src/responses/openai-responses-options.ts
|
|
2980
3046
|
import {
|
|
2981
|
-
lazyValidator as
|
|
2982
|
-
zodSchema as
|
|
3047
|
+
lazyValidator as lazyValidator10,
|
|
3048
|
+
zodSchema as zodSchema16
|
|
2983
3049
|
} from "@ai-sdk/provider-utils";
|
|
2984
|
-
import { z as
|
|
3050
|
+
import { z as z18 } from "zod/v4";
|
|
2985
3051
|
var TOP_LOGPROBS_MAX = 20;
|
|
2986
3052
|
var openaiResponsesReasoningModelIds = [
|
|
2987
3053
|
"o1",
|
|
@@ -3063,19 +3129,19 @@ var openaiResponsesModelIds = [
|
|
|
3063
3129
|
"gpt-5-chat-latest",
|
|
3064
3130
|
...openaiResponsesReasoningModelIds
|
|
3065
3131
|
];
|
|
3066
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3067
|
-
() =>
|
|
3068
|
-
|
|
3069
|
-
conversation:
|
|
3070
|
-
include:
|
|
3071
|
-
|
|
3132
|
+
var openaiResponsesProviderOptionsSchema = lazyValidator10(
|
|
3133
|
+
() => zodSchema16(
|
|
3134
|
+
z18.object({
|
|
3135
|
+
conversation: z18.string().nullish(),
|
|
3136
|
+
include: z18.array(
|
|
3137
|
+
z18.enum([
|
|
3072
3138
|
"reasoning.encrypted_content",
|
|
3073
3139
|
// handled internally by default, only needed for unknown reasoning models
|
|
3074
3140
|
"file_search_call.results",
|
|
3075
3141
|
"message.output_text.logprobs"
|
|
3076
3142
|
])
|
|
3077
3143
|
).nullish(),
|
|
3078
|
-
instructions:
|
|
3144
|
+
instructions: z18.string().nullish(),
|
|
3079
3145
|
/**
|
|
3080
3146
|
* Return the log probabilities of the tokens.
|
|
3081
3147
|
*
|
|
@@ -3088,17 +3154,17 @@ var openaiResponsesProviderOptionsSchema = lazyValidator9(
|
|
|
3088
3154
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3089
3155
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3090
3156
|
*/
|
|
3091
|
-
logprobs:
|
|
3157
|
+
logprobs: z18.union([z18.boolean(), z18.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3092
3158
|
/**
|
|
3093
3159
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3094
3160
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3095
3161
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3096
3162
|
*/
|
|
3097
|
-
maxToolCalls:
|
|
3098
|
-
metadata:
|
|
3099
|
-
parallelToolCalls:
|
|
3100
|
-
previousResponseId:
|
|
3101
|
-
promptCacheKey:
|
|
3163
|
+
maxToolCalls: z18.number().nullish(),
|
|
3164
|
+
metadata: z18.any().nullish(),
|
|
3165
|
+
parallelToolCalls: z18.boolean().nullish(),
|
|
3166
|
+
previousResponseId: z18.string().nullish(),
|
|
3167
|
+
promptCacheKey: z18.string().nullish(),
|
|
3102
3168
|
/**
|
|
3103
3169
|
* The retention policy for the prompt cache.
|
|
3104
3170
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -3107,7 +3173,7 @@ var openaiResponsesProviderOptionsSchema = lazyValidator9(
|
|
|
3107
3173
|
*
|
|
3108
3174
|
* @default 'in_memory'
|
|
3109
3175
|
*/
|
|
3110
|
-
promptCacheRetention:
|
|
3176
|
+
promptCacheRetention: z18.enum(["in_memory", "24h"]).nullish(),
|
|
3111
3177
|
/**
|
|
3112
3178
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3113
3179
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -3118,15 +3184,15 @@ var openaiResponsesProviderOptionsSchema = lazyValidator9(
|
|
|
3118
3184
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
3119
3185
|
* an error.
|
|
3120
3186
|
*/
|
|
3121
|
-
reasoningEffort:
|
|
3122
|
-
reasoningSummary:
|
|
3123
|
-
safetyIdentifier:
|
|
3124
|
-
serviceTier:
|
|
3125
|
-
store:
|
|
3126
|
-
strictJsonSchema:
|
|
3127
|
-
textVerbosity:
|
|
3128
|
-
truncation:
|
|
3129
|
-
user:
|
|
3187
|
+
reasoningEffort: z18.string().nullish(),
|
|
3188
|
+
reasoningSummary: z18.string().nullish(),
|
|
3189
|
+
safetyIdentifier: z18.string().nullish(),
|
|
3190
|
+
serviceTier: z18.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3191
|
+
store: z18.boolean().nullish(),
|
|
3192
|
+
strictJsonSchema: z18.boolean().nullish(),
|
|
3193
|
+
textVerbosity: z18.enum(["low", "medium", "high"]).nullish(),
|
|
3194
|
+
truncation: z18.enum(["auto", "disabled"]).nullish(),
|
|
3195
|
+
user: z18.string().nullish()
|
|
3130
3196
|
})
|
|
3131
3197
|
)
|
|
3132
3198
|
);
|
|
@@ -3327,7 +3393,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3327
3393
|
if (stopSequences != null) {
|
|
3328
3394
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
3329
3395
|
}
|
|
3330
|
-
const openaiOptions = await
|
|
3396
|
+
const openaiOptions = await parseProviderOptions6({
|
|
3331
3397
|
provider: "openai",
|
|
3332
3398
|
providerOptions,
|
|
3333
3399
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -4366,21 +4432,21 @@ function mapWebSearchOutput(action) {
|
|
|
4366
4432
|
import {
|
|
4367
4433
|
combineHeaders as combineHeaders6,
|
|
4368
4434
|
createBinaryResponseHandler,
|
|
4369
|
-
parseProviderOptions as
|
|
4435
|
+
parseProviderOptions as parseProviderOptions7,
|
|
4370
4436
|
postJsonToApi as postJsonToApi6
|
|
4371
4437
|
} from "@ai-sdk/provider-utils";
|
|
4372
4438
|
|
|
4373
4439
|
// src/speech/openai-speech-options.ts
|
|
4374
4440
|
import {
|
|
4375
|
-
lazyValidator as
|
|
4376
|
-
zodSchema as
|
|
4441
|
+
lazyValidator as lazyValidator11,
|
|
4442
|
+
zodSchema as zodSchema17
|
|
4377
4443
|
} from "@ai-sdk/provider-utils";
|
|
4378
|
-
import { z as
|
|
4379
|
-
var openaiSpeechProviderOptionsSchema =
|
|
4380
|
-
() =>
|
|
4381
|
-
|
|
4382
|
-
instructions:
|
|
4383
|
-
speed:
|
|
4444
|
+
import { z as z19 } from "zod/v4";
|
|
4445
|
+
var openaiSpeechProviderOptionsSchema = lazyValidator11(
|
|
4446
|
+
() => zodSchema17(
|
|
4447
|
+
z19.object({
|
|
4448
|
+
instructions: z19.string().nullish(),
|
|
4449
|
+
speed: z19.number().min(0.25).max(4).default(1).nullish()
|
|
4384
4450
|
})
|
|
4385
4451
|
)
|
|
4386
4452
|
);
|
|
@@ -4405,7 +4471,7 @@ var OpenAISpeechModel = class {
|
|
|
4405
4471
|
providerOptions
|
|
4406
4472
|
}) {
|
|
4407
4473
|
const warnings = [];
|
|
4408
|
-
const openAIOptions = await
|
|
4474
|
+
const openAIOptions = await parseProviderOptions7({
|
|
4409
4475
|
provider: "openai",
|
|
4410
4476
|
providerOptions,
|
|
4411
4477
|
schema: openaiSpeechProviderOptionsSchema
|
|
@@ -4492,38 +4558,38 @@ import {
|
|
|
4492
4558
|
convertBase64ToUint8Array,
|
|
4493
4559
|
createJsonResponseHandler as createJsonResponseHandler6,
|
|
4494
4560
|
mediaTypeToExtension,
|
|
4495
|
-
parseProviderOptions as
|
|
4561
|
+
parseProviderOptions as parseProviderOptions8,
|
|
4496
4562
|
postFormDataToApi
|
|
4497
4563
|
} from "@ai-sdk/provider-utils";
|
|
4498
4564
|
|
|
4499
4565
|
// src/transcription/openai-transcription-api.ts
|
|
4500
|
-
import { lazyValidator as
|
|
4501
|
-
import { z as
|
|
4502
|
-
var openaiTranscriptionResponseSchema =
|
|
4503
|
-
() =>
|
|
4504
|
-
|
|
4505
|
-
text:
|
|
4506
|
-
language:
|
|
4507
|
-
duration:
|
|
4508
|
-
words:
|
|
4509
|
-
|
|
4510
|
-
word:
|
|
4511
|
-
start:
|
|
4512
|
-
end:
|
|
4566
|
+
import { lazyValidator as lazyValidator12, zodSchema as zodSchema18 } from "@ai-sdk/provider-utils";
|
|
4567
|
+
import { z as z20 } from "zod/v4";
|
|
4568
|
+
var openaiTranscriptionResponseSchema = lazyValidator12(
|
|
4569
|
+
() => zodSchema18(
|
|
4570
|
+
z20.object({
|
|
4571
|
+
text: z20.string(),
|
|
4572
|
+
language: z20.string().nullish(),
|
|
4573
|
+
duration: z20.number().nullish(),
|
|
4574
|
+
words: z20.array(
|
|
4575
|
+
z20.object({
|
|
4576
|
+
word: z20.string(),
|
|
4577
|
+
start: z20.number(),
|
|
4578
|
+
end: z20.number()
|
|
4513
4579
|
})
|
|
4514
4580
|
).nullish(),
|
|
4515
|
-
segments:
|
|
4516
|
-
|
|
4517
|
-
id:
|
|
4518
|
-
seek:
|
|
4519
|
-
start:
|
|
4520
|
-
end:
|
|
4521
|
-
text:
|
|
4522
|
-
tokens:
|
|
4523
|
-
temperature:
|
|
4524
|
-
avg_logprob:
|
|
4525
|
-
compression_ratio:
|
|
4526
|
-
no_speech_prob:
|
|
4581
|
+
segments: z20.array(
|
|
4582
|
+
z20.object({
|
|
4583
|
+
id: z20.number(),
|
|
4584
|
+
seek: z20.number(),
|
|
4585
|
+
start: z20.number(),
|
|
4586
|
+
end: z20.number(),
|
|
4587
|
+
text: z20.string(),
|
|
4588
|
+
tokens: z20.array(z20.number()),
|
|
4589
|
+
temperature: z20.number(),
|
|
4590
|
+
avg_logprob: z20.number(),
|
|
4591
|
+
compression_ratio: z20.number(),
|
|
4592
|
+
no_speech_prob: z20.number()
|
|
4527
4593
|
})
|
|
4528
4594
|
).nullish()
|
|
4529
4595
|
})
|
|
@@ -4532,35 +4598,35 @@ var openaiTranscriptionResponseSchema = lazyValidator11(
|
|
|
4532
4598
|
|
|
4533
4599
|
// src/transcription/openai-transcription-options.ts
|
|
4534
4600
|
import {
|
|
4535
|
-
lazyValidator as
|
|
4536
|
-
zodSchema as
|
|
4601
|
+
lazyValidator as lazyValidator13,
|
|
4602
|
+
zodSchema as zodSchema19
|
|
4537
4603
|
} from "@ai-sdk/provider-utils";
|
|
4538
|
-
import { z as
|
|
4539
|
-
var openAITranscriptionProviderOptions =
|
|
4540
|
-
() =>
|
|
4541
|
-
|
|
4604
|
+
import { z as z21 } from "zod/v4";
|
|
4605
|
+
var openAITranscriptionProviderOptions = lazyValidator13(
|
|
4606
|
+
() => zodSchema19(
|
|
4607
|
+
z21.object({
|
|
4542
4608
|
/**
|
|
4543
4609
|
* Additional information to include in the transcription response.
|
|
4544
4610
|
*/
|
|
4545
|
-
include:
|
|
4611
|
+
include: z21.array(z21.string()).optional(),
|
|
4546
4612
|
/**
|
|
4547
4613
|
* The language of the input audio in ISO-639-1 format.
|
|
4548
4614
|
*/
|
|
4549
|
-
language:
|
|
4615
|
+
language: z21.string().optional(),
|
|
4550
4616
|
/**
|
|
4551
4617
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
4552
4618
|
*/
|
|
4553
|
-
prompt:
|
|
4619
|
+
prompt: z21.string().optional(),
|
|
4554
4620
|
/**
|
|
4555
4621
|
* The sampling temperature, between 0 and 1.
|
|
4556
4622
|
* @default 0
|
|
4557
4623
|
*/
|
|
4558
|
-
temperature:
|
|
4624
|
+
temperature: z21.number().min(0).max(1).default(0).optional(),
|
|
4559
4625
|
/**
|
|
4560
4626
|
* The timestamp granularities to populate for this transcription.
|
|
4561
4627
|
* @default ['segment']
|
|
4562
4628
|
*/
|
|
4563
|
-
timestampGranularities:
|
|
4629
|
+
timestampGranularities: z21.array(z21.enum(["word", "segment"])).default(["segment"]).optional()
|
|
4564
4630
|
})
|
|
4565
4631
|
)
|
|
4566
4632
|
);
|
|
@@ -4640,7 +4706,7 @@ var OpenAITranscriptionModel = class {
|
|
|
4640
4706
|
providerOptions
|
|
4641
4707
|
}) {
|
|
4642
4708
|
const warnings = [];
|
|
4643
|
-
const openAIOptions = await
|
|
4709
|
+
const openAIOptions = await parseProviderOptions8({
|
|
4644
4710
|
provider: "openai",
|
|
4645
4711
|
providerOptions,
|
|
4646
4712
|
schema: openAITranscriptionProviderOptions
|
|
@@ -4733,7 +4799,7 @@ var OpenAITranscriptionModel = class {
|
|
|
4733
4799
|
};
|
|
4734
4800
|
|
|
4735
4801
|
// src/version.ts
|
|
4736
|
-
var VERSION = true ? "2.0.
|
|
4802
|
+
var VERSION = true ? "2.0.106" : "0.0.0-test";
|
|
4737
4803
|
|
|
4738
4804
|
// src/openai-provider.ts
|
|
4739
4805
|
function createOpenAI(options = {}) {
|