Deploy and operate
This page covers the client configuration, readiness checks, and production setup of a Vespa application.
VespaClientConfig
VespaClientConfig
Configure the connection to Vespa with VespaClientConfig:
from mistralai.search.toolkit.plugins.vespa import VespaClientConfig
from vespa_app import app
collection_name = "my_collection"
config = VespaClientConfig(
endpoint="http://localhost:8080",
timeout=30, # Request timeout in seconds
)
vector_store = app.get_search_index(config, collection_name=collection_name)Connection parameters:
| Parameter | Purpose | Default |
|---|---|---|
endpoint | Sets both query_endpoint and feed_endpoint | None |
query_endpoint | Vespa query API URL | "" |
feed_endpoint | Vespa document API URL | "" |
timeout | Request timeout in seconds | None |
Set endpoint, or both query_endpoint and feed_endpoint.
TLS (production):
from mistralai.search.toolkit.plugins.vespa import VespaClientConfig
from vespa_app import app
config = VespaClientConfig(
endpoint="https://vespa.example.com:8080",
)
vector_store = app.get_search_index(config, collection_name="my_collection")Health checks and readiness
Health checks and readiness
Before ingesting or querying, ensure Vespa is ready:
import asyncio
import aiohttp
from mistralai.search.toolkit.plugins.vespa import VespaClientConfig
from vespa_app import app
async def wait_for_vespa(endpoint: str, max_attempts=30):
"""Wait for Vespa to be ready for operations."""
for attempt in range(max_attempts):
try:
async with aiohttp.ClientSession() as session:
async with session.get(
f"{endpoint}/ApplicationStatus",
timeout=5
) as resp:
if resp.status == 200:
print("Vespa is ready")
return True
except Exception as e:
print(f"Attempt {attempt + 1}: {e}")
await asyncio.sleep(2)
raise RuntimeError("Vespa failed to become ready")
# Usage
endpoint = "http://localhost:8080"
await wait_for_vespa(endpoint)
config = VespaClientConfig(endpoint=endpoint)
vector_store = app.get_search_index(config, collection_name="my_collection")Health check endpoints:
# Application status
curl http://localhost:8080/ApplicationStatus
# Document count in collection
curl "http://localhost:8080/search/?yql=select%20*%20from%20my_collection%20where%20true%20limit%201"Production deployment
Production deployment
For production environments, follow these guidelines:
Cluster setup:
- Deploy at least 3 Vespa nodes for redundancy
- Distribute nodes across availability zones
- Use a load balancer with health checks in front of query endpoints
Network configuration:
- Use private networks for inter-node communication
- Expose the query endpoint through a reverse proxy (such as nginx or Cloudflare)
- Implement rate limiting and DDoS protection
Configuration example (distributed setup):
from mistralai.search.toolkit.plugins.vespa import VespaClientConfig
from vespa_app import app
# Load balancer endpoint (single entry point)
config = VespaClientConfig(
endpoint="https://vespa-lb.example.com",
timeout=30,
)
vector_store = app.get_search_index(config, collection_name="my_collection")Monitoring:
- Track ingestion latency and throughput
- Monitor query latency and error rates
- Set alerts on health check failures
- Monitor disk usage and index size growth
See also
See also
- Local development: local setup guide
- Manage schema: create and evolve schemas
- Vespa documentation: advanced configuration and operations