vercelTool
vercelTool(
options):Tool<{query:string; },string>
Defined in: packages/providers/vercel/src/vercelTool.ts:56
Creates a Vercel AI SDK tool from a vectorstores retriever.
This adapter allows you to use a vectorstores retriever as a tool
in Vercel AI SDK’s streamText, generateText, or agent workflows.
Parameters
Section titled “Parameters”options
Section titled “options”Configuration for the tool
Returns
Section titled “Returns”Tool<{ query: string; }, string>
A Vercel AI SDK tool that can be used with streamText/generateText
Example
Section titled “Example”import { openai } from "@ai-sdk/openai";import { streamText, stepCountIs } from "ai";import { vercelTool } from "@vectorstores/vercel";
const retriever = index.asRetriever();
const result = await streamText({ model: openai.chat("gpt-4o-mini"), prompt: "What are the key concepts in AI?", tools: { queryKnowledge: vercelTool({ retriever, description: "Search the AI knowledge base for information.", }), }, stopWhen: stepCountIs(5),});