HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //snap/google-cloud-cli/current/lib/surface/dialogflow/agent/query.yaml
release_tracks: [ALPHA]
help_text:
  brief: Send a text or audio conversational query to the agent of the current project.
  description: |
    Send a text or audio conversational query to the agent of the current project.
  examples: |
    To query the agent of the current project with text:

      $ {command} --query-text="hi"

    To query the agent of the current project with text in session `my-session`:

      $ {command} --session="my-session" --query-text="hi"

    To query the agent of the current project with audio:

      $ {command} --query-audio-file="path/to/audio_file.wav" --sample-rate="16000" --audio-encoding="AUDIO_ENCODING_LINEAR_16"

arguments:
  params:
  - arg_name: session
    api_field: session
    processor: googlecloudsdk.command_lib.dialogflow.agent.hooks:AddSessionPrefix
    default: DEFAULT_SESSION
    help_text: |
      ID of the session to send the query to. This can be any number or string up to 36 bytes. By
      default, a different random ID will be used for every request.
  - arg_name: language
    default: en
    help_text: |
      The language code of the query. For information on supported languages, see:
      https://dialogflow.com/docs/languages.
  - group:
      mutex: true
      required: true
      params:
      - arg_name: query-text
        api_field: googleCloudDialogflowV2DetectIntentRequest.queryInput.text.text
        help_text: Conversational query in the form of text.
      - group:
          help_text: |
            Audio file and config:
          params:
          - arg_name: query-audio-file
            required: true
            processor: googlecloudsdk.core.util.files:ReadBinaryFileContents
            api_field: googleCloudDialogflowV2DetectIntentRequest.inputAudio
            help_text: |
              Path to an audio file to use as a conversational query.
          - arg_name: sample-rate
            required: true
            api_field: |-
              googleCloudDialogflowV2DetectIntentRequest.queryInput.audioConfig.sampleRateHertz
            help_text: |
              Sample rate of the audio file in Hertz.
          - arg_name: audio-encoding
            required: true
            api_field: |-
              googleCloudDialogflowV2DetectIntentRequest.queryInput.audioConfig.audioEncoding
            help_text: |
              Encoding of the audio file.

              See here for more information:
              https://cloud.google.com/dialogflow-enterprise/docs/reference/rest/v2/projects.agent.sessions/detectIntent#AudioEncoding.

request:
  collection: dialogflow.projects.agent.sessions
  disable_resource_check: true
  method: detectIntent
  modify_request_hooks:
  - googlecloudsdk.command_lib.dialogflow.agent.hooks:SetQueryLanguage

output:
  format: value(queryResult.fulfillmentText)