You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
model_name=<spanclass="hljs-string">"jina-embeddings-v2-base-en"</span>, <spanclass="hljs-comment"># Defaults to `jina-embeddings-v2-base-en`</span>
35
-
api_key=JINAAI_API_KEY <spanclass="hljs-comment"># Provide your Jina AI API key</span>
34
+
model_name=<spanclass="hljs-string">"jina-embeddings-v3"</span>, <spanclass="hljs-comment"># Defaults to `jina-embeddings-v3`</span>
35
+
api_key=JINAAI_API_KEY, <spanclass="hljs-comment"># Provide your Jina AI API key</span>
36
+
task=<spanclass="hljs-string">"retrieval.passage"</span>, <spanclass="hljs-comment"># Specify the task</span>
37
+
dimensions=<spanclass="hljs-number">1024</span>, <spanclass="hljs-comment"># Defaults to 1024</span>
<p>The name of the Jina AI embedding model to use for encoding. You can specify any of the available Jina AI embedding model names, for example, <codetranslate="no">jina-embeddings-v2-base-en</code>, <codetranslate="no">jina-embeddings-v2-small-en</code>, etc. If you leave this parameter unspecified, <codetranslate="no">jina-embeddings-v2-base-en</code> will be used. For a list of available models, refer to <ahref="https://jina.ai/embeddings">Jina Embeddings</a>.</p></li>
43
+
<p>The name of the Jina AI embedding model to use for encoding. You can specify any of the available Jina AI embedding model names, for example, <codetranslate="no">jina-embeddings-v3</code>, <codetranslate="no">jina-embeddings-v2-base-en</code>, etc. If you leave this parameter unspecified, <codetranslate="no">jina-embeddings-v3</code> will be used. For a list of available models, refer to <ahref="https://jina.ai/embeddings">Jina Embeddings</a>.</p></li>
<p>The type of input passed to the model. Required for embedding models v3 and higher.</p>
48
+
<ul>
49
+
<li><codetranslate="no">"retrieval.passage"</code>: Used to encode large documents in retrieval tasks at indexing time.</li>
50
+
<li><codetranslate="no">"retrieval.query"</code>: Used to encode user queries or questions in retrieval tasks.</li>
51
+
<li><codetranslate="no">"classification"</code>: Used to encode text for text classification tasks.</li>
52
+
<li><codetranslate="no">"text-matching"</code>: Used to encode text for similarity matching, such as measuring similarity between two sentences.</li>
53
+
<li><codetranslate="no">"clustering"</code>: Used for clustering or reranking tasks.</li>
<p>This parameter controls whether to use the new chunking method <ahref="https://arxiv.org/abs/2409.04701">Jina AI introduced last month</a> for encoding a batch of sentences. Defaults to <codetranslate="no">False</code>. When set to <codetranslate="no">True</code>, 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.</p></li>
44
59
</ul>
45
-
<p>To create embeddings for documents, use the <codetranslate="no">encode_documents()</code> method:</p>
<p>To create embeddings for documents, use the <codetranslate="no">encode_documents()</code> method. This method is designed for documents embeddings in asymmetric retrieval tasks, such as indexing documents for search or recommendation tasks. This method uses <codetranslate="no">retrieval.passage</code> as the task.</p>
61
+
<pre><codetranslate="no"class="language-python:">
62
+
```python
63
+
docs = [
47
64
<spanclass="hljs-string">"Artificial intelligence was founded as an academic discipline in 1956."</span>,
48
65
<spanclass="hljs-string">"Alan Turing was the first person to conduct substantial research in AI."</span>,
49
66
<spanclass="hljs-string">"Born in Maida Vale, London, Turing was raised in southern England."</span>,
<p>To create embeddings for queries, use the <codetranslate="no">encode_queries()</code> method:</p>
87
+
<p>To create embeddings for queries, use the <codetranslate="no">encode_queries()</code> method. This method is designed for query embeddings in asymmetric retrieval tasks, such as search queries or questions. This method uses <codetranslate="no">retrieval.query</code> as the task.</p>
71
88
<pre><codetranslate="no"class="language-python">queries = [<spanclass="hljs-string">"When was artificial intelligence founded"</span>,
72
89
<spanclass="hljs-string">"Where was Alan Turing born?"</span>]
<p>To create embeddings of inputs for similarity matching (such as STS or symmetric retrieval tasks), text classification, clustering, or reranking tasks, use the appropriate <codetranslate="no">task</code> parameter value when instantiating the <codetranslate="no">JinaEmbeddingFunction</code> class.</p>
0 commit comments