Description
Describe the bug
The documentation in the vertex genkit plugin seems to be in conflict with what actually occurs in the code for the use of VertexAI retrieval.
The plugin has this comment above the Vertex retrieval options:
/**
* Vertex retrieval options.
*
* E.g.
*
* ```js
* config: {
* vertexRetrieval: {
* datastore: {
* projectId: 'your-cloud-project',
* location: 'us-central1',
* collection: 'your-collection',
* },
* disableAttribution: true,
* }
* }
* ```
*/
and the zod shows:
const VertexRetrievalSchema = z.object({
datastore: z
.object({
projectId: z.string().describe('Google Cloud Project ID.').optional(),
location: z
.string()
.describe('Google Cloud region e.g. us-central1.')
.optional(),
dataStoreId: z
.string()
.describe(
'The data store id, when project id and location are provided as ' +
'separate options. Alternatively, the full path to the data ' +
'store should be provided in the form: "projects/{project}/' +
'locations/{location}/collections/default_collection/dataStores/{data_store}".'
),
})
.describe('Vertex AI Search data store details'),
disableAttribution: z
.boolean()
.describe(
'Disable using the search data in detecting grounding attribution. This ' +
'does not affect how the result is given to the model for generation.'
)
.optional(),
});
But the actual code is written as:
if (vertexRetrieval) {
if (!updatedChatRequest.tools) updatedChatRequest.tools = [];
const _projectId =
vertexRetrieval.datastore.projectId || options.projectId;
const _location =
vertexRetrieval.datastore.location || options.location;
const _dataStoreId = vertexRetrieval.datastore.dataStoreId;
const datastore = `projects/${_projectId}/locations/${_location}/collections/default_collection/dataStores/${_dataStoreId}`;
updatedChatRequest.tools.push({
retrieval: {
vertexAiSearch: {
datastore,
},
disableAttribution: vertexRetrieval.disableAttribution,
},
});
}
The property collection doesn't seem to exist and there's no alternative to pass in the full path to the dataStore.
Also according to the Generative AI Grounding with Vertex AI Search documentation, grounding with Vertex AI only works with the version 2 models
Gemini 2.5 Flash with Live API native Audio preview
Gemini 2.0 Flash with Live API preview
Gemini 2.5 Pro preview
Gemini 2.5 Flash preview
Gemini 2.0 Flash
and it should be passed in as a tool like so (which the if-statement admittedly creates):
"tools": [{
"retrieval": {
"vertexAiSearch": {
"datastore": projects/PROJECT_ID/locations/global/collections/default_collection/dataStores/DATA_STORE_ID
}
}
}]
To Reproduce
Read the genk/js/plugins/vertexai/src/gemini.ts source code.
Expected behavior
That the Vertex AI plugin follows the procedures outline in the official documentation for Vertex AI.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status