Summary of entries of Methods for langchain-google-alloydb-pg.
langchain_google_alloydb_pg.document_compressor._to_ranked_documents
_to_ranked_documents(
documents: typing.Sequence[langchain_core.documents.base.Document],
rows: typing.Sequence[typing.Sequence[typing.Any]],
) -> list[langchain_core.documents.base.Document]Map (index, score) rows from google_ml.rank back to documents.
See more: langchain_google_alloydb_pg.document_compressor._to_ranked_documents
langchain_google_alloydb_pg.engine._columnar_column_list
_columnar_column_list(columns: list[str]) -> strBuild the columns argument of google_columnar_engine_add.
See more: langchain_google_alloydb_pg.engine._columnar_column_list
langchain_google_alloydb_pg.engine._get_iam_principal_email
_get_iam_principal_email(credentials: google.auth.credentials.Credentials) -> strGet email address associated with current authenticated IAM principal.
See more: langchain_google_alloydb_pg.engine._get_iam_principal_email
langchain_google_alloydb_pg.engine._is_missing_object_error
_is_missing_object_error(error: BaseException, sqlstates: set[str]) -> boolReturn True if the DB-API error behind error has one of sqlstates.
See more: langchain_google_alloydb_pg.engine._is_missing_object_error
langchain_google_alloydb_pg.engine._quote_ident
_quote_ident(ident: str) -> strQuote a PostgreSQL identifier (doubling embedded double quotes).
langchain_google_alloydb_pg.engine._validate_field
_validate_field(value: typing.Any, name: str) -> NoneRaise ValueError unless value is a non-empty, non-blank string.
See more: langchain_google_alloydb_pg.engine._validate_field
langchain_google_alloydb_pg.indexes._is_int
_is_int(value: object) -> boolTrue for integers (including numpy integers), excluding bools.
langchain_google_alloydb_pg.tools._afetch_scalar
_afetch_scalar(
engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
query: str,
params: dict[str, typing.Any],
null_message: str,
) -> typing.AnyRun query and return its single value, raising if it is NULL.
langchain_google_alloydb_pg.tools._check_engine_loop
_check_engine_loop(
engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
) -> NoneRaise if a synchronous call would block the engine's own event loop.
See more: langchain_google_alloydb_pg.tools._check_engine_loop
langchain_google_alloydb_pg.tools._check_model_id
_check_model_id(value: typing.Optional[str]) -> typing.Optional[str]Reject a blank model ID.
langchain_google_alloydb_pg.tools._check_text
_check_text(value: str, name: str) -> strReject empty or whitespace-only text.
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) -> NoneAppend the message to the record in AlloyDB.
See more: langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.aadd_message
langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.aadd_messages
aadd_messages(
messages: typing.Sequence[langchain_core.messages.base.BaseMessage],
) -> NoneAppend 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() -> NoneClear session memory from AlloyDB.
See more: langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.aclear
langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.add_message
add_message(message: langchain_core.messages.base.BaseMessage) -> NoneAppend the message to the record in AlloyDB.
See more: langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.add_message
langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.add_messages
add_messages(
messages: typing.Sequence[langchain_core.messages.base.BaseMessage],
) -> NoneAppend 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() -> NoneClear session memory from AlloyDB.
See more: langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.clear
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.AlloyDBChatMessageHistoryCreate 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.AlloyDBChatMessageHistoryCreate a new AlloyDBChatMessageHistory instance.
See more: langchain_google_alloydb_pg.chat_message_history.AlloyDBChatMessageHistory.create_sync
langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.aget_tuple
aget_tuple(
config: langchain_core.runnables.config.RunnableConfig,
) -> typing.Optional[langgraph.checkpoint.base.CheckpointTuple]Asynchronously fetch a checkpoint tuple using the given configuration.
See more: langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.aget_tuple
langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.alist
alist(
config: typing.Optional[langchain_core.runnables.config.RunnableConfig],
filter: typing.Optional[dict[str, typing.Any]] = None,
before: typing.Optional[langchain_core.runnables.config.RunnableConfig] = None,
limit: typing.Optional[int] = None,
) -> typing.AsyncIterator[langgraph.checkpoint.base.CheckpointTuple]Asynchronously list checkpoints that match the given criteria.
See more: langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.alist
langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.aput
aput(
config: langchain_core.runnables.config.RunnableConfig,
checkpoint: langgraph.checkpoint.base.Checkpoint,
metadata: langgraph.checkpoint.base.CheckpointMetadata,
new_versions: dict[str, str | int | float],
) -> langchain_core.runnables.config.RunnableConfigAsynchronously store a checkpoint with its configuration and metadata.
See more: langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.aput
langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.aput_writes
aput_writes(
config: langchain_core.runnables.config.RunnableConfig,
writes: typing.Sequence[typing.Tuple[str, typing.Any]],
task_id: str,
task_path: str = "",
) -> NoneAsynchronously store intermediate writes linked to a checkpoint.
See more: langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.aput_writes
langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.create
create(
engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
table_name: str = "checkpoints",
schema_name: str = "public",
serde: typing.Optional[langgraph.checkpoint.serde.base.SerializerProtocol] = None,
) -> langchain_google_alloydb_pg.checkpoint.AlloyDBSaverCreate a new AlloyDBSaver instance.
See more: langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.create
langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.create_sync
create_sync(
engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
table_name: str = "checkpoints",
schema_name: str = "public",
serde: typing.Optional[langgraph.checkpoint.serde.base.SerializerProtocol] = None,
) -> langchain_google_alloydb_pg.checkpoint.AlloyDBSaverCreate a new AlloyDBSaver instance.
See more: langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.create_sync
langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.get_tuple
get_tuple(
config: langchain_core.runnables.config.RunnableConfig,
) -> typing.Optional[langgraph.checkpoint.base.CheckpointTuple]Get a checkpoint tuple from AlloyDB.
See more: langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.get_tuple
langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.list
list(
config: typing.Optional[langchain_core.runnables.config.RunnableConfig],
filter: typing.Optional[dict[str, typing.Any]] = None,
before: typing.Optional[langchain_core.runnables.config.RunnableConfig] = None,
limit: typing.Optional[int] = None,
) -> typing.Iterator[langgraph.checkpoint.base.CheckpointTuple]List checkpoints from AlloyDB.
See more: langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.list
langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.put
put(
config: langchain_core.runnables.config.RunnableConfig,
checkpoint: langgraph.checkpoint.base.Checkpoint,
metadata: langgraph.checkpoint.base.CheckpointMetadata,
new_versions: dict[str, str | int | float],
) -> langchain_core.runnables.config.RunnableConfigSave a checkpoint to the database.
See more: langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.put
langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.put_writes
put_writes(
config: langchain_core.runnables.config.RunnableConfig,
writes: typing.Sequence[tuple[str, typing.Any]],
task_id: str,
task_path: str = "",
) -> NoneStore intermediate writes linked to a checkpoint.
See more: langchain_google_alloydb_pg.checkpoint.AlloyDBSaver.put_writes
langchain_google_alloydb_pg.document_compressor.AlloyDBDocumentCompressor
AlloyDBDocumentCompressor(
*,
engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
model_id: str,
top_n: typing.Optional[int] = None
)Create a new model by parsing and validating input data from keyword arguments.
See more: langchain_google_alloydb_pg.document_compressor.AlloyDBDocumentCompressor
langchain_google_alloydb_pg.document_compressor.AlloyDBDocumentCompressor.__acompress_documents
__acompress_documents(
documents: typing.Sequence[langchain_core.documents.base.Document], query: str
) -> list[langchain_core.documents.base.Document]Validate the input, call google_ml.rank and map the rows back.
See more: langchain_google_alloydb_pg.document_compressor.AlloyDBDocumentCompressor.__acompress_documents
langchain_google_alloydb_pg.document_compressor.AlloyDBDocumentCompressor.acompress_documents
acompress_documents(
documents: typing.Sequence[langchain_core.documents.base.Document],
query: str,
callbacks: typing.Optional[
typing.Union[
list[langchain_core.callbacks.base.BaseCallbackHandler],
langchain_core.callbacks.base.BaseCallbackManager,
]
] = None,
) -> typing.Sequence[langchain_core.documents.base.Document]Rerank documents by relevance to the query.
See more: langchain_google_alloydb_pg.document_compressor.AlloyDBDocumentCompressor.acompress_documents
langchain_google_alloydb_pg.document_compressor.AlloyDBDocumentCompressor.compress_documents
compress_documents(
documents: typing.Sequence[langchain_core.documents.base.Document],
query: str,
callbacks: typing.Optional[
typing.Union[
list[langchain_core.callbacks.base.BaseCallbackHandler],
langchain_core.callbacks.base.BaseCallbackManager,
]
] = None,
) -> typing.Sequence[langchain_core.documents.base.Document]Rerank documents by relevance to the query.
See more: langchain_google_alloydb_pg.document_compressor.AlloyDBDocumentCompressor.compress_documents
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings
AlloyDBEmbeddings(
key: object, engine: langchain_google_alloydb_pg.engine.AlloyDBEngine, model_id: str
)AlloyDBEmbeddings constructor.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.__aembed_image
__aembed_image(image_uri: str) -> list[float]Coroutine for generating embeddings for a given image.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.__aembed_image
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.__aembed_query
__aembed_query(query: str) -> list[float]Coroutine for generating embeddings for a given query.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.__aembed_query
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.__amodel_exists
__amodel_exists() -> boolChecks if the embedding model exists.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.__amodel_exists
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.aembed_documents
aembed_documents(texts: list[str]) -> list[list[float]]Asynchronous Embed search docs.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.aembed_documents
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.aembed_image
aembed_image(image_uri: str) -> list[float]Asynchronous Embed image using google_ml.image_embedding.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.aembed_image
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.aembed_query
aembed_query(text: str) -> list[float]Asynchronous Embed query text.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.aembed_query
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.amodel_exists
amodel_exists() -> boolChecks if the embedding model exists.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.amodel_exists
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.create
create(
engine: langchain_google_alloydb_pg.engine.AlloyDBEngine, model_id: str
) -> langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddingsCreate AlloyDBEmbeddings instance.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.create
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.create_sync
create_sync(
engine: langchain_google_alloydb_pg.engine.AlloyDBEngine, model_id: str
) -> langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddingsCreate AlloyDBEmbeddings instance.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.create_sync
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.embed_documents
embed_documents(texts: list[str]) -> list[list[float]]Embed search docs.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.embed_documents
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.embed_image
embed_image(image_uri: str) -> list[float]Embed image using google_ml.image_embedding.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.embed_image
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.embed_query
embed_query(text: str) -> list[float]Embed query text.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.embed_query
langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.model_exists
model_exists() -> boolChecks if the embedding model exists.
See more: langchain_google_alloydb_pg.embeddings.AlloyDBEmbeddings.model_exists
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.
langchain_google_alloydb_pg.engine.AlloyDBEngine._aapply_vector_assist_spec
_aapply_vector_assist_spec(
table_name: str,
embedding_column: str,
schema_name: str = "public",
spec_id: typing.Optional[str] = None,
) -> typing.Optional[bool]Call vector_assist.apply_spec.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._aapply_vector_assist_spec
langchain_google_alloydb_pg.engine.AlloyDBEngine._adefine_vector_assist_spec
_adefine_vector_assist_spec(
table_name: str,
embedding_column: str,
schema_name: str = "public",
embedding_model: typing.Optional[str] = None,
) -> list[dict]Call vector_assist.define_spec.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._adefine_vector_assist_spec
langchain_google_alloydb_pg.engine.AlloyDBEngine._aenable_columnar_engine
_aenable_columnar_engine(
table_name: str,
columns: typing.Optional[list[str]] = None,
schema_name: str = "public",
) -> NoneCall google_columnar_engine_add for a table.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._aenable_columnar_engine
langchain_google_alloydb_pg.engine.AlloyDBEngine._afetch_latest_vector_assist_spec_id
_afetch_latest_vector_assist_spec_id(
conn: sqlalchemy.ext.asyncio.engine.AsyncConnection,
table_name: str,
embedding_column: str,
schema_name: str,
) -> typing.Optional[str]Return the id of the most recently defined spec, or None.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._afetch_latest_vector_assist_spec_id
langchain_google_alloydb_pg.engine.AlloyDBEngine._aforecast
_aforecast(
model_id: str,
*,
timestamp_column: str,
data_column: str,
horizon: int,
conf_level: float,
table_name: typing.Optional[str] = None,
schema_name: str = "public",
query: typing.Optional[str] = None
) -> list[dict]Run google_ml.forecast on the engine's loop.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._aforecast
langchain_google_alloydb_pg.engine.AlloyDBEngine._aget_vector_assist_recommendations
_aget_vector_assist_recommendations(
table_name: str, embedding_column: str, schema_name: str = "public"
) -> list[dict]Call vector_assist.get_recommendations for the latest spec.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._aget_vector_assist_recommendations
langchain_google_alloydb_pg.engine.AlloyDBEngine._ainit_chat_history_table
_ainit_chat_history_table(table_name: str, schema_name: str = "public") -> NoneCreate 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"
) -> NoneCreate 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: typing.Optional[list[langchain_postgres.v2.engine.Column]] = None,
metadata_json_column: str = "langchain_metadata",
store_metadata: bool = True,
) -> NoneCreates a table for storing LangChain documents.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._ainit_document_table
langchain_google_alloydb_pg.engine.AlloyDBEngine._ainitialize_embeddings
_ainitialize_embeddings(
table_name: str,
model_id: str,
content_column: str,
embedding_column: str,
schema_name: str = "public",
overwrite: bool = False,
) -> NoneCall ai.initialize_embeddings for a table.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._ainitialize_embeddings
langchain_google_alloydb_pg.engine.AlloyDBEngine._ais_function_missing
_ais_function_missing(
error: BaseException,
sqlstates: set[str],
schema: typing.Optional[str],
function: str,
) -> boolReturn True if error means the extension function is not installed.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._ais_function_missing
langchain_google_alloydb_pg.engine.AlloyDBEngine._aload_table_schema
_aload_table_schema(
table_name: str, schema_name: str = "public"
) -> sqlalchemy.sql.schema.TableLoad 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._arun_auto_columnarization
_arun_auto_columnarization() -> list[dict]Call google_columnar_engine_recommend('AUTO_COLUMNARIZATION').
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._arun_auto_columnarization
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.Optional[typing.Mapping[str, typing.Any]] = None,
) -> langchain_google_alloydb_pg.engine.AlloyDBEngineCreate an AlloyDBEngine from an AlloyDB instance.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine._create
langchain_google_alloydb_pg.engine.AlloyDBEngine.aapply_vector_assist_spec
aapply_vector_assist_spec(
table_name: str,
embedding_column: str,
schema_name: str = "public",
spec_id: typing.Optional[str] = None,
) -> typing.Optional[bool]Apply a Vector Assist spec.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.aapply_vector_assist_spec
langchain_google_alloydb_pg.engine.AlloyDBEngine.adefine_vector_assist_spec
adefine_vector_assist_spec(
table_name: str,
embedding_column: str,
schema_name: str = "public",
embedding_model: typing.Optional[str] = None,
) -> list[dict]Define a Vector Assist spec for a table's vector column.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.adefine_vector_assist_spec
langchain_google_alloydb_pg.engine.AlloyDBEngine.aenable_columnar_engine
aenable_columnar_engine(
table_name: str,
columns: typing.Optional[list[str]] = None,
schema_name: str = "public",
) -> NoneAdd a table's columns to the AlloyDB columnar engine.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.aenable_columnar_engine
langchain_google_alloydb_pg.engine.AlloyDBEngine.aforecast
aforecast(
model_id: str,
*,
timestamp_column: str,
data_column: str,
horizon: int,
conf_level: float,
table_name: typing.Optional[str] = None,
schema_name: str = "public",
query: typing.Optional[str] = None
) -> list[dict]Asynchronously get forecasting from AlloyDB AI.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.aforecast
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.Optional[typing.Mapping[str, typing.Any]] = None,
) -> langchain_google_alloydb_pg.engine.AlloyDBEngineCreate an AlloyDBEngine from an AlloyDB instance.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.afrom_instance
langchain_google_alloydb_pg.engine.AlloyDBEngine.aget_vector_assist_recommendations
aget_vector_assist_recommendations(
table_name: str, embedding_column: str, schema_name: str = "public"
) -> list[dict]Get the recommendations of the latest Vector Assist spec.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.aget_vector_assist_recommendations
langchain_google_alloydb_pg.engine.AlloyDBEngine.ainit_chat_history_table
ainit_chat_history_table(table_name: str, schema_name: str = "public") -> NoneCreate 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"
) -> NoneCreate 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: typing.Optional[list[langchain_postgres.v2.engine.Column]] = None,
metadata_json_column: str = "langchain_metadata",
store_metadata: bool = True,
) -> NoneCreates a table for storing LangChain documents.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.ainit_document_table
langchain_google_alloydb_pg.engine.AlloyDBEngine.ainitialize_embeddings
ainitialize_embeddings(
table_name: str,
model_id: str,
content_column: str,
embedding_column: str,
schema_name: str = "public",
overwrite: bool = False,
) -> NoneGenerate and manage embeddings for a table with AlloyDB AI.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.ainitialize_embeddings
langchain_google_alloydb_pg.engine.AlloyDBEngine.apply_vector_assist_spec
apply_vector_assist_spec(
table_name: str,
embedding_column: str,
schema_name: str = "public",
spec_id: typing.Optional[str] = None,
) -> typing.Optional[bool]Apply a Vector Assist spec.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.apply_vector_assist_spec
langchain_google_alloydb_pg.engine.AlloyDBEngine.arun_auto_columnarization
arun_auto_columnarization() -> list[dict]Run the columnar engine's auto-columnarization once.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.arun_auto_columnarization
langchain_google_alloydb_pg.engine.AlloyDBEngine.define_vector_assist_spec
define_vector_assist_spec(
table_name: str,
embedding_column: str,
schema_name: str = "public",
embedding_model: typing.Optional[str] = None,
) -> list[dict]Define a Vector Assist spec for a table's vector column.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.define_vector_assist_spec
langchain_google_alloydb_pg.engine.AlloyDBEngine.enable_columnar_engine
enable_columnar_engine(
table_name: str,
columns: typing.Optional[list[str]] = None,
schema_name: str = "public",
) -> NoneAdd a table's columns to the AlloyDB columnar engine.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.enable_columnar_engine
langchain_google_alloydb_pg.engine.AlloyDBEngine.forecast
forecast(
model_id: str,
*,
timestamp_column: str,
data_column: str,
horizon: int,
conf_level: float,
table_name: typing.Optional[str] = None,
schema_name: str = "public",
query: typing.Optional[str] = None
) -> list[dict]Synchronously get forecasting from AlloyDB AI.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.forecast
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.AlloyDBEngineCreate 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.AlloyDBEngineCreate 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.Optional[typing.Mapping[str, typing.Any]] = None,
) -> langchain_google_alloydb_pg.engine.AlloyDBEngineCreate an AlloyDBEngine from an AlloyDB instance.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.from_instance
langchain_google_alloydb_pg.engine.AlloyDBEngine.get_vector_assist_recommendations
get_vector_assist_recommendations(
table_name: str, embedding_column: str, schema_name: str = "public"
) -> list[dict]Get the recommendations of the latest Vector Assist spec.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.get_vector_assist_recommendations
langchain_google_alloydb_pg.engine.AlloyDBEngine.init_chat_history_table
init_chat_history_table(table_name: str, schema_name: str = "public") -> NoneCreate an AlloyDB 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"
) -> NoneCreate AlloyDB 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: typing.Optional[list[langchain_postgres.v2.engine.Column]] = None,
metadata_json_column: str = "langchain_metadata",
store_metadata: bool = True,
) -> NoneCreates a table for storing LangChain documents.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.init_document_table
langchain_google_alloydb_pg.engine.AlloyDBEngine.initialize_embeddings
initialize_embeddings(
table_name: str,
model_id: str,
content_column: str,
embedding_column: str,
schema_name: str = "public",
overwrite: bool = False,
) -> NoneGenerate and manage embeddings for a table with AlloyDB AI.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.initialize_embeddings
langchain_google_alloydb_pg.engine.AlloyDBEngine.run_auto_columnarization
run_auto_columnarization() -> list[dict]Run the columnar engine's auto-columnarization once.
See more: langchain_google_alloydb_pg.engine.AlloyDBEngine.run_auto_columnarization
langchain_google_alloydb_pg.indexes.IVFIndex.index_options
index_options() -> strSet index query options for vector store initialization.
See more: langchain_google_alloydb_pg.indexes.IVFIndex.index_options
langchain_google_alloydb_pg.indexes.IVFIndex
IVFIndex(name: Optional[str] = None, index_type: str = 'ivf', distance_strategy: langchain_postgres.v2.indexes.DistanceStrategy = IVFIndex(name: Optional[str] = None, index_type: str = 'ivf', distance_strategy: langchain_postgres.v2.indexes.DistanceStrategy =
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() -> strConvert index attributes to string.
See more: langchain_google_alloydb_pg.indexes.IVFQueryOptions.to_string
langchain_google_alloydb_pg.indexes.IVFQueryOptions
IVFQueryOptions(probes: int = 1)IVFQueryOptions(probes: int = 1).
See more: langchain_google_alloydb_pg.indexes.IVFQueryOptions
langchain_google_alloydb_pg.indexes.ScaNNIndex.index_options
index_options() -> strSet index query options for vector store initialization.
See more: langchain_google_alloydb_pg.indexes.ScaNNIndex.index_options
langchain_google_alloydb_pg.indexes.ScaNNIndex
ScaNNIndex(name: typing.Optional[str] = None, index_type: str = 'ScaNN', distance_strategy: langchain_postgres.v2.indexes.DistanceStrategy = ScaNN index configuration for AlloyDB.
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() -> strConvert index attributes to string.
See more: langchain_google_alloydb_pg.indexes.ScaNNQueryOptions.to_string
langchain_google_alloydb_pg.indexes.ScaNNQueryOptions
ScaNNQueryOptions(
num_leaves_to_search: int = 1,
pre_reordering_num_neighbors: int = -1,
pct_leaves_to_search: typing.Optional[float] = None,
)Query options for ScaNN index.
See more: langchain_google_alloydb_pg.indexes.ScaNNQueryOptions
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]) -> NoneSave 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]) -> NoneSave 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]) -> NoneDelete 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.AlloyDBDocumentSaverCreate 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.AlloyDBDocumentSaverCreate 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]) -> NoneDelete 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.
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.AlloyDBLoaderCreate 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.AlloyDBLoaderCreate 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.model_manager.AlloyDBModelManager
AlloyDBModelManager(
key: object, engine: langchain_google_alloydb_pg.engine.AlloyDBEngine
)AlloyDBModelManager constructor.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__acreate_model
__acreate_model(
model_id: str,
model_provider: str,
model_type: str,
model_qualified_name: str,
**kwargs: dict[str, str]
) -> NoneCreates a registration for custom text model.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__acreate_model
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__adrop_model
__adrop_model(model_id: str) -> NoneRemoves an already registered model.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__adrop_model
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__aget_model
__aget_model(
model_id: str,
) -> typing.Optional[langchain_google_alloydb_pg.model_manager.AlloyDBModel]Lists the model details for a specific model_id.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__aget_model
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__alist_models
__alist_models() -> list[langchain_google_alloydb_pg.model_manager.AlloyDBModel]Lists all the models and its details.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__alist_models
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__avalidate
__avalidate() -> NonePrivate async function to validate prerequisites.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__avalidate
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__convert_dict_to_dataclass
__convert_dict_to_dataclass(
list_of_rows: typing.Sequence[sqlalchemy.engine.row.RowMapping],
) -> list[langchain_google_alloydb_pg.model_manager.AlloyDBModel]Converts a list of DB rows to list of AlloyDBModel dataclass.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__convert_dict_to_dataclass
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__fetch_db_flag
__fetch_db_flag() -> strFetches the enable_model_support DB flag.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__fetch_db_flag
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__fetch_google_ml_extension
__fetch_google_ml_extension() -> strCreates the Google ML Extension if it does not exist and returns the version number (Default creates version 1.5.3).
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__fetch_google_ml_extension
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__query_db
__query_db(query: str) -> typing.Sequence[sqlalchemy.engine.row.RowMapping]Queries the Postgres database through the engine.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.__query_db
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.acreate_model
acreate_model(
model_id: str,
model_provider: str,
model_type: str,
model_qualified_name: str,
**kwargs: dict[str, str]
) -> NoneCreates a registration for custom text model.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.acreate_model
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.adrop_model
adrop_model(model_id: str) -> NoneRemoves an already registered model.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.adrop_model
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.aget_model
aget_model(
model_id: str,
) -> typing.Optional[langchain_google_alloydb_pg.model_manager.AlloyDBModel]Lists the model details for a specific model_id.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.aget_model
langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.alist_models
alist_models() -> list[langchain_google_alloydb_pg.model_manager.AlloyDBModel]Lists all the models and its details.
See more: langchain_google_alloydb_pg.model_manager.AlloyDBModelManager.alist_models
langchain_google_alloydb_pg.tools.AlloyDBIfInput
AlloyDBIfInput(*, condition: str)Create a new model by parsing and validating input data from keyword arguments.
langchain_google_alloydb_pg.tools.AlloyDBIfTool
AlloyDBIfTool(
*,
name: str = "alloydb_if_tool",
description: str = "A tool that uses AlloyDB AI to evaluate a semantic condition and returns True or False. Useful for semantic routing, classification, or filtering.",
args_schema: typing.Type[
pydantic.main.BaseModel
] = langchain_google_alloydb_pg.tools.AlloyDBIfInput,
return_direct: bool = False,
verbose: bool = False,
callbacks: (
list[langchain_core.callbacks.base.BaseCallbackHandler]
| langchain_core.callbacks.base.BaseCallbackManager
| None
) = None,
tags: list[str] | None = None,
metadata: dict[str, typing.Any] | None = None,
handle_tool_error: (
bool
| str
| collections.abc.Callable[
[langchain_core.tools.base.ToolException],
str | collections.abc.Sequence[str | dict[str, typing.Any]],
]
| None
) = False,
handle_validation_error: (
bool
| str
| collections.abc.Callable[
[
pydantic_core._pydantic_core.ValidationError
| pydantic.v1.error_wrappers.ValidationError
],
str,
]
| None
) = False,
response_format: typing.Literal["content", "content_and_artifact"] = "content",
extras: dict[str, typing.Any] | None = None,
engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
model_id: typing.Optional[str] = None
)Initialize the tool.
langchain_google_alloydb_pg.tools.AlloyDBIfTool._arun
_arun(
condition: str,
run_manager: typing.Optional[
langchain_core.callbacks.manager.AsyncCallbackManagerForToolRun
] = None,
) -> boolEvaluate the condition asynchronously.
See more: langchain_google_alloydb_pg.tools.AlloyDBIfTool._arun
langchain_google_alloydb_pg.tools.AlloyDBIfTool._run
_run(
condition: str,
run_manager: typing.Optional[
langchain_core.callbacks.manager.CallbackManagerForToolRun
] = None,
) -> boolEvaluate the condition synchronously.
See more: langchain_google_alloydb_pg.tools.AlloyDBIfTool._run
langchain_google_alloydb_pg.tools.AlloyDBIfTool.model_post_init
model_post_init(context: Any, /) -> NoneThis function is meant to behave like a BaseModel method to initialize private attributes.
See more: langchain_google_alloydb_pg.tools.AlloyDBIfTool.model_post_init
langchain_google_alloydb_pg.tools.AlloyDBSentimentTool
AlloyDBSentimentTool(
*,
name: str = "alloydb_sentiment_tool",
description: str = "Analyze the sentiment of a given text. Useful for determining if text is positive, negative, or neutral.",
args_schema: typing.Type[
pydantic.main.BaseModel
] = langchain_google_alloydb_pg.tools.SentimentInput,
return_direct: bool = False,
verbose: bool = False,
callbacks: (
list[langchain_core.callbacks.base.BaseCallbackHandler]
| langchain_core.callbacks.base.BaseCallbackManager
| None
) = None,
tags: list[str] | None = None,
metadata: dict[str, typing.Any] | None = None,
handle_tool_error: (
bool
| str
| collections.abc.Callable[
[langchain_core.tools.base.ToolException],
str | collections.abc.Sequence[str | dict[str, typing.Any]],
]
| None
) = False,
handle_validation_error: (
bool
| str
| collections.abc.Callable[
[
pydantic_core._pydantic_core.ValidationError
| pydantic.v1.error_wrappers.ValidationError
],
str,
]
| None
) = False,
response_format: typing.Literal["content", "content_and_artifact"] = "content",
extras: dict[str, typing.Any] | None = None,
engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
model_id: typing.Optional[str] = None
)Initialize the tool.
See more: langchain_google_alloydb_pg.tools.AlloyDBSentimentTool
langchain_google_alloydb_pg.tools.AlloyDBSentimentTool._arun
_arun(
content: str,
run_manager: typing.Optional[
langchain_core.callbacks.manager.AsyncCallbackManagerForToolRun
] = None,
) -> strAnalyze sentiment asynchronously.
See more: langchain_google_alloydb_pg.tools.AlloyDBSentimentTool._arun
langchain_google_alloydb_pg.tools.AlloyDBSentimentTool._run
_run(
content: str,
run_manager: typing.Optional[
langchain_core.callbacks.manager.CallbackManagerForToolRun
] = None,
) -> strAnalyze sentiment synchronously.
See more: langchain_google_alloydb_pg.tools.AlloyDBSentimentTool._run
langchain_google_alloydb_pg.tools.AlloyDBSentimentTool.model_post_init
model_post_init(context: Any, /) -> NoneThis function is meant to behave like a BaseModel method to initialize private attributes.
See more: langchain_google_alloydb_pg.tools.AlloyDBSentimentTool.model_post_init
langchain_google_alloydb_pg.tools.AlloyDBSummaryTool
AlloyDBSummaryTool(
*,
name: str = "alloydb_summary_tool",
description: str = "Summarize the given text. Useful for condensing long articles or descriptions into shorter summaries.",
args_schema: typing.Type[
pydantic.main.BaseModel
] = langchain_google_alloydb_pg.tools.SummaryInput,
return_direct: bool = False,
verbose: bool = False,
callbacks: (
list[langchain_core.callbacks.base.BaseCallbackHandler]
| langchain_core.callbacks.base.BaseCallbackManager
| None
) = None,
tags: list[str] | None = None,
metadata: dict[str, typing.Any] | None = None,
handle_tool_error: (
bool
| str
| collections.abc.Callable[
[langchain_core.tools.base.ToolException],
str | collections.abc.Sequence[str | dict[str, typing.Any]],
]
| None
) = False,
handle_validation_error: (
bool
| str
| collections.abc.Callable[
[
pydantic_core._pydantic_core.ValidationError
| pydantic.v1.error_wrappers.ValidationError
],
str,
]
| None
) = False,
response_format: typing.Literal["content", "content_and_artifact"] = "content",
extras: dict[str, typing.Any] | None = None,
engine: langchain_google_alloydb_pg.engine.AlloyDBEngine,
model_id: typing.Optional[str] = None,
additional_instructions: typing.Optional[str] = None
)Initialize the tool.
See more: langchain_google_alloydb_pg.tools.AlloyDBSummaryTool
langchain_google_alloydb_pg.tools.AlloyDBSummaryTool._arun
_arun(
content: str,
additional_instructions: typing.Optional[str] = None,
run_manager: typing.Optional[
langchain_core.callbacks.manager.AsyncCallbackManagerForToolRun
] = None,
) -> strSummarize asynchronously.
See more: langchain_google_alloydb_pg.tools.AlloyDBSummaryTool._arun
langchain_google_alloydb_pg.tools.AlloyDBSummaryTool._run
_run(
content: str,
additional_instructions: typing.Optional[str] = None,
run_manager: typing.Optional[
langchain_core.callbacks.manager.CallbackManagerForToolRun
] = None,
) -> strSummarize synchronously.
See more: langchain_google_alloydb_pg.tools.AlloyDBSummaryTool._run
langchain_google_alloydb_pg.tools.AlloyDBSummaryTool.model_post_init
model_post_init(context: Any, /) -> NoneThis function is meant to behave like a BaseModel method to initialize private attributes.
See more: langchain_google_alloydb_pg.tools.AlloyDBSummaryTool.model_post_init
langchain_google_alloydb_pg.tools.SentimentInput
SentimentInput(*, content: str)Create a new model by parsing and validating input data from keyword arguments.
langchain_google_alloydb_pg.tools.SummaryInput
SummaryInput(*, content: str, additional_instructions: typing.Optional[str] = None)Create a new model by parsing and validating input data from keyword arguments.
langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore
AlloyDBVectorStore(
key: object,
engine: langchain_postgres.v2.engine.PGEngine,
vs: langchain_postgres.v2.async_vectorstore.AsyncPGVectorStore,
)PGVectorStore constructor.
See more: langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore
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]Embed images and add to the table.
See more: langchain_google_alloydb_pg.vectorstore.AlloyDBVectorStore.aadd_images
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) -> NoneSet 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.AlloyDBVectorStoreCreate 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.AlloyDBVectorStoreCreate 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) -> NoneSet 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