InMemoryApp
class provides an in-memory implementation of the App interface, designed for development, testing, and rapid prototyping. It stores all data and vectors in memory, making it perfect for experimentation without external dependencies.
Constructor
Create a new in-memory application with the specified configuration.Parameters
List of in-memory data sources that will provide input data. Must be
InMemorySource
instances for compatibility with the in-memory execution
model.List of indices that organize your vector spaces for querying. These define
how your data will be structured and searched.
Vector database instance for storage. If not provided, defaults to an
in-memory vector database that stores everything in RAM.
Execution context that provides configuration and runtime information for the
application.
Example
Inheritance
TheInMemoryApp
extends several classes to provide comprehensive functionality:
Inheritance Chain:
InMemoryApp
- →
InteractiveApp
- →
OnlineApp
- →
App
- →
ABC
+Generic
- →
QueryMixin
- Base App functionality from
App
- Online processing capabilities from
OnlineApp
- Interactive features from
InteractiveApp
- Query operations from
QueryMixin
Key Features
Memory-Based Storage
All data and vectors are stored in RAM, providing:- Fast Access: No disk I/O overhead
- Simple Setup: No external database required
- Easy Testing: Isolated, reproducible environments
Interactive Capabilities
Inherited fromInteractiveApp
:
- Real-time data ingestion
- Immediate query feedback
- Dynamic schema updates
Query Support
Built-in querying throughQueryMixin
:
- Vector similarity search
- Filtering capabilities
- Natural language queries
Use Cases
Development and Prototyping
Perfect for initial development and experimentation:Unit Testing
Ideal for unit and integration tests:Demo Applications
Great for demonstrations and proof-of-concepts:Educational Purposes
Excellent for learning and teaching vector search concepts:Performance Characteristics
Advantages
Speed: All operations are performed in memory, providing the fastest
possible access times for development scenarios.
Simplicity: No external dependencies or complex setup required. Perfect
for getting started quickly.
Limitations
Memory Usage: All data is stored in RAM. Not suitable for large datasets
that exceed available memory.
Persistence: Data is lost when the application shuts down. Not appropriate
for production use cases requiring data persistence.
Scalability: Limited by single-machine memory constraints. Cannot scale
horizontally.
Best Practices
Development Workflow: Use
InMemoryApp
for initial development, then
migrate to RestApp
or OnlineApp
for production deployment.Data Size: Keep datasets small (typically under 1GB) to ensure responsive
performance and avoid memory issues.
Testing: Excellent choice for automated testing due to fast setup/teardown
and isolated environments.