@spokest/vercel-ai
v1.0.0
Published
Vercel AI SDK tools for Spokest Brain memory
Downloads
18
Maintainers
Readme
@spokest/vercel-ai
Vercel AI SDK tools for Spokest Brain memory. Give your AI applications persistent, associative memory with two simple tools.
Install
npm install @spokest/vercel-ai ai zodUsage
import { openai } from '@ai-sdk/openai';
import { generateText } from 'ai';
import { createMemoryTools } from '@spokest/vercel-ai';
const [recallMemory, storeMemory] = createMemoryTools({
apiKey: 'sk-your-spokest-api-key',
baseUrl: 'https://brain-api.spokest.com', // optional, this is the default
});
const result = await generateText({
model: openai('gpt-4o'),
tools: { recallMemory, storeMemory },
prompt: 'What do you remember about our product roadmap?',
});
console.log(result.text);Tools
recall_memory
Retrieves relevant memories from Spokest Brain based on a semantic query.
Input:
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| query | string | yes | The search query |
| maxResults | number | no | Max memories to return |
store_memory
Stores a new memory in Spokest Brain.
Input:
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| text | string | yes | The text to store |
| importance | number | no | Importance score (0-1) |
| topics | string[] | no | Topic tags |
Configuration
| Parameter | Default | Description |
|-----------|---------|-------------|
| apiKey | (required) | Your Spokest Brain API key |
| baseUrl | https://brain-api.spokest.com | Brain API base URL |
License
MIT
