Skip to main content

Vector search

Use the native_vector_search skill to search local document collections using vector similarity and keyword search.

Requirements:

  • Packages: sentence-transformers, scikit-learn, numpy
  • Install with: pip install signalwire-agents[search]

Parameters:

  • tool_name (default: "search_knowledge") - Custom name for the search tool
  • index_file (optional) - Path to local .swsearch index file
  • remote_url (optional) - URL of remote search server
  • index_name (default: "default") - Index name on remote server
  • build_index (default: False) - Auto-build index if missing
  • source_dir (optional) - Source directory for auto-building
  • count (default: 3) - Number of search results to return
  • distance_threshold (default: 0.0) - Minimum similarity score
  • response_prefix (optional) - Text to prepend to responses
  • response_postfix (optional) - Text to append to responses

Tools provided:

  • search_knowledge(query, count) - Search documents with hybrid vector/keyword search

Usage examples:

# Local mode with auto-build from concepts guide
agent.add_skill("native_vector_search", {
"tool_name": "search_docs",
"build_index": True,
"source_dir": "./docs", # Will build from directory
"index_file": "concepts.swsearch"
})

# Or build from specific concepts guide file
agent.add_skill("native_vector_search", {
"tool_name": "search_concepts",
"index_file": "concepts.swsearch" # Pre-built from concepts guide
})

# Remote mode
agent.add_skill("native_vector_search", {
"remote_url": "http://localhost:8001",
"index_name": "knowledge"
})

# Multiple instances for different document collections
agent.add_skill("native_vector_search", {
"tool_name": "search_examples",
"index_file": "examples.swsearch"
})

For complete documentation, see Local Search System.