Package Methods (0.14.0)

Summary of entries of Methods for langchain-google-alloydb-pg.

langchain_google_alloydb_pg.engine._get_iam_principal_email

_get_iam_principal_email(credentials: google.auth.credentials.Credentials) -> str

Get email address associated with current authenticated IAM principal.

See more: langchain_google_alloydb_pg.engine._get_iam_principal_email

langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory

AlloyDBChatMessageHistory(
    key: object,
    engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
    history: langchain_google_alloydb_pg.async_chat_message_history.AsyncAlloyDBChatMessageHistory,
)

AlloyDBChatMessageHistory constructor.

See more: langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory

langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.aadd_message

aadd_message(message: langchain_core.messages.base.BaseMessage) -> None

langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.aadd_messages

aadd_messages(
    messages: typing.Sequence[langchain_core.messages.base.BaseMessage],
) -> None

Append a list of messages to the record in AlloyDB.

See more: langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.aadd_messages

langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.aclear

aclear() -> None

langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.add_message

add_message(message: langchain_core.messages.base.BaseMessage) -> None

langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.add_messages

add_messages(
    messages: typing.Sequence[langchain_core.messages.base.BaseMessage],
) -> None

Append a list of messages to the record in AlloyDB.

See more: langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.add_messages

langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.clear

clear() -> None

langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.create

create(
    engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
    session_id: str,
    table_name: str,
    schema_name: str = "public",
) -> langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory

Create a new AlloyDBChatMessageHistory instance.

See more: langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.create

langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.create_sync

create_sync(
    engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
    session_id: str,
    table_name: str,
    schema_name: str = "public",
) -> langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory

Create a new AlloyDBChatMessageHistory instance.

See more: langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.create_sync

langchain_google_alloydb_pg.engine.AlloyDBEngine

AlloyDBEngine(
    key: object,
    pool: sqlalchemy.ext.asyncio.engine.AsyncEngine,
    loop: typing.Optional[asyncio.events.AbstractEventLoop],
    thread: typing.Optional[threading.Thread],
)

PGEngine constructor.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine

langchain_google_alloydb_pg.engine.AlloyDBEngine._ainit_chat_history_table

_ainit_chat_history_table(table_name: str, schema_name: str = "public") -> None

Create an AlloyDB table to save chat history messages.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._ainit_chat_history_table

langchain_google_alloydb_pg.engine.AlloyDBEngine._ainit_checkpoint_table

_ainit_checkpoint_table(
    table_name: str = "checkpoints", schema_name: str = "public"
) -> None

Create AlloyDB tables to save checkpoints.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._ainit_checkpoint_table

langchain_google_alloydb_pg.engine.AlloyDBEngine._ainit_document_table

_ainit_document_table(
    table_name: str,
    schema_name: str = "public",
    content_column: str = "page_content",
    metadata_columns: list[langchain_postgres.v2.engine.Column] = [],
    metadata_json_column: str = "langchain_metadata",
    store_metadata: bool = True,
) -> None

Create a table for saving of langchain documents.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._ainit_document_table

langchain_google_alloydb_pg.engine.AlloyDBEngine._aload_table_schema

_aload_table_schema(
    table_name: str, schema_name: str = "public"
) -> sqlalchemy.sql.schema.Table

Load table schema from an existing table in a PgSQL database, potentially from a specific database schema.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._aload_table_schema

langchain_google_alloydb_pg.engine.AlloyDBEngine._create

_create(
    project_id: str,
    region: str,
    cluster: str,
    instance: str,
    database: str,
    ip_type: typing.Union[str, google.cloud.alloydbconnector.enums.IPTypes],
    user: typing.Optional[str] = None,
    password: typing.Optional[str] = None,
    loop: typing.Optional[asyncio.events.AbstractEventLoop] = None,
    thread: typing.Optional[threading.Thread] = None,
    iam_account_email: typing.Optional[str] = None,
    engine_args: typing.Mapping = {},
) -> langchain_google_alloydb_pg.engine.AlloyDBEngine

Create an AlloyDBEngine from an AlloyDB instance.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._create

langchain_google_alloydb_pg.engine.AlloyDBEngine.afrom_instance

afrom_instance(
    project_id: str,
    region: str,
    cluster: str,
    instance: str,
    database: str,
    user: typing.Optional[str] = None,
    password: typing.Optional[str] = None,
    ip_type: typing.Union[
        str, google.cloud.alloydbconnector.enums.IPTypes
    ] = IPTypes.PUBLIC,
    iam_account_email: typing.Optional[str] = None,
    engine_args: typing.Mapping = {},
) -> langchain_google_alloydb_pg.engine.AlloyDBEngine

Create an AlloyDBEngine from an AlloyDB instance.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.afrom_instance

langchain_google_alloydb_pg.engine.AlloyDBEngine.ainit_chat_history_table

ainit_chat_history_table(table_name: str, schema_name: str = "public") -> None

Create an AlloyDB table to save chat history messages.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.ainit_chat_history_table

langchain_google_alloydb_pg.engine.AlloyDBEngine.ainit_checkpoint_table

ainit_checkpoint_table(
    table_name: str = "checkpoints", schema_name: str = "public"
) -> None

Create an AlloyDB table to save checkpoint messages.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.ainit_checkpoint_table

langchain_google_alloydb_pg.engine.AlloyDBEngine.ainit_document_table

ainit_document_table(
    table_name: str,
    schema_name: str = "public",
    content_column: str = "page_content",
    metadata_columns: list[langchain_postgres.v2.engine.Column] = [],
    metadata_json_column: str = "langchain_metadata",
    store_metadata: bool = True,
) -> None

Create a table for saving of langchain documents.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.ainit_document_table

langchain_google_alloydb_pg.engine.AlloyDBEngine.from_connection_string

from_connection_string(
    url: str | sqlalchemy.engine.url.URL, **kwargs: typing.Any
) -> langchain_google_alloydb_pg.engine.AlloyDBEngine

Create an AlloyDBEngine instance from arguments.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.from_connection_string

langchain_google_alloydb_pg.engine.AlloyDBEngine.from_engine_args

from_engine_args(
    url: str | sqlalchemy.engine.url.URL, **kwargs: typing.Any
) -> langchain_google_alloydb_pg.engine.AlloyDBEngine

Create an AlloyDBEngine instance from arguments .

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.from_engine_args

langchain_google_alloydb_pg.engine.AlloyDBEngine.from_instance

from_instance(
    project_id: str,
    region: str,
    cluster: str,
    instance: str,
    database: str,
    user: typing.Optional[str] = None,
    password: typing.Optional[str] = None,
    ip_type: typing.Union[
        str, google.cloud.alloydbconnector.enums.IPTypes
    ] = IPTypes.PUBLIC,
    iam_account_email: typing.Optional[str] = None,
    engine_args: typing.Mapping = {},
) -> langchain_google_alloydb_pg.engine.AlloyDBEngine

Create an AlloyDBEngine from an AlloyDB instance.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.from_instance

langchain_google_alloydb_pg.engine.AlloyDBEngine.init_chat_history_table

init_chat_history_table(table_name: str, schema_name: str = "public") -> None

Create a Cloud SQL table to store chat history.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.init_chat_history_table

langchain_google_alloydb_pg.engine.AlloyDBEngine.init_checkpoint_table

init_checkpoint_table(
    table_name: str = "checkpoints", schema_name: str = "public"
) -> None

Create Cloud SQL tables to store checkpoints.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.init_checkpoint_table

langchain_google_alloydb_pg.engine.AlloyDBEngine.init_document_table

init_document_table(
    table_name: str,
    schema_name: str = "public",
    content_column: str = "page_content",
    metadata_columns: list[langchain_postgres.v2.engine.Column] = [],
    metadata_json_column: str = "langchain_metadata",
    store_metadata: bool = True,
) -> None

Create a table for saving of langchain documents.

See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.init_document_table

langchain_google_alloydb_pg.indexes.IVFIndex.index_options

index_options() -> str

Set index query options for vector store initialization.

See more: langchain_google_alloydb_pg.indexes.IVFIndex.index_options

langchain_google_alloydb_pg.indexes.IVFQueryOptions.to_parameter

to_parameter() -> list[str]

Convert index attributes to list of configurations.

See more: langchain_google_alloydb_pg.indexes.IVFQueryOptions.to_parameter

langchain_google_alloydb_pg.indexes.IVFQueryOptions.to_string

to_string() -> str

Convert index attributes to string.

See more: langchain_google_alloydb_pg.indexes.IVFQueryOptions.to_string

langchain_google_alloydb_pg.indexes.ScaNNIndex.index_options

index_options() -> str

Set index query options for vector store initialization.

See more: langchain_google_alloydb_pg.indexes.ScaNNIndex.index_options

langchain_google_alloydb_pg.indexes.ScaNNQueryOptions.to_parameter

to_parameter() -> list[str]

Convert index attributes to list of configurations.

See more: langchain_google_alloydb_pg.indexes.ScaNNQueryOptions.to_parameter

langchain_google_alloydb_pg.indexes.ScaNNQueryOptions.to_string

to_string() -> str

Convert index attributes to string.

See more: langchain_google_alloydb_pg.indexes.ScaNNQueryOptions.to_string

langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver

AlloyDBDocumentSaver(
    key: object,
    engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
    saver: langchain_google_alloydb_pg.async_loader.AsyncAlloyDBDocumentSaver,
)

AlloyDBDocumentSaver constructor.

See more: langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver

langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver.aadd_documents

aadd_documents(docs: list[langchain_core.documents.base.Document]) -> None

Save documents in the DocumentSaver table.

See more: langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver.aadd_documents

langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver.add_documents

add_documents(docs: list[langchain_core.documents.base.Document]) -> None

Save documents in the DocumentSaver table.

See more: langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver.add_documents

langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver.adelete

adelete(docs: list[langchain_core.documents.base.Document]) -> None

Delete all instances of a document from the DocumentSaver table by matching the entire Document object.

See more: langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver.adelete

langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver.create

create(
    engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
    table_name: str,
    schema_name: str = "public",
    content_column: str = "page_content",
    metadata_columns: list[str] = [],
    metadata_json_column: typing.Optional[str] = "langchain_metadata",
) -> langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver

Create an AlloyDBDocumentSaver instance.

See more: langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver.create

langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver.create_sync

create_sync(
    engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
    table_name: str,
    schema_name: str = "public",
    content_column: str = "page_content",
    metadata_columns: list[str] = [],
    metadata_json_column: str = "langchain_metadata",
) -> langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver

Create an AlloyDBDocumentSaver instance.

See more: langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver.create_sync

langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver.delete

delete(docs: list[langchain_core.documents.base.Document]) -> None

Delete all instances of a document from the DocumentSaver table by matching the entire Document object.

See more: langchain_google_alloydb_pg.loader.AlloyDBDocumentSaver.delete

langchain_google_alloydb_pg.loader.AlloyDBLoader

AlloyDBLoader(
    key: object,
    engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
    loader: langchain_google_alloydb_pg.async_loader.AsyncAlloyDBLoader,
)

AlloyDBLoader constructor.

See more: langchain_google_alloydb_pg.loader.AlloyDBLoader

langchain_google_alloydb_pg.loader.AlloyDBLoader.alazy_load

alazy_load() -> typing.AsyncIterator[langchain_core.documents.base.Document]

Load PostgreSQL data into Document objects lazily.

See more: langchain_google_alloydb_pg.loader.AlloyDBLoader.alazy_load

langchain_google_alloydb_pg.loader.AlloyDBLoader.aload

aload() -> list[langchain_core.documents.base.Document]

Load PostgreSQL data into Document objects.

See more: langchain_google_alloydb_pg.loader.AlloyDBLoader.aload

langchain_google_alloydb_pg.loader.AlloyDBLoader.create

create(
    engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
    query: typing.Optional[str] = None,
    table_name: typing.Optional[str] = None,
    schema_name: str = "public",
    content_columns: typing.Optional[list[str]] = None,
    metadata_columns: typing.Optional[list[str]] = None,
    metadata_json_column: typing.Optional[str] = None,
    format: typing.Optional[str] = None,
    formatter: typing.Optional[typing.Callable] = None,
) -> langchain_google_alloydb_pg.loader.AlloyDBLoader

Create a new AlloyDBLoader instance.

See more: langchain_google_alloydb_pg.loader.AlloyDBLoader.create

langchain_google_alloydb_pg.loader.AlloyDBLoader.create_sync

create_sync(
    engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
    query: typing.Optional[str] = None,
    table_name: typing.Optional[str] = None,
    schema_name: str = "public",
    content_columns: typing.Optional[list[str]] = None,
    metadata_columns: typing.Optional[list[str]] = None,
    metadata_json_column: typing.Optional[str] = None,
    format: typing.Optional[str] = None,
    formatter: typing.Optional[typing.Callable] = None,
) -> langchain_google_alloydb_pg.loader.AlloyDBLoader

Create a new AlloyDBLoader instance.

See more: langchain_google_alloydb_pg.loader.AlloyDBLoader.create_sync

langchain_google_alloydb_pg.loader.AlloyDBLoader.lazy_load

lazy_load() -> typing.Iterator[langchain_core.documents.base.Document]

Load PostgreSQL data into Document objects lazily.

See more: langchain_google_alloydb_pg.loader.AlloyDBLoader.lazy_load

langchain_google_alloydb_pg.loader.AlloyDBLoader.load

load() -> list[langchain_core.documents.base.Document]

Load PostgreSQL data into Document objects.

See more: langchain_google_alloydb_pg.loader.AlloyDBLoader.load

langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore

AlloyDBVectorStore(
    key: object,
    engine: langchain_postgres.v2.engine.PGEngine,
    vs: langchain_postgres.v2.async_vectorstore.AsyncPGVectorStore,
)

langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.aadd_images

aadd_images(
    uris: list[str],
    metadatas: typing.Optional[list[dict]] = None,
    ids: typing.Optional[list[str]] = None,
    store_uri_only: bool = False,
    **kwargs: typing.Any
) -> list[str]

langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.add_images

add_images(
    uris: list[str],
    metadatas: typing.Optional[list[dict]] = None,
    ids: typing.Optional[list[str]] = None,
    store_uri_only: bool = False,
    **kwargs: typing.Any
) -> list[str]

Embed images and add to the table.

See more: langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.add_images

langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.aset_maintenance_work_mem

aset_maintenance_work_mem(num_leaves: int, vector_size: int) -> None

Set database maintenance work memory (for ScaNN index creation).

See more: langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.aset_maintenance_work_mem

langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.asimilarity_search_image

asimilarity_search_image(
    image_uri: str,
    k: typing.Optional[int] = None,
    filter: typing.Optional[dict] = None,
    **kwargs: typing.Any
) -> list[langchain_core.documents.base.Document]

Return docs selected by similarity search on image_uri.

See more: langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.asimilarity_search_image

langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.create

create(
    engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
    embedding_service: langchain_core.embeddings.embeddings.Embeddings,
    table_name: str,
    schema_name: str = "public",
    content_column: str = "content",
    embedding_column: str = "embedding",
    metadata_columns: typing.Optional[list[str]] = None,
    ignore_metadata_columns: typing.Optional[list[str]] = None,
    id_column: str = "langchain_id",
    metadata_json_column: typing.Optional[str] = "langchain_metadata",
    distance_strategy: langchain_postgres.v2.indexes.DistanceStrategy = DistanceStrategy.COSINE_DISTANCE,
    k: int = 4,
    fetch_k: int = 20,
    lambda_mult: float = 0.5,
    index_query_options: typing.Optional[
        langchain_postgres.v2.indexes.QueryOptions
    ] = None,
    hybrid_search_config: typing.Optional[
        langchain_postgres.v2.hybrid_search_config.HybridSearchConfig
    ] = None,
) -> langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore

Create an PGVectorStore instance.

See more: langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.create

langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.create_sync

create_sync(
    engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
    embedding_service: langchain_core.embeddings.embeddings.Embeddings,
    table_name: str,
    schema_name: str = "public",
    content_column: str = "content",
    embedding_column: str = "embedding",
    metadata_columns: typing.Optional[list[str]] = None,
    ignore_metadata_columns: typing.Optional[list[str]] = None,
    id_column: str = "langchain_id",
    metadata_json_column: str = "langchain_metadata",
    distance_strategy: langchain_postgres.v2.indexes.DistanceStrategy = DistanceStrategy.COSINE_DISTANCE,
    k: int = 4,
    fetch_k: int = 20,
    lambda_mult: float = 0.5,
    index_query_options: typing.Optional[
        langchain_postgres.v2.indexes.QueryOptions
    ] = None,
    hybrid_search_config: typing.Optional[
        langchain_postgres.v2.hybrid_search_config.HybridSearchConfig
    ] = None,
) -> langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore

Create an AlloyDBVectorStore instance.

See more: langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.create_sync

langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.set_maintenance_work_mem

set_maintenance_work_mem(num_leaves: int, vector_size: int) -> None

Set database maintenance work memory (for ScaNN index creation).

See more: langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.set_maintenance_work_mem

langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.similarity_search_image

similarity_search_image(
    image_uri: str,
    k: typing.Optional[int] = None,
    filter: typing.Optional[dict] = None,
    **kwargs: typing.Any
) -> list[langchain_core.documents.base.Document]

Return docs selected by similarity search on image.

See more: langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.similarity_search_image