Skip to main content

Parameter Definitions

1. Full-Text Search Configuration

Full-text search combines traditional keyword-based search with vector similarity search. The configuration is defined in alita_sdk/runtime/tools/vectorstore.py:
Parameters:
  • enabled (bool): Activates full-text search
  • weight (float): Weight for text search scores (0.0-1.0), combined with vector scores
  • fields (list): Metadata fields to search (e.g., β€œcontent”, β€œtitle”, β€œdescription”)
  • language (str): Language for text search indexing (e.g., β€œenglish”, β€œspanish”)

2. Reranking Configuration

Reranking applies custom scoring rules to boost or demote search results based on metadata. Defined in both VectorStoreWrapper and VectorStoreWrapperBase:
Parameters:
  • field_name: Metadata field to apply rules to
  • weight (float): Score multiplier when rules match
  • rules:
    • contains (str): Boost if field contains this substring
    • priority (str): Boost if field exactly matches this value
    • sort (str): Sort direction (β€œasc” or β€œdesc”) based on field value
Extended search retrieves documents by searching across multiple chunk types (title, summary, propositions, keywords) and then fetching the full document chunks:
Valid chunk types:
  • "title": Search document titles
  • "summary": Search document summaries
  • "propositions": Search extracted propositions
  • "keywords": Search extracted keywords
  • "documents": Search full document chunks (default behavior)

How These Parameters Work Together

The search flow in VectorStoreWrapperBase.search_documents() processes these parameters sequentially:

Dynamic Usage Example: Agent Query

Here’s a comprehensive example showing how an agent can dynamically use these parameters:

Scenario: Searching Technical Documentation

User Query: β€œFind recent API authentication changes in the security documentation” Agent’s Dynamic Search Strategy:

How the Agent Determines Parameters

The agent analyzes the query to extract:
  1. Keywords for full-text search: β€œauthentication”, β€œsecurity”, β€œAPI”
  2. Temporal context: β€œrecent” β†’ sort by updated_on descending
  3. Document type hints: β€œdocumentation” β†’ filter by doc_type
  4. Semantic concepts: β€œchanges” β†’ use extended search to find summaries

Search Execution Flow

Implementation Details

Full-Text Search Implementation

The full-text search uses PostgreSQL’s full-text search capabilities via PGVectorSearch in alita_sdk/runtime/tools/pgvector_search.py:

Reranking Implementation

The reranking logic in _apply_reranking() method:

Extended Search Implementation

Extended search retrieves documents by searching specialized chunk types:

Agent Integration Example

Here’s how an agent would use these parameters in a real conversation:

Best Practices

  1. Full-Text Search Weight: Use 0.2-0.4 for balanced hybrid search
  2. Extended Search: Use for document discovery when you need context beyond exact matches
  3. Reranking: Apply multiple rules with decreasing weights (0.5, 0.3, 0.2)
  4. Cutoff Threshold: Use 0.5-0.7 for quality filtering
  5. Search Top: Request 2-3x desired results before filtering

πŸ“ Files Referenced:
  • alita_sdk/runtime/tools/vectorstore.py β€” Main vector search implementation with SearchDocumentsModel and VectorStoreWrapper class containing search logic
  • alita_sdk/runtime/tools/vectorstore_base.py β€” Base class VectorStoreWrapperBase with core search methods including search_documents(), _apply_reranking(), and extended search implementation
  • alita_sdk/tools/base_indexer_toolkit.py β€” BaseIndexerToolkit showing how search tools are exposed to agents via get_available_tools()
  • alita_sdk/tools/elitea_base.py β€” BaseVectorStoreToolApiWrapper demonstrating toolkit integration patterns