![]() |
An extension of FunctionDeclaration
that can be built from a python function, and is callable.
Inherits From: FunctionDeclaration
google.generativeai.types.CallableFunctionDeclaration(
*,
name: str,
description: str,
parameters: (dict[str, Any] | None) = None,
function: Callable[..., Any]
)
Note: The python function must have type annotations.
Attributes | |
---|---|
`description` | |
`name` | |
`parameters` |
from_function
@staticmethod
from_function( function: Callable[..., Any], descriptions: (dict[str, str] | None) = None )
Builds a CallableFunctionDeclaration
from a python function.
The function should have type annotations.
This method is able to generate the schema for arguments annotated with types:
AllowedTypes = float | int | str | list[AllowedTypes] | dict
This method does not yet build a schema for TypedDict
, that would allow you to specify the dictionary
contents. But you can build these manually.
from_proto
@classmethod
from_proto( proto ) -> FunctionDeclaration
to_proto
to_proto() -> protos.FunctionDeclaration
__call__
__call__(
fc: protos.FunctionCall
) -> protos.FunctionResponse
Call self as a function.