speech_transcribe_recognition_metadata_beta.yaml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto
  2. schema_version: 1.2.0
  3. samples:
  4. - region_tag: speech_transcribe_recognition_metadata_beta
  5. title: Adding recognition metadata (Local File) (Beta)
  6. description: Adds additional details short audio file included in this recognition request
  7. rpc: Recognize
  8. service: google.cloud.speech.v1p1beta1.Speech
  9. request:
  10. - field: audio.content
  11. value: "resources/commercial_mono.wav"
  12. input_parameter: local_file_path
  13. comment: Path to local audio file, e.g. /path/audio.wav
  14. value_is_file: true
  15. - field: config.metadata.interaction_type
  16. value: VOICE_SEARCH
  17. comment: The use case of the audio, e.g. PHONE_CALL, DISCUSSION, PRESENTATION, et al.
  18. - field: config.metadata.recording_device_type
  19. value: SMARTPHONE
  20. comment: The kind of device used to capture the audio
  21. - field: config.metadata.recording_device_name
  22. value: "Pixel 3"
  23. comment: |
  24. The device used to make the recording.
  25. Arbitrary string, e.g. 'Pixel XL', 'VoIP', 'Cardioid Microphone', or other value.
  26. - field: config.language_code
  27. value: "en-US"
  28. comment: |
  29. The language of the supplied audio. Even though additional languages are
  30. provided by alternative_language_codes, a primary language is still required.
  31. response:
  32. - loop:
  33. variable: result
  34. collection: $resp.results
  35. body:
  36. - comment:
  37. - First alternative is the most probable result
  38. - define: alternative = result.alternatives[0]
  39. - print:
  40. - "Transcript: %s"
  41. - alternative.transcript