-
Notifications
You must be signed in to change notification settings - Fork 16.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple values for keyword argument 'embedding_function' #13050
Comments
🤖 Hello @95! I'm Dosu, a bot here to assist you with LangChain. I can help you troubleshoot bugs, answer your questions, and guide you on how to contribute to our repository. While we wait for a human maintainer to join us, feel free to ask me anything. I'm currently reviewing your issue and will get back to you with a full response as soon as possible. |
🤖 Based on the error message you're receiving, it seems like there might be a conflict with the Looking at the signature of the @classmethod
def from_documents(
cls: Type[Chroma],
documents: List[Document],
embedding: Optional[Embeddings] = None,
ids: Optional[List[str]] = None,
collection_name: str = _LANGCHAIN_DEFAULT_COLLECTION_NAME,
persist_directory: Optional[str] = None,
client_settings: Optional[chromadb.config.Settings] = None,
client: Optional[chromadb.Client] = None,
collection_metadata: Optional[Dict] = None,
**kwargs: Any,
) -> Chroma: It appears that the from langchain.vectorstores import Chroma
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
vectorstore = Chroma.from_documents(documents=splits, embedding=embeddings, persist_directory='/content/wtf')
vectorstore.persist()
retriever = vectorstore.as_retriever() Please try this modification and let me know if it resolves your issue. If not, please provide any additional error messages or information that could help diagnose the problem. Sources
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. |
Hi, @95, I'm helping the LangChain team manage their backlog and am marking this issue as stale. From what I understand, the issue involved a TypeError in the Could you please confirm if this issue is still relevant to the latest version of the LangChain repository? If it is, please let the LangChain 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! |
@95 I found the error. if you use Chroma.from_documents you should use
if you use Chroma you should use
|
System Info
Running on google colab.
Everything was working up until today, which makes me think it's openAi update-related.
Versions:
Requirement already satisfied: langchain in /usr/local/lib/python3.10/dist-packages (0.0.331)
Requirement already satisfied: chromadb in /usr/local/lib/python3.10/dist-packages (0.4.16)
Openai version pinned to 0.28.1 as @hwchase17 recommended prior -- which had fixed my embeddings issue.
Who can help?
@hwchase17 @agola11
Information
Related Components
Reproduction
TypeError Traceback (most recent call last)
in <cell line: 7>()
5
6 embeddings = OpenAIEmbeddings()
----> 7 vectorstore = Chroma.from_documents(documents=splits, embedding_function=embeddings, persist_directory='/content/wtf')
8 vectorstore.persist()
9 retriever = vectorstore.as_retriever()
1 frames
/usr/local/lib/python3.10/dist-packages/langchain/vectorstores/chroma.py in from_texts(cls, texts, embedding, metadatas, ids, collection_name, persist_directory, client_settings, client, collection_metadata, **kwargs)
618 Chroma: Chroma vectorstore.
619 """
--> 620 chroma_collection = cls(
621 collection_name=collection_name,
622 embedding_function=embedding,
TypeError: langchain.vectorstores.chroma.Chroma() got multiple values for keyword argument 'embedding_function'
Expected behavior
It should run without an error and correctly embed the document splits, outputting the data in the persist directory.
The text was updated successfully, but these errors were encountered: