Executor
class serves as the abstract foundation for all execution engines in Superlinked. It defines the interface for running queries against indexed data and managing the complete execution pipeline from data sources to vector databases.
Constructor
Parameters
One or more data sources that provide the data to be indexed and queried. Can be a single source or a sequence of sources.
One or more indices that define the vector spaces and organization of the data. Can be a single index or a sequence of indices.
The vector database implementation that will store and manage the vectorized data for efficient retrieval.
The execution context that provides runtime configuration and environment-specific settings.
Inheritance Hierarchy
TheExecutor
class serves as the base for all execution engine implementations:
Inheritance Chain: Executor
→ ABC
→ Generic
Available Implementations
Development Executors
Development Executors
- InMemoryExecutor - In-memory execution for development and testing
- InteractiveExecutor - Interactive execution with real-time data ingestion
Production Executors
Production Executors
- RestExecutor - REST API execution for production deployments
- QueryExecutor - Specialized query execution engine
Methods
run()
Execute the configured pipeline and return a running application instance.App
configured with the executor’s sources, indices, and vector database.
This abstract method must be implemented by concrete executor classes to define their specific execution strategy and return the appropriate application type.
Execution Pipeline
All executors manage a consistent execution pipeline:- Source Configuration: Initialize and configure data sources
- Index Setup: Prepare vector spaces and indexing strategies
- Vector Database Integration: Connect to the specified vector database
- Context Application: Apply execution context settings
- Application Creation: Return a configured application instance
Executor Types and Use Cases
Development Executors
InMemoryExecutor: Designed for development, testing, and prototyping with in-memory data storage and processing. InteractiveExecutor: Enables interactive development with real-time data ingestion and immediate query execution.Production Executors
RestExecutor: Built for production REST API deployments with scalable request handling and robust error management. QueryExecutor: Specialized for complex query processing scenarios with advanced optimization capabilities.Design Patterns
Configuration Management
Executors follow a builder pattern for configuration:- Sources: Define data input strategies
- Indices: Specify vector organization and spaces
- Vector Database: Configure storage and retrieval
- Context: Provide runtime settings
Execution Strategy
Each executor implementation provides:- Specific Application Type: Returns appropriate app instance
- Runtime Optimization: Optimizes for its deployment scenario
- Resource Management: Manages resources appropriate to its context
- Error Handling: Implements error handling suitable for its environment
Best Practices
Executor Selection
Development: Use InMemoryExecutor for quick testing and prototyping with small datasets.
Production APIs: Use RestExecutor for scalable web applications requiring REST API endpoints.
Interactive Development: Use InteractiveExecutor when building and testing incrementally with real-time data.
Configuration
Resource Matching: Ensure your vector database choice matches your executor type. For example, use InMemoryVectorDatabase with InMemoryExecutor.
Context Management
Execution Context: Provide appropriate context data that matches your deployment environment and performance requirements.
Integration Pattern
Executors integrate all core Superlinked components:- Sources: Provide data input from various sources
- Indices: Define vector spaces and data organization
- Vector Databases: Handle vector storage and retrieval
- Applications: Create the final application interface
- Queries: Enable search and retrieval operations
Application Lifecycle
The executor manages the complete application lifecycle:- Initialization: Configure all components
- Startup: Initialize connections and resources
- Runtime: Handle queries and data operations
- Monitoring: Provide observability and health checks
- Shutdown: Clean up resources appropriately
Error Handling
Executors provide comprehensive error handling:- Configuration Errors: Validate component compatibility
- Runtime Errors: Handle execution failures gracefully
- Resource Errors: Manage database and network issues
- Data Errors: Handle source and parsing failures