Module tools (0.4.0)

API documentation for tools module.

Classes

AlloyDBToolSpec

AlloyDBToolSpec(
    engine: llama_index_alloydb_pg.engine.AlloyDBEngine,
    model_id: typing.Optional[str] = None,
)

Tools that run AlloyDB AI functions in the database.

AlloyDBToolSpec(engine).to_tool_list() returns one FunctionTool per function, each with a native async path, ready for an agent such as FunctionAgent. Requires AlloyDB for PostgreSQL 17 or later with the google_ml_integration extension 1.5.7 or later and the google_ml_integration.enable_ai_query_engine and google_ml_integration.enable_preview_ai_functions flags on. See https://cloud.google.com/alloydb/docs/ai/analyze-sentiment.

Parameters
Name Description
engine AlloyDBEngine

Connection pool to the AlloyDB database.

model_id Optional[str]

ID of the model the AI functions use. If None, the database uses the model named by its google_ml_integration.default_llm_model flag. Defaults to None.

Exceptions
Type Description
ValueError If model_id is empty or blank.