Skip to content
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

VectorSearchVectorStore.add_texts assumes metadatas is a List[dict] when it should be List[List[dict]] #89

Closed
raulescalantem opened this issue Mar 26, 2024 · 2 comments

Comments

@raulescalantem
Copy link

Each text should be able to have a list of metadatas, however, current version only accepts List[dict]

@lkuligin
Copy link
Collaborator

@jzaldi

@jzaldi
Copy link
Contributor

jzaldi commented Apr 7, 2024

Hi @raulescalantem we follow the signature of langchain_core.vecorstores.VectorStore where add_texts is

 @abstractmethod
        def add_texts(
            self,
            texts: Iterable[str],
            metadatas: Optional[List[dict]] = None,
            **kwargs: Any,
        ) -> List[str]:
            """Run more texts through the embeddings and add to the vectorstore.

            Args:
                texts: Iterable of strings to add to the vectorstore.
                metadatas: Optional list of metadatas associated with the texts.
                kwargs: vectorstore specific parameters

            Returns:
                List of ids from adding the texts into the vectorstore.
            """

The metadata for each text is a dict.

For example:

  • texts = ["This is the page 1", "This is the page 2"]
  • metadatas = [{"page": 1, "source": "a_document.txt"}, {"page": 2, "source": "a_document.txt"}]

Am Im missing someething?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants