dify icon indicating copy to clipboard operation
dify copied to clipboard

Cohere embedding model not working

Open AndyMik90 opened this issue 1 year ago • 7 comments

Self Checks

  • [X] I have searched for existing issues search for existing issues, including closed ones.
  • [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [X] Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.5.8

Cloud or Self Hosted

Cloud, Self Hosted (Source)

Steps to reproduce

CleanShot 2024-03-05 at 21 03 24@2x Using Cohere embedding models does not work in Dify cloud or local. Tested with multiple fresh API keys.

✔️ Expected Behavior

Normal embedding process that works like OpenAI embedding models

❌ Actual Behavior

Nothing, no text preview or indexing happending

AndyMik90 avatar Mar 05 '24 20:03 AndyMik90

Hey there, @AndyMik90! Great to see you back. Hope you've been doing well since our last adventure through the code!

Thank you for reporting this issue. Based on the information you've provided, it seems like the Cohere embedding models are not functioning as expected in both the cloud and local versions of Dify.

From the context provided, the Cohere embedding models in Dify are used for credential validation, model invocation for text embedding, and token count calculation. If these functionalities are not working, it could be due to a variety of reasons.

Unfortunately, without an error message or log output, it's difficult to pinpoint the exact cause of the issue. It would be helpful if you could provide more details about the error you're encountering. For instance, are there any error messages displayed in the console or logs when you try to use the Cohere embedding models? If so, could you please share them?

In the meantime, you might want to check the following:

  1. API Key: Make sure that the API key you're using is valid and has the necessary permissions to access the Cohere embedding models. You can verify this by using the validate_credentials method in the CohereTextEmbeddingModel class.

  2. Model Name: Ensure that the model name you're using (embed-multilingual-v3.0) is correct and available in your Cohere account.

  3. Text Input: Check if the texts you're trying to embed are in a format that the Cohere models can process. The invoke method of the CohereTextEmbeddingModel class requires a list of texts as input.

  4. User Identifier: Make sure that the user identifier you're using when invoking the model is valid.

You can find more information about these functionalities in the test_text_embedding.py file in the Dify repository.

I hope this helps! Please provide more details if possible, and I'll do my best to assist you further.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

dosubot[bot] avatar Mar 05 '24 20:03 dosubot[bot]

Are you using a Trial key? The cohere trial key which is limited to 10 API calls / minute.
pls verify, thanks @AndyMik90

JohnJyong avatar Mar 06 '24 06:03 JohnJyong

@JohnJyong no I'm using production key.

AndyMik90 avatar Mar 06 '24 07:03 AndyMik90

it works fine with the model 'embed-multilingual-v2.0' in my side. pls provide your embedding model name, thanks @AndyMik90

JohnJyong avatar Mar 07 '24 02:03 JohnJyong

it works fine with the model 'embed-multilingual-v2.0' in my side. pls provide your embedding model name, thanks @AndyMik90

I tried with 'embed-multilingual-v3.0' and v2.0 but it does nothing. Tried with multiple fresh production keys, also multiple documents to test with, they work fine with OpenAI embedding models.

AndyMik90 avatar Mar 07 '24 14:03 AndyMik90

Hi, @AndyMik90,

I'm helping the team manage their backlog and am marking this issue as stale. From the discussion, it seems that you encountered an issue with the Cohere embedding model not functioning in Dify cloud or local environments, despite testing with multiple fresh API keys. Dosubot provided troubleshooting steps, and there was a discussion about the model versions and API keys being used. However, it appears that the issue remains unresolved.

Could you please confirm if this issue is still relevant to the latest version of the repository? If it is, kindly let the team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your understanding and cooperation. If you have any further information to share, please feel free to do so.

dosubot[bot] avatar Mar 29 '24 16:03 dosubot[bot]

I can confirm that the issue is still in place.

Here is how to reproduce:

  • Add cohere API to Dify Cloud in the model providers.
  • Use any cohere model, I tested "embed-english-v2.0", "embed-english-v3.0" and "embed-multilingual-v3.0" as system embedding model.
  • Upload a PDF and try to auto chunk it (tested also manual).
  • The indexing process never gets beyond 0%.

They all just stop on the indexing step: CleanShot 2024-03-29 at 21 47 57@2x

I double-checked that the API is working ,but using OpenAI embedding model, but using Cohere for reranking:

rerank-english: CleanShot 2024-03-29 at 21 43 12@2x

rerank-multilingual: CleanShot 2024-03-29 at 21 45 11@2x

AndyMik90 avatar Mar 29 '24 20:03 AndyMik90

I see this issue closed, but it has not been fixed.

AppendinoCom avatar Apr 21 '24 18:04 AppendinoCom