Back to Docs
Getting Started

Quickstart

Connect, benchmark, and evaluate in 5 minutes

Last updated: August 19, 2025
Category: getting-started

Quickstart

Get started with Vecta in 5 minutes. Choose Cloud API (hosted) or Local SDK (self-hosted).

Cloud API (Recommended)

1. Install SDK

pip install vecta[all]

2. Get API Key

Sign up at runvecta.com/platform and generate an API key from Settings → API Keys.

3. Create Client

from vecta import VectaAPIClient

client = VectaAPIClient(api_key="your-api-key")

4. Create Benchmark

# Upload files directly (simplest approach)
data_source = client.upload_local_files([
    "docs/manual.pdf",
    "docs/guide.docx",
    "docs/faq.txt"
])

# Generate a synthetic Q&A dataset from your uploaded files
benchmark = client.create_benchmark(
    data_source_id=data_source["id"],
    questions_count=10,
)

5. Run Evaluation

# This is your RAG pipeline
def my_rag(query: str) -> tuple[list[str], str]:
    # ...
    return retrieved_chunk_ids, generated_answer

# Run evaluation
results = client.evaluate_retrieval_and_generation(
    benchmark_id=benchmark["id"],
    retrieval_generation_function=my_rag,
    evaluation_name="my-first-eval"
)

print(f"F1 Score: {results.document_level.f1_score:.3f}")
Screenshot of a Vecta evaluation report summarizing retrieval and generation scores

Figure: Run an evaluation and instantly review precision, recall, and groundedness in the cloud platform dashboard.

Alternative: Connect Existing Vector Database

Already have a vector database? Skip file upload and connect directly to your vector db for more granular evaluation results.

Pinecone logoChromaDB logoWeaviate logoDatabricks Vector Search logoAzure Cosmos DB logoPostgreSQL logo

Figure: Connect Vecta to your production vector store—Pinecone, ChromaDB, Weaviate, Databricks, Azure Cosmos DB, pgvector, and more.

Customize Database Schema (Optional)

You can customize how Vecta reads your vector database by defining a schema. This tells Vecta how to extract content, metadata, and other fields from your database. See Accessor Syntax for details.

from vecta import VectaAPIClient
from vecta.core.schemas import VectorDBSchema

client = VectaAPIClient(api_key="your-api-key")

# Define how to read results from your vector database
schema = VectorDBSchema(
    id_accessor="id",
    content_accessor="text",
    source_path_accessor="metadata.filename",
    page_nums_accessor="metadata.pages"
)

Connect to Your Database

# ChromaDB Cloudmple
db = client.connect_chroma_cloud(
    tenant="your-tenant",
    database="your-db",
    api_key="your-chroma-key",
    collection_name="documents",
    schema=schema  # Optional: uses default if not provided
)

# Or Pinecone
db = client.connect_pinecone(
    api_key="your-pinecone-key",
    index_name="your-index",
    namespace="",  # Optional
    schema=schema   # Optional: uses default if not provided
)

# 10+ other vector databases supported, or
# easily make a custom connector if needed

# Then create benchmark from existing data
benchmark = client.create_benchmark(
    data_source_id=db["id"],
    questions_count=50,
)

Local SDK (Self-hosted)

Note: The Local SDK uses OpenRouter by default, which provides access to multiple AI models. Get your API key at openrouter.ai.

1. Install SDK

pip install vecta[all]

2. Process Your Files

from vecta import VectaClient
from vecta.connectors.file_store_connector import FileStoreConnector

# Process local files (simplest approach)
connector = FileStoreConnector(
    file_paths=[
        "manual.pdf",
        "guide.docx"
    ],
    base_path="/path/to/files"
)

# Initialize Vecta (or set OPENROUTER_API_KEY environment variable)
vecta = VectaClient(
    data_source_connector=connector,
    openai_api_key="your-openai-key",
    openai_base_url="https://api.openai.com/v1",  # or your custom LLM server
    model="gpt-4o"
)

3. Create Benchmark

# Load your files
vecta.load_knowledge_base()

# Generate benchmark
entries = vecta.generate_benchmark(
    n_questions=50,
    random_seed=42
)

# Save for later
vecta.save_benchmark("benchmark.csv")

4. Run Evaluation

# Test your retriever
def my_retriever(query: str) -> list[str]:
    results = connector.semantic_search(query, k=10)
    return [r.id for r in results]

results = vecta.evaluate_retrieval(my_retriever)
print(f"F1: {results.chunk_level.f1_score:.3f}")

Alternative: Use Existing Vector Database

from vecta import VectaClient
from vecta.connectors.chroma_local_connector import ChromaLocalConnector
from vecta.core.schema_helpers import SchemaTemplates
from vecta.core.schemas import VectorDBSchema
from chromadb import Client

# Connect to existing ChromaDB
chroma = Client()

# Use schema template or define custom schema
schema = SchemaTemplates.chroma_default()
# Or create custom schema:
# schema = VectorDBSchema(
#     id_accessor="id",
#     content_accessor="document", 
#     source_path_accessor="metadata.source_path",
#     page_nums_accessor="metadata.page_nums"
# )

connector = ChromaLocalConnector(
    client=chroma,
    collection_name="documents",
    schema=schema  # Schema parameter is required
)

# Initialize Vecta (or set OPENROUTER_API_KEY environment variable)
vecta = VectaClient(
    data_source_connector=connector,
    openai_api_key="your-openai-key",
    openai_base_url="https://api.openai.com/v1",  # or your custom LLM server
    model="gpt-4o"
)

Common Patterns

Test Retrieval Only

def my_retriever(query: str) -> list[str]:
    results = vector_db.search(query, k=10)
    return [r.id for r in results]

results = client.evaluate_retrieval(
    benchmark_id=benchmark["id"],
    retrieval_function=my_retriever
)

Test Full RAG Pipeline

def my_rag(query: str) -> tuple[list[str], str]:
    # Retrieve
    chunks = vector_db.search(query, k=5)
    chunk_ids = [c.id for c in chunks]
    
    # Generate
    context = "\n".join([c.content for c in chunks])
    answer = llm.generate(f"Context: {context}\n\nQ: {query}")
    
    return chunk_ids, answer

# Evaluate
results = client.evaluate_retrieval_and_generation(
    benchmark_id=benchmark["id"],
    retrieval_generation_function=my_rag
)

Test Generation Only

def my_generator(query: str) -> str:
    return llm.generate(query)

results = client.evaluate_generation_only(
    benchmark_id=benchmark["id"],
    generation_function=my_generator
)

Use Existing Datasets

from vecta.core.dataset_importer import BenchmarkDatasetImporter

importer = BenchmarkDatasetImporter()
chunks, entries = importer.import_gpqa_diamond(max_items=50)

vecta.benchmark_entries = entries
results = vecta.evaluate_generation_only(my_generator)

Next Steps

Need Help?

Can't find what you're looking for? Our team is here to help.