doc: added jina v4 model (#1738)

This commit is contained in:
Maximilian Werk
2025-06-27 11:50:47 +02:00
committed by GitHub
parent d990218442
commit a79969192c
@@ -1,6 +1,6 @@
---
title: Jina Embeddings
aliases:
aliases:
- /documentation/embeddings/jina-embeddings/
- /documentation/integrations/jina-embeddings/
---
@@ -15,16 +15,26 @@ Qdrant users can receive a 10% discount on Jina AI APIs by using the code **QDRA
| Model | Dimension | Language | MRL (matryoshka) | Context |
|:----------------------:|:---------:|:---------:|:-----------:|:---------:|
| **jina-clip-v2** | **1024** | **Multilingual (100+, focus on 30)** | **Yes** | **Text/Image** |
| **jina-embeddings-v4** | **2048 (single-vector), 128 (multi-vector)** | **Multilingual (30+)** | **Yes** | **32768 + Text/Image** |
| jina-clip-v2 | 1024 | Multilingual (100+, focus on 30) | Yes | Text/Image |
| jina-embeddings-v3 | 1024 | Multilingual (89 languages) | Yes | 8192 |
| jina-embeddings-v2-base-en | 768 | English | No | 8192 |
| jina-embeddings-v2-base-de | 768 | German & English | No | 8192 |
| jina-embeddings-v2-base-es | 768 | Spanish & English | No | 8192 |
| jina-embeddings-v2-base-zh | 768 | Chinese & English | No | 8192 |
> Jina recommends using `jina-embeddings-v3` for text-only tasks and `jina-clip-v2` for multimodal tasks or when enhanced visual retrieval is required.
> Jina recommends using `jina-embeddings-v4` for all tasks.
On top of the backbone, `jina-embeddings-v3` has been trained with 5 task-specific adapters for different embedding uses. Include `task` in your request to optimize your downstream application:
On top of the backbone, `jina-embeddings-v4` has been trained with 5 task-specific adapters for different embedding uses. Include `task` in your request to optimize your downstream application:
+ **retrieval.query**: Used to encode user queries or questions in retrieval tasks.
+ **retrieval.passage**: Used to encode large documents in retrieval tasks at indexing time.
+ **code.query**: Used to encode user queries or questions in code related retrieval tasks.
+ **code.passage**: Used to encode large documents in code related retrieval tasks at indexing time.
+ **text-matching**: Used to encode text for similarity matching, such as measuring similarity between two sentences.
Similarly, `jina-embeddings-v3` has been trained with 5 task-specific adapters for different embedding uses. Include `task` in your request to optimize your downstream application:
+ **retrieval.query**: Used to encode user queries or questions in retrieval tasks.
+ **retrieval.passage**: Used to encode large documents in retrieval tasks at indexing time.
@@ -32,22 +42,22 @@ On top of the backbone, `jina-embeddings-v3` has been trained with 5 task-specif
+ **text-matching**: Used to encode text for similarity matching, such as measuring similarity between two sentences.
+ **separation**: Used for clustering or reranking tasks.
`jina-embeddings-v3` and `jina-clip-v2` support **Matryoshka Representation Learning**, allowing users to control the embedding dimension with minimal performance loss.
Include `dimensions` in your request to select the desired dimension.
By default, **dimensions** is set to 1024, and a number between 256 and 1024 is recommended.
You can reference the table below for hints on dimension vs. performance:
`jina-embeddings-v4`, `jina-embeddings-v3` and `jina-clip-v2` support **Matryoshka Representation Learning**, allowing users to control the embedding dimension with minimal performance loss.
Include `dimensions` in your request to select the desired dimension.
By default, **dimensions** is set to 2048 (`jina-embeddings-v4`) or 1024 (`jina-embeddings-v3` and `jina-clip-v2`), and a number between 256 and 2048 is recommended.
You can reference the table below for hints on dimension vs. performance for the `jina-embeddings-v3` model. Similar results hold for the others.
| Dimension | 32 | 64 | 128 | 256 | 512 | 768 | 1024 |
|:----------------------:|:---------:|:---------:|:-----------:|:---------:|:----------:|:---------:|:---------:|
| Average Retrieval Performance (nDCG@10) | 52.54 | 58.54 | 61.64 | 62.72 | 63.16 | 63.3 | 63.35 |
`jina-embeddings-v3` supports [Late Chunking](https://jina.ai/news/late-chunking-in-long-context-embedding-models/), the technique to leverage the model's long-context capabilities for generating contextual chunk embeddings. Include `late_chunking=True` in your request to enable contextual chunked representation. When set to true, Jina AI API will concatenate all sentences in the input field and feed them as a single string to the model. Internally, the model embeds this long concatenated string and then performs late chunking, returning a list of embeddings that matches the size of the input list.
`jina-embeddings-v4` and `jina-embeddings-v3` supports [Late Chunking](https://jina.ai/news/late-chunking-in-long-context-embedding-models/), the technique to leverage the model's long-context capabilities for generating contextual chunk embeddings. Include `late_chunking=True` in your request to enable contextual chunked representation. When set to true, Jina AI API will concatenate all sentences in the input field and feed them as a single string to the model. Internally, the model embeds this long concatenated string and then performs late chunking, returning a list of embeddings that matches the size of the input list.
## Example
### Jina Embeddings v3
### Text-to-Text Retrieval
The code below demonstrates how to use `jina-embeddings-v3` with Qdrant:
The code below demonstrates how to use `jina-embeddings-v4` with Qdrant:
```python
import requests
@@ -57,8 +67,8 @@ from qdrant_client.models import Distance, VectorParams, Batch
# Provide Jina API key and choose one of the available models.
JINA_API_KEY = "jina_xxxxxxxxxxx"
MODEL = "jina-embeddings-v3"
DIMENSIONS = 1024 # Or choose your desired output vector dimensionality.
MODEL = "jina-embeddings-v4"
DIMENSIONS = 2048 # Or choose your desired output vector dimensionality.
TASK = 'retrieval.passage' # For indexing, or set to retrieval.query for querying
# Get embeddings from the API
@@ -99,9 +109,9 @@ qdrant_client.upsert(
```
### Jina CLIP v2
### Text-to-Image Retrieval
The code below demonstrates how to use `jina-clip-v2` with Qdrant:
The code below demonstrates how to use `jina-embeddings-v4` with Qdrant:
```python
import requests
@@ -110,8 +120,8 @@ from qdrant_client.models import Distance, VectorParams, PointStruct
# Provide your Jina API key and choose the model.
JINA_API_KEY = "jina_xxxxxxxxxxx"
MODEL = "jina-clip-v2"
DIMENSIONS = 1024 # Set the desired output vector dimensionality.
MODEL = "jina-embeddings-v4"
DIMENSIONS = 2048 # Set the desired output vector dimensionality.
# Define the inputs
text_input = "A blue cat"