Initialize a vector store with a set of documents.
Postgres connection string is required
"Either pass it as connection_string parameter
or set the LANTERN_CONNECTION_STRING environment variable.
connection_string is a postgres connection string.documents is list of :class:Document to initialize the vector store withembedding is :class:Embeddings that will be used for
embedding the text sent. If none is sent, then the
multilingual Tensorflow Universal Sentence Encoder will be used.collection_name is the name of the collection to use. (default: langchain)
distance_strategy is the distance strategy to use. (default: EUCLIDEAN)
EUCLIDEAN is the euclidean distance.COSINE is the cosine distance.HAMMING is the hamming distance.ids row ids to insert into collection.pre_delete_collection if True, will delete the collection if it exists.
(default: False)
from_documents(
cls: Type[Lantern],
documents: List[Document],
embedding: Embeddings,
collection_name: str = _LANGCHAIN_DEFAULT_COLLECTION_NAME,
distance_strategy: DistanceStrategy = DEFAULT_DISTANCE_STRATEGY,
ids: Optional[List[str]] = None,
pre_delete_collection: bool = False,
**kwargs: Any = {}
) -> Lantern