Files
landing_page/qdrant-landing/content/documentation/embeddings/cohere.md
T
NirantandAtita Arora d90efb359d Add Gemini Embedding Model 001 (#457)
* * feat(gemini.md): add documentation for integrating Gemini embeddings with Qdrant

* * refactor(integrations): move cohere.md to embeddings folder
* refactor(integrations): move openai.md to embeddings folder
* refactor(integrations): move autogen.md to frameworks folder
* refactor(integrations): move langchain.md to frameworks folder

* blacken

* * feat(embedding, frameworks): reorganise integrations into embedding and frameworks, add _index.md to both

* * chore(gemini.md): remove old Gemini integration documentation

* * chore(embedding/_index.md): update weight from 24 to 23 and set is_empty to false
* chore(frameworks/_index.md): update weight from 24 to 23 and set is_empty to false

* Split integrations into embedding and frameworks

* Update heading level for embedding a document

* Update Gemini embedding documentation

* Update titles for embedding and frameworks sections

* Try again with nesting

* Add documentation for integrated frameworks and embedding options

* Delete integrations documentation file

* Add Delimiter; unknown weights

* Change all weights to 3x

* Delimiter reorg

* Update qdrant-landing/content/documentation/embedding/gemini.md

Co-authored-by: Atita Arora <atarora@users.noreply.github.com>

* Update qdrant-landing/content/documentation/embedding/gemini.md

Co-authored-by: Atita Arora <atarora@users.noreply.github.com>

* Update qdrant-landing/content/documentation/embedding/gemini.md

Co-authored-by: Atita Arora <atarora@users.noreply.github.com>

* Update qdrant-landing/content/documentation/embedding/gemini.md

Co-authored-by: Atita Arora <atarora@users.noreply.github.com>

* Update qdrant-landing/content/documentation/embedding/gemini.md

Co-authored-by: Atita Arora <atarora@users.noreply.github.com>

* Update qdrant-landing/content/documentation/embedding/gemini.md

Co-authored-by: Atita Arora <atarora@users.noreply.github.com>

* Update qdrant-landing/content/documentation/embedding/gemini.md

Co-authored-by: Atita Arora <atarora@users.noreply.github.com>

* Update qdrant-landing/content/documentation/embedding/gemini.md

Co-authored-by: Atita Arora <atarora@users.noreply.github.com>

* Update qdrant-landing/content/documentation/embedding/gemini.md

Co-authored-by: Atita Arora <atarora@users.noreply.github.com>

* * docs(embedding/gemini.md): update Gemini Embedding Model API documentation
*
* - Add information about the new Gemini Embedding Model and its compatibility with Qdrant
* - Clarify the usage of the `task_type` parameter in the API call
* - Provide a list of supported task types and

* * docs(embedding): update list of embedding integrations

* * refactor(fifty-one.md): Rename file from embedding/fifty-one.md to frameworks/fifty-one.md
* refactor(txtai.md): Rename file from embedding/txtai.md to frameworks/txtai.md

* * chore(embedding): update is_empty value to true in _index.md
* chore(embedding): remove Fifty One from embedding/_index.md

* embedding -> embeddings

---------

Co-authored-by: Atita Arora <atarora@users.noreply.github.com>
2023-12-11 17:50:42 +05:30

2.9 KiB

title, weight
title weight
Cohere 700

Cohere

Qdrant is compatible with Cohere co.embed API and its official Python SDK that might be installed as any other package:

pip install cohere

The embeddings returned by co.embed API might be used directly in the Qdrant client's calls:

import cohere
import qdrant_client

from qdrant_client.http.models import Batch

cohere_client = cohere.Client("<< your_api_key >>")
qdrant_client = qdrant_client.QdrantClient()
qdrant_client.upsert(
    collection_name="MyCollection",
    points=Batch(
        ids=[1],
        vectors=cohere_client.embed(
            model="large",
            texts=["The best vector database"],
        ).embeddings,
    ),
)

If you are interested in seeing an end-to-end project created with co.embed API and Qdrant, please check out the "Question Answering as a Service with Cohere and Qdrant" article.

Embed v3

Embed v3 is a new family of Cohere models, released in November 2023. The new models require passing an additional parameter to the API call: input_type. It determines the type of task you want to use the embeddings for.

  • input_type="search_document" - for documents to store in Qdrant
  • input_type="search_query" - for search queries to find the most relevant documents
  • input_type="classification" - for classification tasks
  • input_type="clustering" - for text clustering

While implementing semantic search applications, such as RAG, you should use input_type="search_document" for the indexed documents and input_type="search_query" for the search queries. The following example shows how to index documents with the Embed v3 model:

import cohere
import qdrant_client

from qdrant_client.http.models import Batch

cohere_client = cohere.Client("<< your_api_key >>")
qdrant_client = qdrant_client.QdrantClient()
qdrant_client.upsert(
    collection_name="MyCollection",
    points=Batch(
        ids=[1],
        vectors=cohere_client.embed(
            model="embed-english-v3.0",  # New Embed v3 model
            input_type="search_document",  # Input type for documents
            texts=["Qdrant is the a vector database written in Rust"],
        ).embeddings,
    ),
)

Once the documents are indexed, you can search for the most relevant documents using the Embed v3 model:

qdrant_client.search(
    collection_name="MyCollection",
    query=cohere_client.embed(
        model="embed-english-v3.0",  # New Embed v3 model
        input_type="search_query",  # Input type for search queries
        texts=["The best vector database"],
    ).embeddings[0],
)