microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
31.45k stars 4.58k forks source link

[Bug]: ChromaDB OpenAI embedding function is not working #2979

Closed StamKavid closed 3 months ago

StamKavid commented 3 months ago

Describe the bug

I have the below code:

openai_ef = OpenAIEmbeddingFunction( api_key= os.getenv("AZURE_OPENAI_API_KEY"), api_base= os.getenv("AZURE_OPENAI_ENDPOINT"), model_name= "text-embedding-ada-002" )

While I am passing it to RetrieveUserProxyAgent as "embedding_function" : openai_ef, i am still getting the below error:

autogen.agentchat.contrib.vectordb.chromadb - INFO - No content embedding is provided. Will use the VectorDB's embedding function to generate the content embedding.

Also in the logs, the link: https://docs.trychroma.com/embeddings is not existing anymore (404)

Steps to reproduce

No response

Model Used

text-embeddings-ada-002

Expected Behavior

TO pass the embedding function into ChromaDB and overpass the default state

Screenshots and logs

image image

Additional Information

No response

nithinkodithyala commented 3 months ago

Verify Compatibility: Ensure that the RetrieveUserProxyAgent accepts the embedding function in the manner you're providing it. There might be specific requirements or ways to pass the embedding function. also try this method {chromadb_client = ChromaDB(embedding_function=openai_ef)}

StamKavid commented 3 months ago

@nithinkodithyala Thank you very much for the prompt response.

I tried "client": Chroma(client = chromadb.PersistentClient(path="/tmp/chromadb/test"), collection_name="groupchat-collection", embedding_function=embeddings),

but still doesn't seem to solve this.

StamKavid commented 3 months ago

I can confirm that it is working with the below settings:

"client": chromadb.PersistentClient().get_or_create_collection(name = 'autogen_agent', embedding_function=openai_ef)