mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

Fix cohere embedder

Open LeonieFreisinger opened this issue 1 year ago • 3 comments

Description

Fix the usage of the cohere embedder. Changes:

  • add langchain_cohere package (from langchain_community.embeddings import CohereEmbeddings is deprecated)
  • add 'cohere' to the validate_config of the embedder model

Fixes # (issue) #1346

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Please delete options that are not relevant. test_langchain_default_concept() is failing. However, it also fails on the origin/main branch when running the test locally.

  • [x] Test Script (please provide)
import os
from embedchain import App

os.environ["OPENAI_API_KEY"] = "sk-XXX"
os.environ["COHERE_API_KEY"] = "XXX"

app = App.from_config(config_path="config.yaml")

app.add("https://www.forbes.com/profile/elon-musk")
answer = app.query("What is the net worth of Elon Musk today?")
print(answer)

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [ ] New and existing unit tests pass locally with my changes
  • [x] Any dependent changes have been merged and published in downstream modules
  • [x] I have checked my code and corrected any misspellings

Maintainer Checklist

  • [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
  • [ ] Made sure Checks passed

LeonieFreisinger avatar May 03 '24 02:05 LeonieFreisinger

@deshraj test_langchain_default_concept() is failing when running the code locally. It also fails when running origin/main code locally. Could this be due to my local setup? I assume my fix does not cause the test to fail.

LeonieFreisinger avatar May 03 '24 02:05 LeonieFreisinger

@LeonieFreisinger thanks for pointing out. I will look into this and get it fixed soon.

Is your PR ready for review though? I will try to pull it on my local and test it if ready.

deshraj avatar May 03 '24 21:05 deshraj

@deshraj Thanks! Yes, besides this it is ready for review

LeonieFreisinger avatar May 13 '24 05:05 LeonieFreisinger