Jina + Moorcheh
This integration uses the Jina Embeddings API withjina-embeddings-v5-text-small and Moorcheh vector namespaces to store and search vectors with ITS ranking.
The model produces 1024-dimensional vectors by default (Matryoshka truncation is available via the API if you need a smaller size and match vector_dimension accordingly).
Architecture
Embedding generation
Call
POST https://api.jina.ai/v1/embeddings with task retrieval.passage (index) or retrieval.query (search)Vector storage
Store vectors in Moorcheh vector namespaces
Semantic retrieval
Query with the same model and
retrieval.query for asymmetric retrievalAuthentication
Authorization: Bearer your Jina API keyPrerequisites
MOORCHEH_API_KEYfrom the Moorcheh ConsoleJINA_API_KEYfrom the Jina API dashboard- Python 3.9+
.env file
Tasks
For asymmetric retrieval, use:| Task | When to use |
|---|---|
retrieval.passage | Chunks or documents you index |
retrieval.query | User queries at search time |
text-matching, classification) are supported by the API for different workloads; keep task and model consistent between index and query for retrieval.
Vector dimensions
Default output forjina-embeddings-v5-text-small is 1024 dimensions. You can pass a dimensions field in the API request to truncate (Matryoshka); the Moorcheh namespace vector_dimension must match what you send at index and query time.
End-to-end example
The following example loads keys from.env via load_dotenv(), embeds passages and a query through the Jina API, uploads vectors to Moorcheh, and runs similarity search.
Runnable demo script
Seeintegrations/jina/jina_moorcheh_demo.py.
Important notes
Vector dimension must match
Vector dimension must match
Default length is 1024 for
jina-embeddings-v5-text-small. If you set dimensions in the Jina request, create the Moorcheh namespace with that same vector_dimension.Use passage vs query tasks
Use passage vs query tasks
Use
retrieval.passage for stored chunks and retrieval.query for search queries so the retrieval adapter matches training.Store text on each vector
Store text on each vector
Include
text on each uploaded vector so search results can return the original chunk.Keep model and task consistent
Keep model and task consistent
Use the same model name and task pairing at index and query time.
Troubleshooting
401/ auth errors: CheckJINA_API_KEYandAuthorization: Bearerformat.Dimension mismatch: Align Moorchehvector_dimensionwith embedding length (default 1024).- Low relevance: Adjust chunking,
threshold, andtop_k.