@ai-sdk/google 3.0.0-beta.78 → 3.0.0-beta.81
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 +21 -0
- package/dist/index.d.mts +27 -2
- package/dist/index.d.ts +27 -2
- package/dist/index.js +84 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -50
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +12 -1
- package/dist/internal/index.d.ts +12 -1
- package/dist/internal/index.js +61 -31
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +71 -37
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "3.0.0-beta.
|
|
10
|
+
var VERSION = true ? "3.0.0-beta.81" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -531,7 +531,7 @@ var googleGenerativeAIProviderOptions = lazySchema4(
|
|
|
531
531
|
thinkingBudget: z4.number().optional(),
|
|
532
532
|
includeThoughts: z4.boolean().optional(),
|
|
533
533
|
// https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level
|
|
534
|
-
thinkingLevel: z4.enum(["low", "medium", "high"]).optional()
|
|
534
|
+
thinkingLevel: z4.enum(["minimal", "low", "medium", "high"]).optional()
|
|
535
535
|
}).optional(),
|
|
536
536
|
/**
|
|
537
537
|
* Optional.
|
|
@@ -690,6 +690,17 @@ function prepareTools({
|
|
|
690
690
|
googleTools2.push({ googleSearchRetrieval: {} });
|
|
691
691
|
}
|
|
692
692
|
break;
|
|
693
|
+
case "google.enterprise_web_search":
|
|
694
|
+
if (isGemini2orNewer) {
|
|
695
|
+
googleTools2.push({ enterpriseWebSearch: {} });
|
|
696
|
+
} else {
|
|
697
|
+
toolWarnings.push({
|
|
698
|
+
type: "unsupported",
|
|
699
|
+
feature: `provider-defined tool ${tool.id}`,
|
|
700
|
+
details: "Enterprise Web Search requires Gemini 2.0 or newer."
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
break;
|
|
693
704
|
case "google.url_context":
|
|
694
705
|
if (isGemini2orNewer) {
|
|
695
706
|
googleTools2.push({ urlContext: {} });
|
|
@@ -1594,63 +1605,75 @@ var codeExecution = createProviderToolFactoryWithOutputSchema({
|
|
|
1594
1605
|
})
|
|
1595
1606
|
});
|
|
1596
1607
|
|
|
1597
|
-
// src/tool/
|
|
1608
|
+
// src/tool/enterprise-web-search.ts
|
|
1598
1609
|
import {
|
|
1599
1610
|
createProviderToolFactory,
|
|
1600
1611
|
lazySchema as lazySchema6,
|
|
1601
1612
|
zodSchema as zodSchema6
|
|
1602
1613
|
} from "@ai-sdk/provider-utils";
|
|
1603
1614
|
import { z as z7 } from "zod/v4";
|
|
1604
|
-
var
|
|
1615
|
+
var enterpriseWebSearch = createProviderToolFactory({
|
|
1616
|
+
id: "google.enterprise_web_search",
|
|
1617
|
+
inputSchema: lazySchema6(() => zodSchema6(z7.object({})))
|
|
1618
|
+
});
|
|
1619
|
+
|
|
1620
|
+
// src/tool/file-search.ts
|
|
1621
|
+
import {
|
|
1622
|
+
createProviderToolFactory as createProviderToolFactory2,
|
|
1623
|
+
lazySchema as lazySchema7,
|
|
1624
|
+
zodSchema as zodSchema7
|
|
1625
|
+
} from "@ai-sdk/provider-utils";
|
|
1626
|
+
import { z as z8 } from "zod/v4";
|
|
1627
|
+
var fileSearchArgsBaseSchema = z8.object({
|
|
1605
1628
|
/** The names of the file_search_stores to retrieve from.
|
|
1606
1629
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
1607
1630
|
*/
|
|
1608
|
-
fileSearchStoreNames:
|
|
1631
|
+
fileSearchStoreNames: z8.array(z8.string()).describe(
|
|
1609
1632
|
"The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
|
|
1610
1633
|
),
|
|
1611
1634
|
/** The number of file search retrieval chunks to retrieve. */
|
|
1612
|
-
topK:
|
|
1635
|
+
topK: z8.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
|
|
1613
1636
|
/** Metadata filter to apply to the file search retrieval documents.
|
|
1614
1637
|
* See https://google.aip.dev/160 for the syntax of the filter expression.
|
|
1615
1638
|
*/
|
|
1616
|
-
metadataFilter:
|
|
1639
|
+
metadataFilter: z8.string().describe(
|
|
1617
1640
|
"Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
|
|
1618
1641
|
).optional()
|
|
1619
1642
|
}).passthrough();
|
|
1620
|
-
var fileSearchArgsSchema =
|
|
1621
|
-
() =>
|
|
1643
|
+
var fileSearchArgsSchema = lazySchema7(
|
|
1644
|
+
() => zodSchema7(fileSearchArgsBaseSchema)
|
|
1622
1645
|
);
|
|
1623
|
-
var fileSearch =
|
|
1646
|
+
var fileSearch = createProviderToolFactory2({
|
|
1624
1647
|
id: "google.file_search",
|
|
1625
1648
|
inputSchema: fileSearchArgsSchema
|
|
1626
1649
|
});
|
|
1627
1650
|
|
|
1628
1651
|
// src/tool/google-maps.ts
|
|
1629
1652
|
import {
|
|
1630
|
-
createProviderToolFactory as
|
|
1631
|
-
lazySchema as
|
|
1632
|
-
zodSchema as
|
|
1653
|
+
createProviderToolFactory as createProviderToolFactory3,
|
|
1654
|
+
lazySchema as lazySchema8,
|
|
1655
|
+
zodSchema as zodSchema8
|
|
1633
1656
|
} from "@ai-sdk/provider-utils";
|
|
1634
|
-
import { z as
|
|
1635
|
-
var googleMaps =
|
|
1657
|
+
import { z as z9 } from "zod/v4";
|
|
1658
|
+
var googleMaps = createProviderToolFactory3({
|
|
1636
1659
|
id: "google.google_maps",
|
|
1637
|
-
inputSchema:
|
|
1660
|
+
inputSchema: lazySchema8(() => zodSchema8(z9.object({})))
|
|
1638
1661
|
});
|
|
1639
1662
|
|
|
1640
1663
|
// src/tool/google-search.ts
|
|
1641
1664
|
import {
|
|
1642
|
-
createProviderToolFactory as
|
|
1643
|
-
lazySchema as
|
|
1644
|
-
zodSchema as
|
|
1665
|
+
createProviderToolFactory as createProviderToolFactory4,
|
|
1666
|
+
lazySchema as lazySchema9,
|
|
1667
|
+
zodSchema as zodSchema9
|
|
1645
1668
|
} from "@ai-sdk/provider-utils";
|
|
1646
|
-
import { z as
|
|
1647
|
-
var googleSearch =
|
|
1669
|
+
import { z as z10 } from "zod/v4";
|
|
1670
|
+
var googleSearch = createProviderToolFactory4({
|
|
1648
1671
|
id: "google.google_search",
|
|
1649
|
-
inputSchema:
|
|
1650
|
-
() =>
|
|
1651
|
-
|
|
1652
|
-
mode:
|
|
1653
|
-
dynamicThreshold:
|
|
1672
|
+
inputSchema: lazySchema9(
|
|
1673
|
+
() => zodSchema9(
|
|
1674
|
+
z10.object({
|
|
1675
|
+
mode: z10.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
|
1676
|
+
dynamicThreshold: z10.number().default(1)
|
|
1654
1677
|
})
|
|
1655
1678
|
)
|
|
1656
1679
|
)
|
|
@@ -1658,24 +1681,24 @@ var googleSearch = createProviderToolFactory3({
|
|
|
1658
1681
|
|
|
1659
1682
|
// src/tool/url-context.ts
|
|
1660
1683
|
import {
|
|
1661
|
-
createProviderToolFactory as
|
|
1662
|
-
lazySchema as
|
|
1663
|
-
zodSchema as
|
|
1684
|
+
createProviderToolFactory as createProviderToolFactory5,
|
|
1685
|
+
lazySchema as lazySchema10,
|
|
1686
|
+
zodSchema as zodSchema10
|
|
1664
1687
|
} from "@ai-sdk/provider-utils";
|
|
1665
|
-
import { z as
|
|
1666
|
-
var urlContext =
|
|
1688
|
+
import { z as z11 } from "zod/v4";
|
|
1689
|
+
var urlContext = createProviderToolFactory5({
|
|
1667
1690
|
id: "google.url_context",
|
|
1668
|
-
inputSchema:
|
|
1691
|
+
inputSchema: lazySchema10(() => zodSchema10(z11.object({})))
|
|
1669
1692
|
});
|
|
1670
1693
|
|
|
1671
1694
|
// src/tool/vertex-rag-store.ts
|
|
1672
|
-
import { createProviderToolFactory as
|
|
1673
|
-
import { z as
|
|
1674
|
-
var vertexRagStore =
|
|
1695
|
+
import { createProviderToolFactory as createProviderToolFactory6 } from "@ai-sdk/provider-utils";
|
|
1696
|
+
import { z as z12 } from "zod/v4";
|
|
1697
|
+
var vertexRagStore = createProviderToolFactory6({
|
|
1675
1698
|
id: "google.vertex_rag_store",
|
|
1676
|
-
inputSchema:
|
|
1677
|
-
ragCorpus:
|
|
1678
|
-
topK:
|
|
1699
|
+
inputSchema: z12.object({
|
|
1700
|
+
ragCorpus: z12.string(),
|
|
1701
|
+
topK: z12.number().optional()
|
|
1679
1702
|
})
|
|
1680
1703
|
});
|
|
1681
1704
|
|
|
@@ -1686,6 +1709,17 @@ var googleTools = {
|
|
|
1686
1709
|
* Must have name "google_search".
|
|
1687
1710
|
*/
|
|
1688
1711
|
googleSearch,
|
|
1712
|
+
/**
|
|
1713
|
+
* Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
|
|
1714
|
+
* Designed for highly-regulated industries (finance, healthcare, public sector).
|
|
1715
|
+
* Does not log customer data and supports VPC service controls.
|
|
1716
|
+
* Must have name "enterprise_web_search".
|
|
1717
|
+
*
|
|
1718
|
+
* @note Only available on Vertex AI. Requires Gemini 2.0 or newer.
|
|
1719
|
+
*
|
|
1720
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
|
|
1721
|
+
*/
|
|
1722
|
+
enterpriseWebSearch,
|
|
1689
1723
|
/**
|
|
1690
1724
|
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
1691
1725
|
* Must have name "google_maps".
|
|
@@ -1732,13 +1766,13 @@ var googleTools = {
|
|
|
1732
1766
|
import {
|
|
1733
1767
|
combineHeaders as combineHeaders3,
|
|
1734
1768
|
createJsonResponseHandler as createJsonResponseHandler3,
|
|
1735
|
-
lazySchema as
|
|
1769
|
+
lazySchema as lazySchema11,
|
|
1736
1770
|
parseProviderOptions as parseProviderOptions3,
|
|
1737
1771
|
postJsonToApi as postJsonToApi3,
|
|
1738
1772
|
resolve as resolve3,
|
|
1739
|
-
zodSchema as
|
|
1773
|
+
zodSchema as zodSchema11
|
|
1740
1774
|
} from "@ai-sdk/provider-utils";
|
|
1741
|
-
import { z as
|
|
1775
|
+
import { z as z13 } from "zod/v4";
|
|
1742
1776
|
var GoogleGenerativeAIImageModel = class {
|
|
1743
1777
|
constructor(modelId, settings, config) {
|
|
1744
1778
|
this.modelId = modelId;
|
|
@@ -1830,18 +1864,18 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
1830
1864
|
};
|
|
1831
1865
|
}
|
|
1832
1866
|
};
|
|
1833
|
-
var googleImageResponseSchema =
|
|
1834
|
-
() =>
|
|
1835
|
-
|
|
1836
|
-
predictions:
|
|
1867
|
+
var googleImageResponseSchema = lazySchema11(
|
|
1868
|
+
() => zodSchema11(
|
|
1869
|
+
z13.object({
|
|
1870
|
+
predictions: z13.array(z13.object({ bytesBase64Encoded: z13.string() })).default([])
|
|
1837
1871
|
})
|
|
1838
1872
|
)
|
|
1839
1873
|
);
|
|
1840
|
-
var googleImageProviderOptionsSchema =
|
|
1841
|
-
() =>
|
|
1842
|
-
|
|
1843
|
-
personGeneration:
|
|
1844
|
-
aspectRatio:
|
|
1874
|
+
var googleImageProviderOptionsSchema = lazySchema11(
|
|
1875
|
+
() => zodSchema11(
|
|
1876
|
+
z13.object({
|
|
1877
|
+
personGeneration: z13.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
1878
|
+
aspectRatio: z13.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
|
|
1845
1879
|
})
|
|
1846
1880
|
)
|
|
1847
1881
|
);
|
|
@@ -1910,6 +1944,8 @@ function createGoogleGenerativeAI(options = {}) {
|
|
|
1910
1944
|
provider.generativeAI = createChatModel;
|
|
1911
1945
|
provider.embedding = createEmbeddingModel;
|
|
1912
1946
|
provider.embeddingModel = createEmbeddingModel;
|
|
1947
|
+
provider.textEmbedding = createEmbeddingModel;
|
|
1948
|
+
provider.textEmbeddingModel = createEmbeddingModel;
|
|
1913
1949
|
provider.image = createImageModel;
|
|
1914
1950
|
provider.imageModel = createImageModel;
|
|
1915
1951
|
provider.tools = googleTools;
|