类名:FunctionCallingUtils 功能:用于调用其他函数(即实现函数间的交互或协作)
java.lang.Object
com.google.adk.tools.FunctionCallingUtils
这是一个用于调用函数的实用类(utility class)。
-
方法概述
Modifier and TypeMethodDescriptionstatic com.google.genai.types.FunctionDeclarationbuildFunctionDeclaration(Method func, List<String> ignoreParams) 根据 Java 方法生成一个 `FunctionDeclaration` 对象,同时忽略那些名称与指定名称相匹配的参数。static com.google.genai.types.SchemabuildSchemaFromType(Type type) 根据 Java 类型生成相应的数据结构(即 Schema),并为数据生成过程创建一个新的上下文(context)。static com.google.genai.types.SchemabuildSchemaFromType(Type type, com.fasterxml.jackson.databind.ObjectMapper objectMapper) 根据 Java 类型生成相应的数据结构(即 Schema),并为数据生成过程创建一个新的上下文(context)。
-
方法详细信息(Method Details)
-
buildFunctionDeclaration
public static com.google.genai.types.FunctionDeclaration buildFunctionDeclaration(Method func, List<String> ignoreParams) 根据 Java 方法生成一个 `FunctionDeclaration` 对象,同时忽略那些名称与指定名称相匹配的参数。- Parameters:
func- The JavaMethodto convert into a FunctionDeclaration.ignoreParams- The names of parameters to ignore.- Returns:
- The generated
FunctionDeclaration. - Throws:
IllegalArgumentException- if a type is encountered that cannot be serialized by Jackson.
-
buildSchemaFromType
根据 Java 类型生成相应的数据结构(即 Schema),并为数据生成过程创建一个新的上下文(context)。- Parameters:
type- The JavaTypeto convert into a Schema.- Returns:
- The generated
Schema. - Throws:
IllegalArgumentException- if a type is encountered that cannot be serialized by Jackson.
-
buildSchemaFromType
public static com.google.genai.types.Schema buildSchemaFromType(Type type, com.fasterxml.jackson.databind.ObjectMapper objectMapper) 根据 Java 类型生成相应的数据结构(即 Schema),并为数据生成过程创建一个新的上下文(context)。- Parameters:
type- The JavaTypeto convert into a Schema.objectMapper- TheObjectMapperto use for introspecting types.- Returns:
- The generated
Schema. - Throws:
IllegalArgumentException- if a type is encountered that cannot be serialized by Jackson.
-