类名:FunctionCallingUtils 功能:用于调用其他函数(即实现函数间的交互或协作)

java.lang.Object
com.google.adk.tools.FunctionCallingUtils

public final class FunctionCallingUtils extends Object
这是一个用于调用函数的实用类(utility class)。
  • 方法概述

    Modifier and Type
    Method
    Description
    static com.google.genai.types.FunctionDeclaration
    根据 Java 方法生成一个 `FunctionDeclaration` 对象,同时忽略那些名称与指定名称相匹配的参数。
    static com.google.genai.types.Schema
    根据 Java 类型生成相应的数据结构(即 Schema),并为数据生成过程创建一个新的上下文(context)。
    static com.google.genai.types.Schema
    buildSchemaFromType(Type type, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
    根据 Java 类型生成相应的数据结构(即 Schema),并为数据生成过程创建一个新的上下文(context)。

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 方法详细信息(Method Details)

    • buildFunctionDeclaration

      public static com.google.genai.types.FunctionDeclaration buildFunctionDeclaration(Method func, List<String> ignoreParams)
      根据 Java 方法生成一个 `FunctionDeclaration` 对象,同时忽略那些名称与指定名称相匹配的参数。
      Parameters:
      func - The Java Method to 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

      public static com.google.genai.types.Schema buildSchemaFromType(Type type)
      根据 Java 类型生成相应的数据结构(即 Schema),并为数据生成过程创建一个新的上下文(context)。
      Parameters:
      type - The Java Type to 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 Java Type to convert into a Schema.
      objectMapper - The ObjectMapper to use for introspecting types.
      Returns:
      The generated Schema.
      Throws:
      IllegalArgumentException - if a type is encountered that cannot be serialized by Jackson.