from_texts(
cls: type[PGVectorStore],
texts: list[str]| Name | Type | Description |
|---|---|---|
texts* | list[str] | Texts to add to the vector store. |
embedding* | Embeddings | Text embedding model to use. |
engine* | PGEngine | Connection pool engine for managing connections to postgres database. |
table_name* | str | |
schema_name | str | Default: 'public' |
metadatas | Optional[list[dict]] | Default: None |
ids | Optional[list] | Default: None |
content_column | str | Default: 'content' |
embedding_column | str | Default: 'embedding' |
metadata_columns | list[str] | Default: None |
ignore_metadata_columns | Optional[list[str]] | Default: None |
id_column | str | Default: 'langchain_id' |
metadata_json_column | str | Default: 'langchain_metadata' |
distance_strategy | DistanceStrategy | Default: DEFAULT_DISTANCE_STRATEGY |
k | int | Default: 4 |
fetch_k | int | Default: 20 |
lambda_mult | float | Default: 0.5 |
index_query_options | QueryOptions | Default: None |
hybrid_search_config | HybridSearchConfig | Default: None |
Create an PGVectorStore instance from texts.
Name of an existing table.
Name of the database schema. Defaults to "public".
List of metadatas to add to table records. Defaults to None.
(Optional[list]): List of IDs to add to table records. Defaults to None.
Column that represent a Document's page_content. Defaults to "content".
Column for embedding vectors. The embedding is generated from the document value. Defaults to "embedding".
Column(s) that represent a document's metadata. Defaults to empty list.
Column(s) to ignore in pre-existing tables for a document's metadata. Can not be used with metadata_columns. Defaults to None.
Column that represents the Document's id. Defaults to "langchain_id".
Column to store metadata as JSON. Defaults to "langchain_metadata".
Distance strategy to use for vector similarity search. Defaults to COSINE_DISTANCE.
Number of Documents to return from search. Defaults to 4.
Number of Documents to fetch to pass to MMR algorithm.
Number between 0 and 1 that determines the degree of diversity among the results with 0 corresponding to maximum diversity and 1 to minimum diversity. Defaults to 0.5.
Index query option.
Hybrid search configuration. Defaults to None.