@ai-sdk/google 2.0.48 → 2.0.49
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 +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +82 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -49
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +11 -0
- package/dist/internal/index.d.ts +11 -0
- package/dist/internal/index.js +61 -30
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +71 -36
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
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 ? "2.0.
|
|
10
|
+
var VERSION = true ? "2.0.49" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -662,6 +662,17 @@ function prepareTools({
|
|
|
662
662
|
googleTools2.push({ googleSearchRetrieval: {} });
|
|
663
663
|
}
|
|
664
664
|
break;
|
|
665
|
+
case "google.enterprise_web_search":
|
|
666
|
+
if (isGemini2orNewer) {
|
|
667
|
+
googleTools2.push({ enterpriseWebSearch: {} });
|
|
668
|
+
} else {
|
|
669
|
+
toolWarnings.push({
|
|
670
|
+
type: "unsupported-tool",
|
|
671
|
+
tool,
|
|
672
|
+
details: "Enterprise Web Search requires Gemini 2.0 or newer."
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
break;
|
|
665
676
|
case "google.url_context":
|
|
666
677
|
if (isGemini2orNewer) {
|
|
667
678
|
googleTools2.push({ urlContext: {} });
|
|
@@ -1546,33 +1557,46 @@ var codeExecution = createProviderDefinedToolFactoryWithOutputSchema({
|
|
|
1546
1557
|
})
|
|
1547
1558
|
});
|
|
1548
1559
|
|
|
1549
|
-
// src/tool/
|
|
1560
|
+
// src/tool/enterprise-web-search.ts
|
|
1550
1561
|
import {
|
|
1551
1562
|
createProviderDefinedToolFactory,
|
|
1552
1563
|
lazySchema as lazySchema6,
|
|
1553
1564
|
zodSchema as zodSchema6
|
|
1554
1565
|
} from "@ai-sdk/provider-utils";
|
|
1555
1566
|
import { z as z7 } from "zod/v4";
|
|
1556
|
-
var
|
|
1567
|
+
var enterpriseWebSearch = createProviderDefinedToolFactory({
|
|
1568
|
+
id: "google.enterprise_web_search",
|
|
1569
|
+
name: "enterprise_web_search",
|
|
1570
|
+
inputSchema: lazySchema6(() => zodSchema6(z7.object({})))
|
|
1571
|
+
});
|
|
1572
|
+
|
|
1573
|
+
// src/tool/file-search.ts
|
|
1574
|
+
import {
|
|
1575
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
|
|
1576
|
+
lazySchema as lazySchema7,
|
|
1577
|
+
zodSchema as zodSchema7
|
|
1578
|
+
} from "@ai-sdk/provider-utils";
|
|
1579
|
+
import { z as z8 } from "zod/v4";
|
|
1580
|
+
var fileSearchArgsBaseSchema = z8.object({
|
|
1557
1581
|
/** The names of the file_search_stores to retrieve from.
|
|
1558
1582
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
1559
1583
|
*/
|
|
1560
|
-
fileSearchStoreNames:
|
|
1584
|
+
fileSearchStoreNames: z8.array(z8.string()).describe(
|
|
1561
1585
|
"The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
|
|
1562
1586
|
),
|
|
1563
1587
|
/** The number of file search retrieval chunks to retrieve. */
|
|
1564
|
-
topK:
|
|
1588
|
+
topK: z8.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
|
|
1565
1589
|
/** Metadata filter to apply to the file search retrieval documents.
|
|
1566
1590
|
* See https://google.aip.dev/160 for the syntax of the filter expression.
|
|
1567
1591
|
*/
|
|
1568
|
-
metadataFilter:
|
|
1592
|
+
metadataFilter: z8.string().describe(
|
|
1569
1593
|
"Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
|
|
1570
1594
|
).optional()
|
|
1571
1595
|
}).passthrough();
|
|
1572
|
-
var fileSearchArgsSchema =
|
|
1573
|
-
() =>
|
|
1596
|
+
var fileSearchArgsSchema = lazySchema7(
|
|
1597
|
+
() => zodSchema7(fileSearchArgsBaseSchema)
|
|
1574
1598
|
);
|
|
1575
|
-
var fileSearch =
|
|
1599
|
+
var fileSearch = createProviderDefinedToolFactory2({
|
|
1576
1600
|
id: "google.file_search",
|
|
1577
1601
|
name: "file_search",
|
|
1578
1602
|
inputSchema: fileSearchArgsSchema
|
|
@@ -1580,32 +1604,32 @@ var fileSearch = createProviderDefinedToolFactory({
|
|
|
1580
1604
|
|
|
1581
1605
|
// src/tool/google-maps.ts
|
|
1582
1606
|
import {
|
|
1583
|
-
createProviderDefinedToolFactory as
|
|
1584
|
-
lazySchema as
|
|
1585
|
-
zodSchema as
|
|
1607
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory3,
|
|
1608
|
+
lazySchema as lazySchema8,
|
|
1609
|
+
zodSchema as zodSchema8
|
|
1586
1610
|
} from "@ai-sdk/provider-utils";
|
|
1587
|
-
import { z as
|
|
1588
|
-
var googleMaps =
|
|
1611
|
+
import { z as z9 } from "zod/v4";
|
|
1612
|
+
var googleMaps = createProviderDefinedToolFactory3({
|
|
1589
1613
|
id: "google.google_maps",
|
|
1590
1614
|
name: "google_maps",
|
|
1591
|
-
inputSchema:
|
|
1615
|
+
inputSchema: lazySchema8(() => zodSchema8(z9.object({})))
|
|
1592
1616
|
});
|
|
1593
1617
|
|
|
1594
1618
|
// src/tool/google-search.ts
|
|
1595
1619
|
import {
|
|
1596
|
-
createProviderDefinedToolFactory as
|
|
1597
|
-
lazySchema as
|
|
1598
|
-
zodSchema as
|
|
1620
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory4,
|
|
1621
|
+
lazySchema as lazySchema9,
|
|
1622
|
+
zodSchema as zodSchema9
|
|
1599
1623
|
} from "@ai-sdk/provider-utils";
|
|
1600
|
-
import { z as
|
|
1601
|
-
var googleSearch =
|
|
1624
|
+
import { z as z10 } from "zod/v4";
|
|
1625
|
+
var googleSearch = createProviderDefinedToolFactory4({
|
|
1602
1626
|
id: "google.google_search",
|
|
1603
1627
|
name: "google_search",
|
|
1604
|
-
inputSchema:
|
|
1605
|
-
() =>
|
|
1606
|
-
|
|
1607
|
-
mode:
|
|
1608
|
-
dynamicThreshold:
|
|
1628
|
+
inputSchema: lazySchema9(
|
|
1629
|
+
() => zodSchema9(
|
|
1630
|
+
z10.object({
|
|
1631
|
+
mode: z10.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
|
1632
|
+
dynamicThreshold: z10.number().default(1)
|
|
1609
1633
|
})
|
|
1610
1634
|
)
|
|
1611
1635
|
)
|
|
@@ -1613,26 +1637,26 @@ var googleSearch = createProviderDefinedToolFactory3({
|
|
|
1613
1637
|
|
|
1614
1638
|
// src/tool/url-context.ts
|
|
1615
1639
|
import {
|
|
1616
|
-
createProviderDefinedToolFactory as
|
|
1617
|
-
lazySchema as
|
|
1618
|
-
zodSchema as
|
|
1640
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory5,
|
|
1641
|
+
lazySchema as lazySchema10,
|
|
1642
|
+
zodSchema as zodSchema10
|
|
1619
1643
|
} from "@ai-sdk/provider-utils";
|
|
1620
|
-
import { z as
|
|
1621
|
-
var urlContext =
|
|
1644
|
+
import { z as z11 } from "zod/v4";
|
|
1645
|
+
var urlContext = createProviderDefinedToolFactory5({
|
|
1622
1646
|
id: "google.url_context",
|
|
1623
1647
|
name: "url_context",
|
|
1624
|
-
inputSchema:
|
|
1648
|
+
inputSchema: lazySchema10(() => zodSchema10(z11.object({})))
|
|
1625
1649
|
});
|
|
1626
1650
|
|
|
1627
1651
|
// src/tool/vertex-rag-store.ts
|
|
1628
|
-
import { createProviderDefinedToolFactory as
|
|
1629
|
-
import { z as
|
|
1630
|
-
var vertexRagStore =
|
|
1652
|
+
import { createProviderDefinedToolFactory as createProviderDefinedToolFactory6 } from "@ai-sdk/provider-utils";
|
|
1653
|
+
import { z as z12 } from "zod/v4";
|
|
1654
|
+
var vertexRagStore = createProviderDefinedToolFactory6({
|
|
1631
1655
|
id: "google.vertex_rag_store",
|
|
1632
1656
|
name: "vertex_rag_store",
|
|
1633
|
-
inputSchema:
|
|
1634
|
-
ragCorpus:
|
|
1635
|
-
topK:
|
|
1657
|
+
inputSchema: z12.object({
|
|
1658
|
+
ragCorpus: z12.string(),
|
|
1659
|
+
topK: z12.number().optional()
|
|
1636
1660
|
})
|
|
1637
1661
|
});
|
|
1638
1662
|
|
|
@@ -1643,6 +1667,17 @@ var googleTools = {
|
|
|
1643
1667
|
* Must have name "google_search".
|
|
1644
1668
|
*/
|
|
1645
1669
|
googleSearch,
|
|
1670
|
+
/**
|
|
1671
|
+
* Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
|
|
1672
|
+
* Designed for highly-regulated industries (finance, healthcare, public sector).
|
|
1673
|
+
* Does not log customer data and supports VPC service controls.
|
|
1674
|
+
* Must have name "enterprise_web_search".
|
|
1675
|
+
*
|
|
1676
|
+
* @note Only available on Vertex AI. Requires Gemini 2.0 or newer.
|
|
1677
|
+
*
|
|
1678
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
|
|
1679
|
+
*/
|
|
1680
|
+
enterpriseWebSearch,
|
|
1646
1681
|
/**
|
|
1647
1682
|
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
1648
1683
|
* Must have name "google_maps".
|
|
@@ -1689,13 +1724,13 @@ var googleTools = {
|
|
|
1689
1724
|
import {
|
|
1690
1725
|
combineHeaders as combineHeaders3,
|
|
1691
1726
|
createJsonResponseHandler as createJsonResponseHandler3,
|
|
1692
|
-
lazySchema as
|
|
1727
|
+
lazySchema as lazySchema11,
|
|
1693
1728
|
parseProviderOptions as parseProviderOptions3,
|
|
1694
1729
|
postJsonToApi as postJsonToApi3,
|
|
1695
1730
|
resolve as resolve3,
|
|
1696
|
-
zodSchema as
|
|
1731
|
+
zodSchema as zodSchema11
|
|
1697
1732
|
} from "@ai-sdk/provider-utils";
|
|
1698
|
-
import { z as
|
|
1733
|
+
import { z as z13 } from "zod/v4";
|
|
1699
1734
|
var GoogleGenerativeAIImageModel = class {
|
|
1700
1735
|
constructor(modelId, settings, config) {
|
|
1701
1736
|
this.modelId = modelId;
|
|
@@ -1787,18 +1822,18 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
1787
1822
|
};
|
|
1788
1823
|
}
|
|
1789
1824
|
};
|
|
1790
|
-
var googleImageResponseSchema =
|
|
1791
|
-
() =>
|
|
1792
|
-
|
|
1793
|
-
predictions:
|
|
1825
|
+
var googleImageResponseSchema = lazySchema11(
|
|
1826
|
+
() => zodSchema11(
|
|
1827
|
+
z13.object({
|
|
1828
|
+
predictions: z13.array(z13.object({ bytesBase64Encoded: z13.string() })).default([])
|
|
1794
1829
|
})
|
|
1795
1830
|
)
|
|
1796
1831
|
);
|
|
1797
|
-
var googleImageProviderOptionsSchema =
|
|
1798
|
-
() =>
|
|
1799
|
-
|
|
1800
|
-
personGeneration:
|
|
1801
|
-
aspectRatio:
|
|
1832
|
+
var googleImageProviderOptionsSchema = lazySchema11(
|
|
1833
|
+
() => zodSchema11(
|
|
1834
|
+
z13.object({
|
|
1835
|
+
personGeneration: z13.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
1836
|
+
aspectRatio: z13.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
|
|
1802
1837
|
})
|
|
1803
1838
|
)
|
|
1804
1839
|
);
|