Class CallableFunctionDeclaration (1.56.0)

CallableFunctionDeclaration(
    name: str,
    function: typing.Callable[[...], typing.Any],
    parameters: typing.Dict[str, typing.Any],
    description: typing.Optional[str] = None,
)

A function declaration plus a function.

Methods

CallableFunctionDeclaration

CallableFunctionDeclaration(
    name: str,
    function: typing.Callable[[...], typing.Any],
    parameters: typing.Dict[str, typing.Any],
    description: typing.Optional[str] = None,
)

Constructs a FunctionDeclaration.

Parameters
Name Description
name str

The name of the function that the model can call.

parameters typing.Dict[str, typing.Any]

Describes the parameters to this function in JSON Schema Object format.

description typing.Optional[str]

Description and purpose of the function. Model uses it to decide how and whether to call the function.

from_func

from_func(
    func: typing.Callable[[...], typing.Any]
) -> vertexai.generative_models._generative_models.CallableFunctionDeclaration

Automatically creates a CallableFunctionDeclaration from a Python function.

The function parameter schema is automatically extracted.

Parameter
Name Description
func typing.Callable[..., typing.Any]

The function from which to extract schema.