@ai-sdk/gateway 3.0.135 → 3.0.137
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 +16 -0
- package/dist/index.d.mts +25 -5
- package/dist/index.d.ts +25 -5
- package/dist/index.js +272 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +320 -59
- package/dist/index.mjs.map +1 -1
- package/docs/00-ai-gateway.mdx +34 -0
- package/package.json +1 -1
- package/src/gateway-language-model-settings.ts +1 -0
- package/src/gateway-model-entry.ts +2 -0
- package/src/gateway-provider.ts +50 -0
- package/src/gateway-speech-model-settings.ts +5 -0
- package/src/gateway-speech-model.ts +138 -0
- package/src/gateway-transcription-model-settings.ts +6 -0
- package/src/gateway-transcription-model.ts +148 -0
- package/src/gateway-video-model-settings.ts +1 -0
- package/src/index.ts +2 -0
- package/src/tool/parallel-search.ts +7 -3
package/dist/index.mjs
CHANGED
|
@@ -544,6 +544,8 @@ var KNOWN_MODEL_TYPES = [
|
|
|
544
544
|
"image",
|
|
545
545
|
"language",
|
|
546
546
|
"reranking",
|
|
547
|
+
"speech",
|
|
548
|
+
"transcription",
|
|
547
549
|
"video"
|
|
548
550
|
];
|
|
549
551
|
|
|
@@ -1568,43 +1570,280 @@ var gatewayRerankingResponseSchema = lazySchema8(
|
|
|
1568
1570
|
)
|
|
1569
1571
|
);
|
|
1570
1572
|
|
|
1573
|
+
// src/gateway-speech-model.ts
|
|
1574
|
+
import {
|
|
1575
|
+
combineHeaders as combineHeaders6,
|
|
1576
|
+
createJsonErrorResponseHandler as createJsonErrorResponseHandler9,
|
|
1577
|
+
createJsonResponseHandler as createJsonResponseHandler8,
|
|
1578
|
+
postJsonToApi as postJsonToApi6,
|
|
1579
|
+
resolve as resolve9
|
|
1580
|
+
} from "@ai-sdk/provider-utils";
|
|
1581
|
+
import { z as z12 } from "zod/v4";
|
|
1582
|
+
var GatewaySpeechModel = class {
|
|
1583
|
+
constructor(modelId, config) {
|
|
1584
|
+
this.modelId = modelId;
|
|
1585
|
+
this.config = config;
|
|
1586
|
+
this.specificationVersion = "v3";
|
|
1587
|
+
}
|
|
1588
|
+
get provider() {
|
|
1589
|
+
return this.config.provider;
|
|
1590
|
+
}
|
|
1591
|
+
async doGenerate({
|
|
1592
|
+
text,
|
|
1593
|
+
voice,
|
|
1594
|
+
outputFormat,
|
|
1595
|
+
instructions,
|
|
1596
|
+
speed,
|
|
1597
|
+
language,
|
|
1598
|
+
providerOptions,
|
|
1599
|
+
headers,
|
|
1600
|
+
abortSignal
|
|
1601
|
+
}) {
|
|
1602
|
+
var _a11;
|
|
1603
|
+
const resolvedHeaders = await resolve9(this.config.headers());
|
|
1604
|
+
try {
|
|
1605
|
+
const {
|
|
1606
|
+
responseHeaders,
|
|
1607
|
+
value: responseBody,
|
|
1608
|
+
rawValue
|
|
1609
|
+
} = await postJsonToApi6({
|
|
1610
|
+
url: this.getUrl(),
|
|
1611
|
+
headers: combineHeaders6(
|
|
1612
|
+
resolvedHeaders,
|
|
1613
|
+
headers != null ? headers : {},
|
|
1614
|
+
this.getModelConfigHeaders(),
|
|
1615
|
+
await resolve9(this.config.o11yHeaders)
|
|
1616
|
+
),
|
|
1617
|
+
body: {
|
|
1618
|
+
text,
|
|
1619
|
+
...voice && { voice },
|
|
1620
|
+
...outputFormat && { outputFormat },
|
|
1621
|
+
...instructions && { instructions },
|
|
1622
|
+
...speed != null && { speed },
|
|
1623
|
+
...language && { language },
|
|
1624
|
+
...providerOptions && { providerOptions }
|
|
1625
|
+
},
|
|
1626
|
+
successfulResponseHandler: createJsonResponseHandler8(
|
|
1627
|
+
gatewaySpeechResponseSchema
|
|
1628
|
+
),
|
|
1629
|
+
failedResponseHandler: createJsonErrorResponseHandler9({
|
|
1630
|
+
errorSchema: z12.any(),
|
|
1631
|
+
errorToMessage: (data) => data
|
|
1632
|
+
}),
|
|
1633
|
+
...abortSignal && { abortSignal },
|
|
1634
|
+
fetch: this.config.fetch
|
|
1635
|
+
});
|
|
1636
|
+
return {
|
|
1637
|
+
audio: responseBody.audio,
|
|
1638
|
+
warnings: (_a11 = responseBody.warnings) != null ? _a11 : [],
|
|
1639
|
+
providerMetadata: responseBody.providerMetadata,
|
|
1640
|
+
response: {
|
|
1641
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
1642
|
+
modelId: this.modelId,
|
|
1643
|
+
headers: responseHeaders,
|
|
1644
|
+
body: rawValue
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
} catch (error) {
|
|
1648
|
+
throw await asGatewayError(
|
|
1649
|
+
error,
|
|
1650
|
+
await parseAuthMethod(resolvedHeaders != null ? resolvedHeaders : {})
|
|
1651
|
+
);
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
getUrl() {
|
|
1655
|
+
return `${this.config.baseURL}/speech-model`;
|
|
1656
|
+
}
|
|
1657
|
+
getModelConfigHeaders() {
|
|
1658
|
+
return {
|
|
1659
|
+
"ai-speech-model-specification-version": "3",
|
|
1660
|
+
"ai-model-id": this.modelId
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
};
|
|
1664
|
+
var providerMetadataEntrySchema3 = z12.object({}).catchall(z12.unknown());
|
|
1665
|
+
var gatewaySpeechWarningSchema = z12.discriminatedUnion("type", [
|
|
1666
|
+
z12.object({
|
|
1667
|
+
type: z12.literal("unsupported"),
|
|
1668
|
+
feature: z12.string(),
|
|
1669
|
+
details: z12.string().optional()
|
|
1670
|
+
}),
|
|
1671
|
+
z12.object({
|
|
1672
|
+
type: z12.literal("compatibility"),
|
|
1673
|
+
feature: z12.string(),
|
|
1674
|
+
details: z12.string().optional()
|
|
1675
|
+
}),
|
|
1676
|
+
z12.object({
|
|
1677
|
+
type: z12.literal("other"),
|
|
1678
|
+
message: z12.string()
|
|
1679
|
+
})
|
|
1680
|
+
]);
|
|
1681
|
+
var gatewaySpeechResponseSchema = z12.object({
|
|
1682
|
+
audio: z12.string(),
|
|
1683
|
+
warnings: z12.array(gatewaySpeechWarningSchema).optional(),
|
|
1684
|
+
providerMetadata: z12.record(z12.string(), providerMetadataEntrySchema3).optional()
|
|
1685
|
+
});
|
|
1686
|
+
|
|
1687
|
+
// src/gateway-transcription-model.ts
|
|
1688
|
+
import {
|
|
1689
|
+
combineHeaders as combineHeaders7,
|
|
1690
|
+
convertUint8ArrayToBase64 as convertUint8ArrayToBase643,
|
|
1691
|
+
createJsonErrorResponseHandler as createJsonErrorResponseHandler10,
|
|
1692
|
+
createJsonResponseHandler as createJsonResponseHandler9,
|
|
1693
|
+
postJsonToApi as postJsonToApi7,
|
|
1694
|
+
resolve as resolve10
|
|
1695
|
+
} from "@ai-sdk/provider-utils";
|
|
1696
|
+
import { z as z13 } from "zod/v4";
|
|
1697
|
+
var GatewayTranscriptionModel = class {
|
|
1698
|
+
constructor(modelId, config) {
|
|
1699
|
+
this.modelId = modelId;
|
|
1700
|
+
this.config = config;
|
|
1701
|
+
this.specificationVersion = "v3";
|
|
1702
|
+
}
|
|
1703
|
+
get provider() {
|
|
1704
|
+
return this.config.provider;
|
|
1705
|
+
}
|
|
1706
|
+
async doGenerate({
|
|
1707
|
+
audio,
|
|
1708
|
+
mediaType,
|
|
1709
|
+
providerOptions,
|
|
1710
|
+
headers,
|
|
1711
|
+
abortSignal
|
|
1712
|
+
}) {
|
|
1713
|
+
var _a11, _b11, _c, _d;
|
|
1714
|
+
const resolvedHeaders = await resolve10(this.config.headers());
|
|
1715
|
+
try {
|
|
1716
|
+
const {
|
|
1717
|
+
responseHeaders,
|
|
1718
|
+
value: responseBody,
|
|
1719
|
+
rawValue
|
|
1720
|
+
} = await postJsonToApi7({
|
|
1721
|
+
url: this.getUrl(),
|
|
1722
|
+
headers: combineHeaders7(
|
|
1723
|
+
resolvedHeaders,
|
|
1724
|
+
headers != null ? headers : {},
|
|
1725
|
+
this.getModelConfigHeaders(),
|
|
1726
|
+
await resolve10(this.config.o11yHeaders)
|
|
1727
|
+
),
|
|
1728
|
+
body: {
|
|
1729
|
+
audio: audio instanceof Uint8Array ? convertUint8ArrayToBase643(audio) : audio,
|
|
1730
|
+
mediaType,
|
|
1731
|
+
...providerOptions && { providerOptions }
|
|
1732
|
+
},
|
|
1733
|
+
successfulResponseHandler: createJsonResponseHandler9(
|
|
1734
|
+
gatewayTranscriptionResponseSchema
|
|
1735
|
+
),
|
|
1736
|
+
failedResponseHandler: createJsonErrorResponseHandler10({
|
|
1737
|
+
errorSchema: z13.any(),
|
|
1738
|
+
errorToMessage: (data) => data
|
|
1739
|
+
}),
|
|
1740
|
+
...abortSignal && { abortSignal },
|
|
1741
|
+
fetch: this.config.fetch
|
|
1742
|
+
});
|
|
1743
|
+
return {
|
|
1744
|
+
text: responseBody.text,
|
|
1745
|
+
segments: (_a11 = responseBody.segments) != null ? _a11 : [],
|
|
1746
|
+
language: (_b11 = responseBody.language) != null ? _b11 : void 0,
|
|
1747
|
+
durationInSeconds: (_c = responseBody.durationInSeconds) != null ? _c : void 0,
|
|
1748
|
+
warnings: (_d = responseBody.warnings) != null ? _d : [],
|
|
1749
|
+
providerMetadata: responseBody.providerMetadata,
|
|
1750
|
+
response: {
|
|
1751
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
1752
|
+
modelId: this.modelId,
|
|
1753
|
+
headers: responseHeaders,
|
|
1754
|
+
body: rawValue
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1757
|
+
} catch (error) {
|
|
1758
|
+
throw await asGatewayError(
|
|
1759
|
+
error,
|
|
1760
|
+
await parseAuthMethod(resolvedHeaders != null ? resolvedHeaders : {})
|
|
1761
|
+
);
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
getUrl() {
|
|
1765
|
+
return `${this.config.baseURL}/transcription-model`;
|
|
1766
|
+
}
|
|
1767
|
+
getModelConfigHeaders() {
|
|
1768
|
+
return {
|
|
1769
|
+
"ai-transcription-model-specification-version": "3",
|
|
1770
|
+
"ai-model-id": this.modelId
|
|
1771
|
+
};
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
var providerMetadataEntrySchema4 = z13.object({}).catchall(z13.unknown());
|
|
1775
|
+
var gatewayTranscriptionWarningSchema = z13.discriminatedUnion("type", [
|
|
1776
|
+
z13.object({
|
|
1777
|
+
type: z13.literal("unsupported"),
|
|
1778
|
+
feature: z13.string(),
|
|
1779
|
+
details: z13.string().optional()
|
|
1780
|
+
}),
|
|
1781
|
+
z13.object({
|
|
1782
|
+
type: z13.literal("compatibility"),
|
|
1783
|
+
feature: z13.string(),
|
|
1784
|
+
details: z13.string().optional()
|
|
1785
|
+
}),
|
|
1786
|
+
z13.object({
|
|
1787
|
+
type: z13.literal("other"),
|
|
1788
|
+
message: z13.string()
|
|
1789
|
+
})
|
|
1790
|
+
]);
|
|
1791
|
+
var gatewayTranscriptionResponseSchema = z13.object({
|
|
1792
|
+
text: z13.string(),
|
|
1793
|
+
segments: z13.array(
|
|
1794
|
+
z13.object({
|
|
1795
|
+
text: z13.string(),
|
|
1796
|
+
startSecond: z13.number(),
|
|
1797
|
+
endSecond: z13.number()
|
|
1798
|
+
})
|
|
1799
|
+
).optional(),
|
|
1800
|
+
language: z13.string().nullish(),
|
|
1801
|
+
durationInSeconds: z13.number().nullish(),
|
|
1802
|
+
warnings: z13.array(gatewayTranscriptionWarningSchema).optional(),
|
|
1803
|
+
providerMetadata: z13.record(z13.string(), providerMetadataEntrySchema4).optional()
|
|
1804
|
+
});
|
|
1805
|
+
|
|
1571
1806
|
// src/tool/parallel-search.ts
|
|
1572
1807
|
import {
|
|
1573
1808
|
createProviderToolFactoryWithOutputSchema,
|
|
1574
1809
|
lazySchema as lazySchema9,
|
|
1575
1810
|
zodSchema as zodSchema9
|
|
1576
1811
|
} from "@ai-sdk/provider-utils";
|
|
1577
|
-
import { z as
|
|
1812
|
+
import { z as z14 } from "zod";
|
|
1578
1813
|
var parallelSearchInputSchema = lazySchema9(
|
|
1579
1814
|
() => zodSchema9(
|
|
1580
|
-
|
|
1581
|
-
objective:
|
|
1815
|
+
z14.object({
|
|
1816
|
+
objective: z14.string().describe(
|
|
1582
1817
|
"Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
|
|
1583
1818
|
),
|
|
1584
|
-
search_queries:
|
|
1819
|
+
search_queries: z14.array(z14.string()).optional().describe(
|
|
1585
1820
|
"Optional search queries to supplement the objective. Maximum 200 characters per query."
|
|
1586
1821
|
),
|
|
1587
|
-
mode:
|
|
1822
|
+
mode: z14.enum(["one-shot", "agentic"]).optional().describe(
|
|
1588
1823
|
'Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'
|
|
1589
1824
|
),
|
|
1590
|
-
max_results:
|
|
1825
|
+
max_results: z14.number().optional().describe(
|
|
1591
1826
|
"Maximum number of results to return (1-20). Defaults to 10 if not specified."
|
|
1592
1827
|
),
|
|
1593
|
-
source_policy:
|
|
1594
|
-
include_domains:
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1828
|
+
source_policy: z14.object({
|
|
1829
|
+
include_domains: z14.array(z14.string()).optional().describe(
|
|
1830
|
+
"Limit results to these domains. Use plain domain names only \u2014 e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page)."
|
|
1831
|
+
),
|
|
1832
|
+
exclude_domains: z14.array(z14.string()).optional().describe(
|
|
1833
|
+
"Exclude results from these domains. Use plain domain names only \u2014 e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page)."
|
|
1834
|
+
),
|
|
1835
|
+
after_date: z14.string().optional().describe(
|
|
1836
|
+
"Only include results published after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time."
|
|
1598
1837
|
)
|
|
1599
1838
|
}).optional().describe(
|
|
1600
1839
|
"Source policy for controlling which domains to include/exclude and freshness."
|
|
1601
1840
|
),
|
|
1602
|
-
excerpts:
|
|
1603
|
-
max_chars_per_result:
|
|
1604
|
-
max_chars_total:
|
|
1841
|
+
excerpts: z14.object({
|
|
1842
|
+
max_chars_per_result: z14.number().optional().describe("Maximum characters per result."),
|
|
1843
|
+
max_chars_total: z14.number().optional().describe("Maximum total characters across all results.")
|
|
1605
1844
|
}).optional().describe("Excerpt configuration for controlling result length."),
|
|
1606
|
-
fetch_policy:
|
|
1607
|
-
max_age_seconds:
|
|
1845
|
+
fetch_policy: z14.object({
|
|
1846
|
+
max_age_seconds: z14.number().optional().describe(
|
|
1608
1847
|
"Maximum age in seconds for cached content. Set to 0 to always fetch fresh content."
|
|
1609
1848
|
)
|
|
1610
1849
|
}).optional().describe("Fetch policy for controlling content freshness.")
|
|
@@ -1613,23 +1852,23 @@ var parallelSearchInputSchema = lazySchema9(
|
|
|
1613
1852
|
);
|
|
1614
1853
|
var parallelSearchOutputSchema = lazySchema9(
|
|
1615
1854
|
() => zodSchema9(
|
|
1616
|
-
|
|
1855
|
+
z14.union([
|
|
1617
1856
|
// Success response
|
|
1618
|
-
|
|
1619
|
-
searchId:
|
|
1620
|
-
results:
|
|
1621
|
-
|
|
1622
|
-
url:
|
|
1623
|
-
title:
|
|
1624
|
-
excerpt:
|
|
1625
|
-
publishDate:
|
|
1626
|
-
relevanceScore:
|
|
1857
|
+
z14.object({
|
|
1858
|
+
searchId: z14.string(),
|
|
1859
|
+
results: z14.array(
|
|
1860
|
+
z14.object({
|
|
1861
|
+
url: z14.string(),
|
|
1862
|
+
title: z14.string(),
|
|
1863
|
+
excerpt: z14.string(),
|
|
1864
|
+
publishDate: z14.string().nullable().optional(),
|
|
1865
|
+
relevanceScore: z14.number().optional()
|
|
1627
1866
|
})
|
|
1628
1867
|
)
|
|
1629
1868
|
}),
|
|
1630
1869
|
// Error response
|
|
1631
|
-
|
|
1632
|
-
error:
|
|
1870
|
+
z14.object({
|
|
1871
|
+
error: z14.enum([
|
|
1633
1872
|
"api_error",
|
|
1634
1873
|
"rate_limit",
|
|
1635
1874
|
"timeout",
|
|
@@ -1637,8 +1876,8 @@ var parallelSearchOutputSchema = lazySchema9(
|
|
|
1637
1876
|
"configuration_error",
|
|
1638
1877
|
"unknown"
|
|
1639
1878
|
]),
|
|
1640
|
-
statusCode:
|
|
1641
|
-
message:
|
|
1879
|
+
statusCode: z14.number().optional(),
|
|
1880
|
+
message: z14.string()
|
|
1642
1881
|
})
|
|
1643
1882
|
])
|
|
1644
1883
|
)
|
|
@@ -1656,44 +1895,44 @@ import {
|
|
|
1656
1895
|
lazySchema as lazySchema10,
|
|
1657
1896
|
zodSchema as zodSchema10
|
|
1658
1897
|
} from "@ai-sdk/provider-utils";
|
|
1659
|
-
import { z as
|
|
1898
|
+
import { z as z15 } from "zod";
|
|
1660
1899
|
var perplexitySearchInputSchema = lazySchema10(
|
|
1661
1900
|
() => zodSchema10(
|
|
1662
|
-
|
|
1663
|
-
query:
|
|
1901
|
+
z15.object({
|
|
1902
|
+
query: z15.union([z15.string(), z15.array(z15.string())]).describe(
|
|
1664
1903
|
"Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
|
|
1665
1904
|
),
|
|
1666
|
-
max_results:
|
|
1905
|
+
max_results: z15.number().optional().describe(
|
|
1667
1906
|
"Maximum number of search results to return (1-20, default: 10)"
|
|
1668
1907
|
),
|
|
1669
|
-
max_tokens_per_page:
|
|
1908
|
+
max_tokens_per_page: z15.number().optional().describe(
|
|
1670
1909
|
"Maximum number of tokens to extract per search result page (256-2048, default: 2048)"
|
|
1671
1910
|
),
|
|
1672
|
-
max_tokens:
|
|
1911
|
+
max_tokens: z15.number().optional().describe(
|
|
1673
1912
|
"Maximum total tokens across all search results (default: 25000, max: 1000000)"
|
|
1674
1913
|
),
|
|
1675
|
-
country:
|
|
1914
|
+
country: z15.string().optional().describe(
|
|
1676
1915
|
"Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"
|
|
1677
1916
|
),
|
|
1678
|
-
search_domain_filter:
|
|
1917
|
+
search_domain_filter: z15.array(z15.string()).optional().describe(
|
|
1679
1918
|
"List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"
|
|
1680
1919
|
),
|
|
1681
|
-
search_language_filter:
|
|
1920
|
+
search_language_filter: z15.array(z15.string()).optional().describe(
|
|
1682
1921
|
"List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"
|
|
1683
1922
|
),
|
|
1684
|
-
search_after_date:
|
|
1923
|
+
search_after_date: z15.string().optional().describe(
|
|
1685
1924
|
"Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
1686
1925
|
),
|
|
1687
|
-
search_before_date:
|
|
1926
|
+
search_before_date: z15.string().optional().describe(
|
|
1688
1927
|
"Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
1689
1928
|
),
|
|
1690
|
-
last_updated_after_filter:
|
|
1929
|
+
last_updated_after_filter: z15.string().optional().describe(
|
|
1691
1930
|
"Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
1692
1931
|
),
|
|
1693
|
-
last_updated_before_filter:
|
|
1932
|
+
last_updated_before_filter: z15.string().optional().describe(
|
|
1694
1933
|
"Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
1695
1934
|
),
|
|
1696
|
-
search_recency_filter:
|
|
1935
|
+
search_recency_filter: z15.enum(["day", "week", "month", "year"]).optional().describe(
|
|
1697
1936
|
"Filter results by relative time period. Cannot be used with search_after_date or search_before_date."
|
|
1698
1937
|
)
|
|
1699
1938
|
})
|
|
@@ -1701,31 +1940,31 @@ var perplexitySearchInputSchema = lazySchema10(
|
|
|
1701
1940
|
);
|
|
1702
1941
|
var perplexitySearchOutputSchema = lazySchema10(
|
|
1703
1942
|
() => zodSchema10(
|
|
1704
|
-
|
|
1943
|
+
z15.union([
|
|
1705
1944
|
// Success response
|
|
1706
|
-
|
|
1707
|
-
results:
|
|
1708
|
-
|
|
1709
|
-
title:
|
|
1710
|
-
url:
|
|
1711
|
-
snippet:
|
|
1712
|
-
date:
|
|
1713
|
-
lastUpdated:
|
|
1945
|
+
z15.object({
|
|
1946
|
+
results: z15.array(
|
|
1947
|
+
z15.object({
|
|
1948
|
+
title: z15.string(),
|
|
1949
|
+
url: z15.string(),
|
|
1950
|
+
snippet: z15.string(),
|
|
1951
|
+
date: z15.string().optional(),
|
|
1952
|
+
lastUpdated: z15.string().optional()
|
|
1714
1953
|
})
|
|
1715
1954
|
),
|
|
1716
|
-
id:
|
|
1955
|
+
id: z15.string()
|
|
1717
1956
|
}),
|
|
1718
1957
|
// Error response
|
|
1719
|
-
|
|
1720
|
-
error:
|
|
1958
|
+
z15.object({
|
|
1959
|
+
error: z15.enum([
|
|
1721
1960
|
"api_error",
|
|
1722
1961
|
"rate_limit",
|
|
1723
1962
|
"timeout",
|
|
1724
1963
|
"invalid_input",
|
|
1725
1964
|
"unknown"
|
|
1726
1965
|
]),
|
|
1727
|
-
statusCode:
|
|
1728
|
-
message:
|
|
1966
|
+
statusCode: z15.number().optional(),
|
|
1967
|
+
message: z15.string()
|
|
1729
1968
|
})
|
|
1730
1969
|
])
|
|
1731
1970
|
)
|
|
@@ -1767,7 +2006,7 @@ async function getVercelRequestId() {
|
|
|
1767
2006
|
}
|
|
1768
2007
|
|
|
1769
2008
|
// src/version.ts
|
|
1770
|
-
var VERSION = true ? "3.0.
|
|
2009
|
+
var VERSION = true ? "3.0.137" : "0.0.0-test";
|
|
1771
2010
|
|
|
1772
2011
|
// src/gateway-provider.ts
|
|
1773
2012
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
@@ -1947,6 +2186,28 @@ function createGatewayProvider(options = {}) {
|
|
|
1947
2186
|
};
|
|
1948
2187
|
provider.rerankingModel = createRerankingModel;
|
|
1949
2188
|
provider.reranking = createRerankingModel;
|
|
2189
|
+
const createSpeechModel = (modelId) => {
|
|
2190
|
+
return new GatewaySpeechModel(modelId, {
|
|
2191
|
+
provider: "gateway",
|
|
2192
|
+
baseURL,
|
|
2193
|
+
headers: getHeaders,
|
|
2194
|
+
fetch: options.fetch,
|
|
2195
|
+
o11yHeaders: createO11yHeaders()
|
|
2196
|
+
});
|
|
2197
|
+
};
|
|
2198
|
+
provider.speechModel = createSpeechModel;
|
|
2199
|
+
provider.speech = createSpeechModel;
|
|
2200
|
+
const createTranscriptionModel = (modelId) => {
|
|
2201
|
+
return new GatewayTranscriptionModel(modelId, {
|
|
2202
|
+
provider: "gateway",
|
|
2203
|
+
baseURL,
|
|
2204
|
+
headers: getHeaders,
|
|
2205
|
+
fetch: options.fetch,
|
|
2206
|
+
o11yHeaders: createO11yHeaders()
|
|
2207
|
+
});
|
|
2208
|
+
};
|
|
2209
|
+
provider.transcriptionModel = createTranscriptionModel;
|
|
2210
|
+
provider.transcription = createTranscriptionModel;
|
|
1950
2211
|
provider.chat = provider.languageModel;
|
|
1951
2212
|
provider.embedding = provider.embeddingModel;
|
|
1952
2213
|
provider.image = provider.imageModel;
|