Return docs most similar to query.
Parameters
embedding – Embedding vector to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None.
fetch_k – (Optional[int]) Number of Documents to fetch before filtering.
Defaults to 20.
Returns
List of documents most similar to the query text and L2 distance
in float for each. Lower score represents more similarity.
class langchain.vectorstores.Hologres(connection_string: str, embedding_function: langchain.embeddings.base.Embeddings, ndims: int = 1536, table_name: str = 'langchain_pg_embedding', pre_delete_table: bool = False, logger: Optional[logging.Logger] = None)[source]#
VectorStore implementation using Hologres.
- connection_string is a hologres connection string.
- embedding_function any embedding function implementing
langchain.embeddings.base.Embeddings interface.
ndims is the number of dimensions of the embedding output.
table_name is the name of the table to store embeddings and data.(default: langchain_pg_embedding)
- NOTE: The table will be created when initializing the store (if not exists)
So, make sure the user has the right permissions to create tables.
pre_delete_table if True, will delete the table if it exists.(default: False)
- Useful for testing.
add_embeddings(texts: Iterable[str], embeddings: List[List[float]], metadatas: List[dict], ids: List[str], **kwargs: Any) → None[source]#
Add embeddings to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
embeddings – List of list of embedding vectors.
metadatas – List of metadatas associated with the texts.
kwargs – vectorstore specific parameters
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html