Chromadb: how to convert dict result from "Chroma.get()" to langchain.vectorstores.chroma.Chroma object #10030
Replies: 1 comment
-
🤖 Hello, From your code, it seems like you're trying to convert the dictionary returned by If you want to use the Here's an example of how you might use the from langchain.vectorstores import Chroma
from langchain.retrievers import QAChain
# Initialize the Chroma vectorstore
vectorstore = Chroma(persist_directory="./db",embedding_function=HuggingFaceEmbeddings())
# Use the vectorstore as a retriever for QAChain
retriever = QAChain(vectorstore.as_retriever()) In this example, If you need to work with a subset of the data in the vectorstore, you might consider creating a new I hope this helps! If you have further questions, feel free to ask. 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. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
hi guys,
so i have a condition where i have to maintain chromadb for each document at any time by id and only query the selected documents with the required id.
but I found a problem when after I get data from chromadb it becomes to dictionary not the class object. so how can I return the data that I have gotten into a langchain.vectorstores.chroma.Chroma object. i'm using pymongo to store the ids and query back to chromadb.
this is maybe the simple code to get the dictionary from Chroma.get():
so my question, how to process the output so it becomes back to langchain.vectorstores.chroma.Chroma object so i can run .as_retriever() for QAchain.
thank you.
Beta Was this translation helpful? Give feedback.
All reactions