๐ŸงฎConfiguring your app

Deploying and Configuring Qyver Server

Application Structure and Configuration

The core logic of a Qyver-powered application resides in configuration files, where you define its structure and behavior using the Qyver framework.

By default, all examples in this documentation use an in-memory database, which is ideal for testing and prototyping. For guidance on integrating alternative vector databases, refer to the Vector Database Documentation.

Getting Started

  • Begin with a basic example application here.

  • Explore a real-world case study in the Amazon example.

  • For advanced examples on embedding spaces and queries, check out the Qyver Notebooks.


Understanding the Application's Core Components

A functional Qyver application is structured around three key files:

index.py โ€“ Defines schemas, spaces, and indices. query.py โ€“ Specifies queries for searching and ranking results. api.py โ€“ Configures the executor, integrating all components.


1. Defining Schema, Spaces, and Index (index.py)

from qyver import framework as sl

class YourSchema(sl.Schema):
    id: sl.IdField
    attribute: sl.String

your_schema = YourSchema()

model_name = "<your model name>"  # Replace with a valid model!
text_space = sl.TextSimilaritySpace(text=your_schema.attribute, model=model_name)

index = sl.Index(text_space)

In this file:

  • A schema is defined to structure input data.

  • A space is created, mapping an attribute to an embedding model.

  • An index is established to store and retrieve embeddings efficiently.

Modifications to this file (e.g., adding new spaces or altering the schema) require re-ingesting data, as previous vectors will no longer be valid.


2. Defining Queries (query.py)

This file:

  • Defines queries to search within the indexed data.

  • Allows customization of weights, limits, radius, and other parameters.


3. Configuring API and Executor (api.py)

This file:

  • Sets up data sources to handle incoming data.

  • Registers queries as REST API endpoints (e.g., /api/v1/search/query).

  • Defines the executor, which connects sources, indices, queries, and vector storage.

For detailed API documentation, check here.


Data Loading & Ingestion

Qyver supports loading data from local or remote files instead of requiring manual REST API ingestion.

1. Creating a Data Loader

2. Mapping Schema Fields to Columns

3. Handling Large Datasets with Chunking

Chunking is essential for efficient memory management when working with large datasets.


Customizing API Endpoints

By default, Qyver follows this API structure:

  • Query Endpoint: /api/v1/search/<query_name>

  • Data Ingestion Endpoint: /api/v1/ingest/<schema_name>

To customize API paths, modify the RestEndpointConfiguration:


Using Recency Space

Limitations: 1. Recency embeddings are not periodically updated (coming soon!). 2. The server's startup timestamp is fixed at launch.

Workaround for Fixed Timestamps

Set the DISABLE_RECENCY_SPACE environment variable to false to enable it.


Optimizing Performance with GPU Acceleration

Qyver supports GPU acceleration for text and image embeddings, improving performance for large-scale processing.

Enable GPU Acceleration

Set the GPU_EMBEDDING_THRESHOLD environment variable:

  • Default: 0 (Disabled)

  • Valid range: 1-9999

  • Behavior: If the batch size exceeds the threshold, GPU acceleration is activated.

Ensure:

  • Your system has an NVIDIA GPU (best performance with PyTorch).

  • GPU drivers are up to date.


Final Thoughts

Qyver simplifies modular, scalable AI-powered search applications, allowing flexibility in deployment with:

  • Seamless integration with REST APIs & Vector Databases

  • Efficient data ingestion via REST or file-based sources

  • Advanced embedding techniques for structured + unstructured data

  • Scalability optimizations, including GPU acceleration

Ready to build?

Last updated