From 5c97f70bf1bbddcb49a17f1b4ad53ba5a5c42a4a Mon Sep 17 00:00:00 2001 From: Sasmitha Manathunga <70096033+mmz-001@users.noreply.github.com> Date: Wed, 18 Jan 2023 11:56:07 +0530 Subject: [PATCH] Fix CohereError: embed is not an available endpoint on this model (#637) Running the Cohere embeddings example from the docs: ```python from langchain.embeddings import CohereEmbeddings embeddings = CohereEmbeddings(cohere_api_key= cohere_api_key) text = "This is a test document." query_result = embeddings.embed_query(text) doc_result = embeddings.embed_documents([text]) ``` I get the error: ```bash CohereError(message=res['message'], http_status=response.status_code, headers=response.headers) cohere.error.CohereError: embed is not an available endpoint on this model ``` This is because the `model` string is set to `medium` which is not currently available. From the Cohere docs: > Currently available models are small and large (default) --- langchain/embeddings/cohere.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/embeddings/cohere.py b/langchain/embeddings/cohere.py index 9a4f2ffe6e1..420ce369aa3 100644 --- a/langchain/embeddings/cohere.py +++ b/langchain/embeddings/cohere.py @@ -22,7 +22,7 @@ class CohereEmbeddings(BaseModel, Embeddings): """ client: Any #: :meta private: - model: str = "medium" + model: str = "large" """Model name to use.""" cohere_api_key: Optional[str] = None