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 toolindex_file
(optional) - Path to local.swsearch
index fileremote_url
(optional) - URL of remote search serverindex_name
(default: "default") - Index name on remote serverbuild_index
(default: False) - Auto-build index if missingsource_dir
(optional) - Source directory for auto-buildingcount
(default: 3) - Number of search results to returndistance_threshold
(default: 0.0) - Minimum similarity scoreresponse_prefix
(optional) - Text to prepend to responsesresponse_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.