def _ParseArgs()

in utils/import_conversations_v2.py [0:0]


def _ParseArgs():
  """Parse script arguments."""
  parser = argparse.ArgumentParser()
  # Create a groups of args where exactly one of them must be set.
  # source_group = parser.add_mutually_exclusive_group(required=True)
  source_group = parser.add_argument_group(title='Bucket name or local path')
  source_group.add_argument(
      '--source_local_audio_path',
      help='Path to a local audio file to process as input.',
  )
  source_group.add_argument(
      '--source_audio_gcs_bucket',
      default=None,
      help=(
          'Path to a GCS bucket containing audio files to process as input. '
          'This bucket can be the same as the source bucket to colocate audio '
          'and transcript.'
      ),
  )
  source_group.add_argument(
      '--source_voice_transcript_gcs_bucket',
      help=(
          'Path to a GCS bucket containing voice transcripts to process as'
          ' input.'
      ),
  )
  source_group.add_argument(
      '--source_chat_transcript_gcs_bucket',
      help=(
          'Path to a GCS bucket containing chat transcripts to process as'
          ' input.'
      ),
  )
  parser.add_argument(
      '--dest_gcs_bucket',
      help=(
          'Name of the GCS bucket that will hold resulting transcript files.'
          ' Only relevant when providing audio files as input. Otherwise'
          ' ignored.'
      ),
  )
  parser.add_argument(
      'project_id',
      help='Project ID (not number) for the project to own the conversation.',
  )
  parser.add_argument(
      '--impersonated_service_account',
      help=(
          'A service account to impersonate. If specified, then GCP requests '
          'will be authenticated using service account impersonation. '
          'Otherwise, the gcloud default credential will be used.'
      ),
  )
  parser.add_argument(
      '--redact', default=False, help='Whether to redact the transcripts.'
  )
  parser.add_argument(
      '--analyze',
      default='False',
      help='Whether to analyze imported conversations. Default true.',
  )
  parser.add_argument(
      '--insights_endpoint',
      default='contactcenterinsights.googleapis.com',
      help='Name for the Insights endpoint to call',
  )
  parser.add_argument(
      '--language_code',
      default='en-US',
      help='Language code for all imported data.',
  )
  parser.add_argument(
      '--encoding', default='LINEAR16', help='Encoding for all imported data.'
  )
  parser.add_argument(
      '--sample_rate_hertz',
      default=0,
      type=int,
      help=(
          'Sample rate. If left out, Speech-to-text may infer it depending on '
          'the encoding.'
      ),
  )
  parser.add_argument(
      '--insights_api_version',
      default='v1',
      help='Insights API version. Options include `v1` and `v1alpha1`.',
  )
  parser.add_argument(
      '--agent_id',
      help='Agent identifier to attach to the created Insights conversations.',
  )
  parser.add_argument(
      '--agent_channel',
      default=2,
      help='Agent channel to attach to the created Insights conversations.',
  )
  parser.add_argument(
      '--xml_gcs_bucket',
      default=None,
      help='XML path to add labels to conversations.',
  )
  parser.add_argument(
      '--transcript_metadata_flag',
      default=None, 
      help=('''Flag will be set True if the metadata is present 
            inside the transcript''')
  )
  parser.add_argument(
      '--folder_name',
      default=None, 
      help=('''Folder name is required in case transcripts are present inside
            a folder and not in a bucket directly''')
  )
  return parser.parse_args()