File: //proc/thread-self/root/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)