Chromadb embedding to FAISS.from_embeddings for query to document #10625
Replies: 2 comments
-
🤖 Hello, From the error message you provided, it seems like the The Here is the relevant part of the code: @classmethod
def from_embeddings(
cls,
text_embeddings: Iterable[Tuple[str, List[float]]],
embedding: Embeddings,
metadatas: Optional[Iterable[dict]] = None,
ids: Optional[List[str]] = None,
**kwargs: Any,
) -> FAISS:
"""Construct FAISS wrapper from raw documents.
This is a user friendly interface that:
1. Embeds documents.
2. Creates an in memory docstore
3. Initializes the FAISS database
This is intended to be a quick way to get started.
Example:
.. code-block:: python
from langchain import FAISS
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
text_embeddings = embeddings.embed_documents(texts)
text_embedding_pairs = zip(texts, text_embeddings)
faiss = FAISS.from_embeddings(text_embedding_pairs, embeddings)
"""
texts = [t[0] for t in text_embeddings]
embeddings = [t[1] for t in text_embeddings]
return cls.__from(
texts,
embeddings,
embedding,
metadatas=metadatas,
ids=ids,
**kwargs,
) In your case, you are trying to load embeddings from ChromaDB and pass them to FAISS. The Please double-check that the check_chroma=Chroma.get(include=["embeddings","metadatas","documents"])
embeddings=check_chroma["embeddings"]
print(len(embeddings)) If the length is 0, then the I hope this helps! Let me know if you have any other questions. 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.
-
i read your code in faiss vectorsearch and i think i know why my embeddings is empty.
this code i think is the problem ?.
can you tell me how to make the embeddings not empty list ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
so i have a question, can i use embedding that i already store in chromadb and load it with faiss.from_embeddings ?
i already try it but i encounter some difficulty, this is how i try it:
it throw error:
can you tell me how to do it ?
thank you
Beta Was this translation helpful? Give feedback.
All reactions