Return VectorStore initialized from documents and embeddings. Args: documents: List of Documents to add to the vectorstore. embedding: Embedding function to use.
(
cls: Type[VST],
documents: List[Document],
embedding: Embeddings,
**kwargs: Any,
)
| 675 | |
| 676 | @classmethod |
| 677 | def from_documents( |
| 678 | cls: Type[VST], |
| 679 | documents: List[Document], |
| 680 | embedding: Embeddings, |
| 681 | **kwargs: Any, |
| 682 | ) -> VST: |
| 683 | """Return VectorStore initialized from documents and embeddings. |
| 684 | |
| 685 | Args: |
| 686 | documents: List of Documents to add to the vectorstore. |
| 687 | embedding: Embedding function to use. |
| 688 | """ |
| 689 | texts = [d.page_content for d in documents] |
| 690 | metadatas = [d.metadata for d in documents] |
| 691 | return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs) |
| 692 | |
| 693 | @classmethod |
| 694 | async def afrom_documents( |
no test coverage detected