Class Interaction

java.lang.Object
com.google.genai.gaos.models.interactions.Interaction

public class Interaction extends Object
Interaction

The Interaction resource.

  • Constructor Details

  • Method Details

    • agent

      public Optional<AgentOption> agent()
      The agent to interact with.
    • agentConfig

      public Optional<InteractionAgentConfig> agentConfig()
      Configuration parameters for the agent interaction.
    • cachedContent

      @Deprecated public Optional<String> cachedContent()
      Deprecated.
      field: This will be removed in a future release, please migrate away from it as soon as possible.
      The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings.

      Format: cachedContents/{cachedContent}

    • continuationToken

      public Optional<String> continuationToken()
      Opaque token to resume a long decode. Output: set when status is INCOMPLETE and decoding can be resumed. Input: pass the latest token back unchanged in CreateInteraction to continue decoding.
    • created

      public Optional<String> created()
      Required. Output only. The time at which the response was created in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
    • environment

      public Optional<InteractionEnvironment> environment()
      The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.
    • environmentId

      public Optional<String> environmentId()
      Output only. The environment ID for the interaction. Only populated if environment config is set in the request.
    • errors

      public Optional<List<Error>> errors()
      Output only. Diagnostic faults / platform errors recorded on the interaction.
    • generationConfig

      public Optional<GenerationConfig> generationConfig()
      Configuration parameters for model interactions.
    • id

      public Optional<String> id()
      Required. Output only. A unique identifier for the interaction completion.
    • input

      public Optional<InteractionsInput> input()
      The input for the interaction.
    • labels

      public Optional<Map<String,String>> labels()
      The labels with user-defined metadata for the request.

      Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.

    • model

      public Optional<Model> model()
      The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
    • outputAudio

      public Optional<AudioContent> outputAudio()
      An audio content block.
    • outputImage

      public Optional<ImageContent> outputImage()
      An image content block.
    • outputText

      public Optional<String> outputText()
      Concatenated text from the last model output in response to the current request.

      Note: this is added by the SDK.

    • outputVideo

      public Optional<VideoContent> outputVideo()
      A video content block.
    • previousInteractionId

      public Optional<String> previousInteractionId()
      The ID of the previous interaction, if any.
    • responseFormat

      public Optional<InteractionResponseFormat> responseFormat()
      Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.
    • responseMimeType

      @Deprecated public Optional<String> responseMimeType()
      Deprecated.
      field: This will be removed in a future release, please migrate away from it as soon as possible.
      The mime type of the response. This is required if response_format is set.
    • responseModalities

      @Deprecated public Optional<List<ResponseModality>> responseModalities()
      Deprecated.
      field: This will be removed in a future release, please migrate away from it as soon as possible.
      The requested modalities of the response (TEXT, IMAGE, AUDIO).
    • safetySettings

      public Optional<List<SafetySetting>> safetySettings()
      Safety settings for the interaction.
    • serviceTier

      public Optional<ServiceTier> serviceTier()
    • status

      public Optional<InteractionStatus> status()
      Required. Output only. The status of the interaction.
    • steps

      public Optional<List<Step>> steps()
      Required. Output only. The steps that make up the interaction, when included in the response.
    • systemInstruction

      public Optional<String> systemInstruction()
      System instruction for the interaction.
    • tools

      public Optional<List<Tool>> tools()
      A list of tool declarations the model may call during interaction.
    • updated

      public Optional<String> updated()
      Required. Output only. The time at which the response was last updated in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
    • usage

      public Optional<Usage> usage()
      Statistics on the interaction request's token usage.
    • webhookConfig

      public Optional<WebhookConfig> webhookConfig()
      Message for configuring webhook events for a request.
    • setOutputs

      public void setOutputs(List<Content> outputs)
    • builder

      public static Interaction.Builder builder()
    • withAgent

      public Interaction withAgent(@Nullable AgentOption agent)
      The agent to interact with.
    • withAgentConfig

      public Interaction withAgentConfig(@Nullable InteractionAgentConfig agentConfig)
      Configuration parameters for the agent interaction.
    • withCachedContent

      @Deprecated public Interaction withCachedContent(@Nullable String cachedContent)
      Deprecated.
      field: This will be removed in a future release, please migrate away from it as soon as possible.
      The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings.

      Format: cachedContents/{cachedContent}

    • withContinuationToken

      public Interaction withContinuationToken(@Nullable String continuationToken)
      Opaque token to resume a long decode. Output: set when status is INCOMPLETE and decoding can be resumed. Input: pass the latest token back unchanged in CreateInteraction to continue decoding.
    • withCreated

      public Interaction withCreated(@Nullable String created)
      Required. Output only. The time at which the response was created in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
    • withEnvironment

      public Interaction withEnvironment(@Nullable InteractionEnvironment environment)
      The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.
    • withEnvironmentId

      public Interaction withEnvironmentId(@Nullable String environmentId)
      Output only. The environment ID for the interaction. Only populated if environment config is set in the request.
    • withErrors

      public Interaction withErrors(@Nullable List<Error> errors)
      Output only. Diagnostic faults / platform errors recorded on the interaction.
    • withGenerationConfig

      public Interaction withGenerationConfig(@Nullable GenerationConfig generationConfig)
      Configuration parameters for model interactions.
    • withId

      public Interaction withId(@Nullable String id)
      Required. Output only. A unique identifier for the interaction completion.
    • withInput

      public Interaction withInput(@Nullable InteractionsInput input)
      The input for the interaction.
    • withLabels

      public Interaction withLabels(@Nullable Map<String,String> labels)
      The labels with user-defined metadata for the request.

      Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.

    • withModel

      public Interaction withModel(@Nullable Model model)
      The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
    • withOutputAudio

      public Interaction withOutputAudio(@Nullable AudioContent outputAudio)
      An audio content block.
    • withOutputImage

      public Interaction withOutputImage(@Nullable ImageContent outputImage)
      An image content block.
    • withOutputText

      public Interaction withOutputText(@Nullable String outputText)
      Concatenated text from the last model output in response to the current request.

      Note: this is added by the SDK.

    • withOutputVideo

      public Interaction withOutputVideo(@Nullable VideoContent outputVideo)
      A video content block.
    • withPreviousInteractionId

      public Interaction withPreviousInteractionId(@Nullable String previousInteractionId)
      The ID of the previous interaction, if any.
    • withResponseFormat

      public Interaction withResponseFormat(@Nullable InteractionResponseFormat responseFormat)
      Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.
    • withResponseMimeType

      @Deprecated public Interaction withResponseMimeType(@Nullable String responseMimeType)
      Deprecated.
      field: This will be removed in a future release, please migrate away from it as soon as possible.
      The mime type of the response. This is required if response_format is set.
    • withResponseModalities

      @Deprecated public Interaction withResponseModalities(@Nullable List<ResponseModality> responseModalities)
      Deprecated.
      field: This will be removed in a future release, please migrate away from it as soon as possible.
      The requested modalities of the response (TEXT, IMAGE, AUDIO).
    • withSafetySettings

      public Interaction withSafetySettings(@Nullable List<SafetySetting> safetySettings)
      Safety settings for the interaction.
    • withServiceTier

      public Interaction withServiceTier(@Nullable ServiceTier serviceTier)
    • withStatus

      public Interaction withStatus(@Nonnull InteractionStatus status)
      Required. Output only. The status of the interaction.
    • withSteps

      public Interaction withSteps(@Nullable List<Step> steps)
      Required. Output only. The steps that make up the interaction, when included in the response.
    • withSystemInstruction

      public Interaction withSystemInstruction(@Nullable String systemInstruction)
      System instruction for the interaction.
    • withTools

      public Interaction withTools(@Nullable List<Tool> tools)
      A list of tool declarations the model may call during interaction.
    • withUpdated

      public Interaction withUpdated(@Nullable String updated)
      Required. Output only. The time at which the response was last updated in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
    • withUsage

      public Interaction withUsage(@Nullable Usage usage)
      Statistics on the interaction request's token usage.
    • withWebhookConfig

      public Interaction withWebhookConfig(@Nullable WebhookConfig webhookConfig)
      Message for configuring webhook events for a request.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object