Class FunctionResponse

java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.FunctionResponse

public abstract class FunctionResponse extends JsonSerializable
A function response.
  • Constructor Details

    • FunctionResponse

      public FunctionResponse()
  • Method Details

    • id

      public abstract Optional<String> id()
      The id of the function call this response is for. Populated by the client to match the corresponding function call `id`.
    • name

      public abstract Optional<String> name()
      Required. The name of the function to call. Matches [FunctionDeclaration.name] and [FunctionCall.name].
    • response

      public abstract Optional<Map<String,Object>> response()
      Required. The function response in JSON object format. Use "output" key to specify function output and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as function output.
    • builder

      public static FunctionResponse.Builder builder()
      Instantiates a builder for FunctionResponse.
    • toBuilder

      public abstract FunctionResponse.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static FunctionResponse fromJson(String jsonString)
      Deserializes a JSON string to a FunctionResponse object.