1
Vector Search
Claude edited this page 2026-02-19 23:35:15 +00:00
Vector Search
Qdrant Integration
qdrant.go provides the vector database client via gRPC:
Collections
// Create a new collection
rag.CreateCollection(ctx, client, "docs", vectorSize)
// Check if collection exists
exists := rag.CollectionExists(ctx, client, "docs")
Upsert
// Store embedded chunks
rag.Upsert(ctx, client, "docs", points)
Search
results, _ := rag.Search(ctx, client, "docs", queryVector, limit)
Ollama Embeddings
ollama.go generates vector embeddings using Ollama's embedding API:
embedding, _ := rag.Embed(ctx, ollamaClient, "nomic-embed-text", text)
Query Interface
query.go provides the high-level search API:
cfg := &rag.QueryConfig{
Collection: "docs",
Model: "nomic-embed-text",
Limit: 5,
Format: "text", // or "json", "xml"
}
results, _ := rag.Query(ctx, cfg, "How does authentication work?")
Output Formats
- text: Plain text with source attribution
- json: Structured JSON for programmatic use
- xml: XML format for MCP tool responses
Ingestion Pipeline
ingest.go provides end-to-end document processing:
cfg := &rag.IngestConfig{
Collection: "docs",
Model: "nomic-embed-text",
ChunkSize: 512,
}
// Single file
rag.IngestFile(ctx, cfg, "/path/to/README.md")
// From reader
rag.Ingest(ctx, cfg, reader, "source-name")
The pipeline: read file → chunk → embed each chunk → upsert to Qdrant.