Semantic Search
Cohere’s embedding models are available via the Embed endpoint. This endpoint enables you to embed text documents (multilingual) and images into a vector space.
Semantic search, powered by embeddings, enables applications to perform information retrieval based on the context or meaning of a document.
This quickstart guide shows you how to perform semantic search with the Embed endpoint.
Setup
First, install the Cohere Python SDK with the following command.
Next, import the library and create a client.
Cohere Platform
Private Deployment
Bedrock
SageMaker
Azure AI
Document Embeddings
First, embed the list of available documents using the Embed endpoint by specifying the input_type as search_document.
Cohere Platform
Private Deployment
Bedrock
SageMaker
Azure AI
Query Embedding
Next, embed the user query using the Embed endpoint by specifying the input_type as search_query.
Cohere Platform
Private Deployment
Bedrock
SageMaker
Azure AI
Semantic Search
Then, perform semantic search by computing the similarity between the query embedding and the document embeddings, and then returning the most similar documents.