API documentation for alloydb_vectorstore
module.
Classes
AlloyDBVectorStore
AlloyDBVectorStore(
key,
engine: langchain_google_alloydb_pg.alloydb_engine.AlloyDBEngine,
embedding_service: langchain_core.embeddings.embeddings.Embeddings,
table_name: str,
content_column: str = "content",
embedding_column: str = "embedding",
metadata_columns: typing.List[str] = [],
id_column: str = "langchain_id",
metadata_json_column: typing.Optional[str] = "langchain_metadata",
distance_strategy: langchain_google_alloydb_pg.indexes.DistanceStrategy = DistanceStrategy.COSINE_DISTANCE,
k: int = 4,
fetch_k: int = 20,
lambda_mult: float = 0.5,
index_query_options: typing.Optional[
langchain_google_alloydb_pg.indexes.QueryOptions
] = None,
)
Google AlloyDB Vector Store class
Modules Functions
cosine_similarity
cosine_similarity(
X: typing.Union[
typing.List[typing.List[float]], typing.List[numpy.ndarray], numpy.ndarray
],
Y: typing.Union[
typing.List[typing.List[float]], typing.List[numpy.ndarray], numpy.ndarray
],
) -> numpy.ndarray
Row-wise cosine similarity between two equal-width matrices.
maximal_marginal_relevance
maximal_marginal_relevance(
query_embedding: numpy.ndarray,
embedding_list: list,
lambda_mult: float = 0.5,
k: int = 4,
) -> typing.List[int]
Calculate maximal marginal relevance.