NativeVectorSearchSkill

View as MarkdownOpen in Claude

In-memory document search using TF-IDF-like word overlap scoring. No external dependencies or API keys required. Documents are provided via config and indexed at construction time.

Class: NativeVectorSearchSkill

Tools: search_documents

Env vars: None

Multi-instance: Yes

tool_name
string

Custom tool name for this instance. Required when using multiple instances.

documents
Record<string, unknown>[]

Array of documents to index. Each object has:

  • id (string, required) — Unique document identifier.
  • text (string, required) — Full text content of the document.
  • metadata (object, optional) — Metadata associated with the document.
num_results
numberDefaults to 3

Default number of top results to return.

distance_threshold
numberDefaults to 0

Minimum relevance score threshold.

1import { AgentBase, NativeVectorSearchSkill } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'assistant', route: '/assistant' });
4agent.setPromptText('You are a helpful assistant.');
5
6await agent.addSkill(new NativeVectorSearchSkill({
7 tool_name: 'search_faqs',
8 documents: [
9 { id: 'faq-1', text: 'To reset your password, visit the settings page...' },
10 { id: 'faq-2', text: 'Refund requests must be submitted within 30 days...' },
11 ],
12 num_results: 3,
13}));
14
15agent.run();