Files
semantica/docs/vector_store_usage.md
T
KaifAhmad1andClaude Sonnet 4.6 946a1089c8 docs: premium redesign — Mintlify v4, dark/cream theme, full module coverage
- Migrate from mint.json to docs.json (Mintlify v4)
- Theme: maple, emerald green + near-black dark / cream light palette
  (#059669 primary, #0A0A0A dark bg, #FAF7F0 light bg)
- Typography: Lexend headings, Inter body
- 5-tab navigation: Documentation, Quick Start, API Reference, Cookbook, FAQ
- Homepage: removed badge stickers, redundant h2, added blockquote tagline,
  full 27-module reference table with semantica.mcp_server added
- quickstart.md: CodeGroup per pipeline step, pattern vs LLM options,
  AccordionGroup for patterns and troubleshooting
- faq.md: full AccordionGroup structure across 5 sections
- reference/explorer.md: NEW — FastAPI explorer, Ontology Hub, Distance
  Intelligence, CLI reference, REST API endpoints
- reference/mcp_server.md: NEW — MCP stdio server, 12 tools with I/O
  examples, 3 resources, Claude Desktop/VS Code/Windsurf/Cline config
- docs.json: explorer added to Output group, mcp_server to Utilities group
- Chat, feedback (thumbs/suggest/raise), OG/Twitter metadata, search topbar
- All reference pages reformatted with Mintlify JSX components

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:52:50 +05:30

118 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Vector Store: High-Performance Usage"
description: "Parallel ingestion, batch processing, and performance tuning for the Semantica Vector Store."
icon: "bolt"
---
> High-performance batch ingestion with parallel embedding generation — 310× faster than sequential processing.
---
## Key Features
- **Parallel ingestion** — multi-threaded embedding generation and storage
- **Batch processing** — minimizes overhead by grouping documents into chunks
- **Unified API** — `add_documents` handles embedding generation and storage in one call
---
## Quick Start: Parallel Ingestion
```python
from semantica.vector_store import VectorStore
import time
store = VectorStore(backend="faiss", dimension=768)
documents = [f"This is document number {i} with some content." for i in range(1000)]
metadata = [{"source": "generated", "id": i} for i in range(1000)]
start = time.time()
ids = store.add_documents(
documents=documents,
metadata=metadata,
batch_size=64,
parallel=True, # default: True
)
print(f"Ingested {len(ids)} documents in {time.time() - start:.2f}s")
```
---
## Performance Comparison
**Old method (sequential loop)** — slower due to per-item overhead:
```python
for doc in documents:
emb = embedder.generate(doc)
store.store_vectors([emb], [{"text": doc}])
```
**New method (parallel batching)** — 310× faster:
```python
store.add_documents(documents, parallel=True)
```
---
## Configuration and Tuning
### `max_workers`
Number of concurrent threads for embedding generation.
- **Default**: 6 (optimized for most systems)
- Override only if you have very high core counts or specific throughput needs
```python
store = VectorStore(max_workers=16)
```
### `batch_size`
Number of documents processed in a single chunk.
- **Default**: 32
- **Local models**: 3264 works well
- **API models (OpenAI, etc.)**: 100200 reduces network latency overhead
```python
store.add_documents(documents, batch_size=100)
```
---
## Manual Batch Embedding
If you need embeddings without immediately storing them:
```python
vectors = store.embed_batch(texts=documents[:100])
print(f"Generated {len(vectors)} vectors")
```
---
## Best Practices
<Tip>
- **Metadata consistency** — ensure your `metadata` list is the same length as `documents`.
- **Error handling** — `add_documents` propagates exceptions if embedding fails; validate your data first.
- **Memory usage** — very large `batch_size` combined with high `max_workers` increases RAM usage. Monitor system resources for large corpora.
</Tip>
---
## See Also
<CardGroup cols={2}>
<Card title="Vector Store Reference" icon="vector-square" href="reference/vector_store">
Full VectorStore API with all backends.
</Card>
<Card title="Embeddings" icon="brain" href="reference/embeddings">
Embedding providers and GPU acceleration.
</Card>
</CardGroup>