@genkit-ai/dev-local-vectorstore

中文文档
1.44.0发布于 2026/11/04Apache-2.0TypeScriptESM + CJS近 30 天下载 5299

Genkit AI framework plugin for temporary local vector database.

原始使用文档

Dev Local Vector Store for Genkit

This is a simple implementation of a vector store that can be used to local development and testing.

Building with a coding agent? Install the Genkit JS skill first.

npx skills add genkit-ai/skills --skill developing-genkit-js

It teaches your agent the current Genkit JS APIs and common gotchas. Source, manual install and skills for other languages: genkit-ai/skills.

This plugin is not meant to be used in production.

Installing the plugin

npm i --save @genkit-ai/dev-local-vectorstore

Using the plugin

import { Document, genkit } from 'genkit';
import { googleAI } from '@genkit-ai/google-genai';
import {
  devLocalVectorstore,
  devLocalIndexerRef,
  devLocalRetrieverRef,
} from '@genkit-ai/dev-local-vectorstore';

const ai = genkit({
  plugins: [
    googleAI(),
    devLocalVectorstore([
      {
        indexName: 'BobFacts',
        embedder: googleAI.embedder('gemini-embedding-001'),
      },
    ]),
  ],
  model: googleAI.model('gemini-flash-latest'),
});

// Reference to a local vector database storing Genkit documentation
const indexer = devLocalIndexerRef('BobFacts');
const retriever = devLocalRetrieverRef('BobFacts');

async function main() {
  // Add documents to the index. Only do it once.
  await ai.index({
    indexer: indexer,
    documents: [
      Document.fromText('Bob lives on the moon.'),
      Document.fromText('Bob is 42 years old.'),
      Document.fromText('Bob likes bananas.'),
      Document.fromText('Bob has 11 cats.'),
    ],
  });

  const question = 'How old is Bob?';

  // Consistent API to retrieve most relevant documents based on semantic similarity to query
  const docs = await ai.retrieve({
    retriever: retriever,
    query: question,
  });

  const result = await ai.generate({
    prompt: `Use the provided context from the Genkit documentation to answer this query: ${question}`,
    docs, // Pass retrieved documents to the model
  });

  console.log(result.text);
}

main();

The sources for this package are in the main Genkit repo. Please file issues and pull requests against that repo.

Usage information and reference details can be found in official Genkit documentation.

License: Apache 2.0

版本与发布记录

@genkit-ai/dev-local-vectorstore 共发布 167 个版本,首次发布于 2024/04/05;过去 12 个月发布了 40 个版本。

版本发布日期距今
1.44.0latest2026/11/0412 天前
1.43.02026/10/2225 天前
1.43.0-rc.3next2026/10/2225 天前
1.43.0-rc.22026/10/2126 天前
1.43.0-rc.12026/10/091 个月前
1.43.0-rc.02026/10/091 个月前

关于 @genkit-ai/dev-local-vectorstore 的常见问题

@genkit-ai/dev-local-vectorstore 是什么?

Genkit AI framework plugin for temporary local vector database.

如何安装 @genkit-ai/dev-local-vectorstore?

在项目目录运行 npm install @genkit-ai/dev-local-vectorstore,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:genkit(^1.44.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@genkit-ai/dev-local-vectorstore 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@genkit-ai/dev-local-vectorstore 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@genkit-ai/dev-local-vectorstore 可以商用吗?

@genkit-ai/dev-local-vectorstore 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@genkit-ai/dev-local-vectorstore 的下载量有多少?

根据 npm 官方下载统计,@genkit-ai/dev-local-vectorstore 在 2026/10/16 – 2026/11/14 这 30 天内被下载 5,299 次,日均约 177 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@genkit-ai/dev-local-vectorstore 还在维护吗?

最新版本 1.44.0 发布于 2026/11/04(12 天前);至今共发布 167 个版本,其中过去 12 个月发布了 40 个;首次发布于 2024/04/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。