Pular para o conteúdo

Verba Cheat Sheet

Overview

Verba is an open-source retrieval-augmented generation chatbot built by Weaviate. It provides a production-ready web interface for uploading documents, querying them with natural language, and getting AI-generated answers grounded in your data. Verba uses Weaviate as its vector database backend and supports multiple LLM providers (OpenAI, Anthropic, Ollama, HuggingFace) and embedding models.

The application handles the full RAG pipeline: document ingestion with chunking, embedding generation, vector storage and retrieval, and LLM-powered answer generation with source citations. Verba is designed as a turnkey solution for teams who want to deploy a document Q&A system without building the RAG infrastructure from scratch.

Installation

pip Install

pip install goldenverba

# Start Verba
verba start
# Access UI at http://localhost:8000

Docker

docker run -p 8000:8000 \
  -e OPENAI_API_KEY=sk-... \
  -e WEAVIATE_URL_VERBA=http://weaviate:8080 \
  weaviate/verba:latest

Docker Compose (with Weaviate)

version: '3.8'
services:
  weaviate:
    image: cr.weaviate.io/semitechnologies/weaviate:1.27.0
    ports:
      - "8080:8080"
      - "50051:50051"
    environment:
      QUERY_DEFAULTS_LIMIT: 25
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
      PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
      DEFAULT_VECTORIZER_MODULE: 'none'
      ENABLE_MODULES: ''
      CLUSTER_HOSTNAME: 'node1'
    volumes:
      - weaviate_data:/var/lib/weaviate

  verba:
    image: weaviate/verba:latest
    ports:
      - "8000:8000"
    environment:
      - WEAVIATE_URL_VERBA=http://weaviate:8080
      - OPENAI_API_KEY=${OPENAI_API_KEY}
    depends_on:
      - weaviate

volumes:
  weaviate_data:

From Source

git clone https://github.com/weaviate/Verba.git
cd Verba
pip install -e .
verba start

Configuration

Environment Variables

VariableDescriptionRequired
WEAVIATE_URL_VERBAWeaviate instance URLYes
WEAVIATE_API_KEY_VERBAWeaviate API keyIf auth enabled
OPENAI_API_KEYOpenAI API keyFor OpenAI models
ANTHROPIC_API_KEYAnthropic API keyFor Claude models
COHERE_API_KEYCohere API keyFor Cohere models
HUGGINGFACE_API_KEYHuggingFace tokenFor HF models
UNSTRUCTURED_API_KEYUnstructured API keyFor advanced parsing
# .env file
WEAVIATE_URL_VERBA=http://localhost:8080
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o
OPENAI_EMBEDDING_MODEL=text-embedding-3-small

Component Selection

ComponentOptions
EmbedderOpenAI, Cohere, HuggingFace, Ollama, SentenceTransformers
GeneratorOpenAI, Anthropic, Cohere, Ollama, HuggingFace
ChunkerToken, Sentence, Recursive, Semantic
ReaderDefault, Unstructured, PDF, DOCX, CSV
RetrieverSimple, Window, Hybrid

Document Ingestion

Via Web UI

  1. Navigate to http://localhost:8000
  2. Click “Add Documents”
  3. Upload files (PDF, DOCX, TXT, CSV, MD)
  4. Select chunking strategy and embedding model
  5. Click “Import”

Via API

# Upload document
curl -X POST http://localhost:8000/api/import \
  -F "file=@document.pdf" \
  -F "reader=PDFReader" \
  -F "chunker=TokenChunker" \
  -F "embedder=OpenAIEmbedder"

# Upload with metadata
curl -X POST http://localhost:8000/api/import \
  -H "Content-Type: application/json" \
  -d '{
    "documents": [
      {
        "text": "RAG combines retrieval with generation...",
        "metadata": {"source": "wiki", "topic": "AI"},
        "title": "RAG Overview"
      }
    ],
    "chunker": "TokenChunker",
    "embedder": "OpenAIEmbedder"
  }'

Via Python

from goldenverba import VerbaManager
from goldenverba.components.reader import Document

manager = VerbaManager()
manager.connect()

# Create documents
docs = [
    Document(
        text="Retrieval augmented generation combines...",
        metadata={"source": "manual"},
        title="RAG Guide"
    )
]

# Import with specified components
manager.import_documents(
    documents=docs,
    reader="DefaultReader",
    chunker="TokenChunker",
    embedder="OpenAIEmbedder"
)

Querying

Via Web UI

Type questions in the chat interface. Verba displays:

  • Generated answer
  • Source document chunks with relevance scores
  • Document metadata and links

Via API

# Query
curl -X POST http://localhost:8000/api/query \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What is retrieval augmented generation?",
    "generator": "OpenAIGenerator",
    "retriever": "SimpleRetriever",
    "top_k": 5
  }'

# Get suggestions (autocomplete)
curl -X POST http://localhost:8000/api/suggestions \
  -H "Content-Type: application/json" \
  -d '{"query": "How does"}'

Via Python

manager = VerbaManager()
manager.connect()

result = manager.query(
    query="Explain the RAG architecture",
    generator="OpenAIGenerator",
    retriever="SimpleRetriever",
    top_k=5
)

print(f"Answer: {result['answer']}")
for chunk in result['context']:
    print(f"Source: {chunk['title']} (score: {chunk['score']:.3f})")

Chunking Strategies

StrategyDescriptionBest For
TokenFixed token-count chunksGeneral purpose
SentenceSplit by sentence boundariesNarrative text
RecursiveHierarchical splitting by separatorsStructured documents
SemanticGroup by semantic similarityComplex documents

Chunker Settings

{
  "chunker": "TokenChunker",
  "config": {
    "chunk_size": 500,
    "chunk_overlap": 50,
    "separator": "\n\n"
  }
}

Advanced Usage

Custom System Prompt

# Via API
curl -X POST http://localhost:8000/api/config \
  -H "Content-Type: application/json" \
  -d '{
    "system_prompt": "You are a technical documentation assistant. Answer questions using only the provided context. If the answer is not in the context, say so."
  }'
# Combine vector + keyword search
result = manager.query(
    query="database performance optimization",
    retriever="HybridRetriever",
    retriever_config={
        "alpha": 0.75,  # 0=keyword only, 1=vector only
        "top_k": 10
    }
)

Weaviate Direct Access

import weaviate

client = weaviate.Client("http://localhost:8080")

# Query Verba's collection directly
result = client.query.get(
    "Verba_Document",
    ["text", "title", "source"]
).with_near_text({
    "concepts": ["machine learning"]
}).with_limit(5).do()

print(result)

Multi-User Setup

# docker-compose.yml with auth
services:
  weaviate:
    environment:
      AUTHENTICATION_APIKEY_ENABLED: 'true'
      AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'admin-key,readonly-key'
      AUTHENTICATION_APIKEY_USERS: 'admin,reader'
      AUTHORIZATION_ADMINLIST_ENABLED: 'true'
      AUTHORIZATION_ADMINLIST_USERS: 'admin'

Troubleshooting

IssueSolution
Weaviate connection failedCheck WEAVIATE_URL_VERBA, ensure Weaviate is running
Import fails on large PDFsIncrease chunk size, use Unstructured reader
Empty search resultsVerify documents were imported, check embedder config
Slow responsesUse faster model (gpt-4o-mini), reduce top_k
Port 8000 in useChange port: verba start --port 8001
API key errorsCheck environment variables are set correctly
Docker compose networkingUse service names (e.g., http://weaviate:8080)
Memory issuesIncrease Docker memory limits for Weaviate
# Check Weaviate health
curl http://localhost:8080/v1/.well-known/ready

# Check Verba health
curl http://localhost:8000/api/health

# View logs
docker compose logs -f verba
docker compose logs -f weaviate

# Reset data
docker compose down -v
docker compose up -d