Class VertexSpeechClient

java.lang.Object
com.google.adk.flows.llmflows.audio.VertexSpeechClient
All Implemented Interfaces:
SpeechClientInterface, AutoCloseable

public class VertexSpeechClient extends Object implements SpeechClientInterface
Implementation of SpeechClientInterface using Vertex AI SpeechClient.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a VertexSpeechClient, initializing the underlying Google Cloud SpeechClient.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the client and releases any resources.
    com.google.cloud.speech.v1.RecognizeResponse
    recognize(com.google.cloud.speech.v1.RecognitionConfig config, com.google.cloud.speech.v1.RecognitionAudio audio)
    Performs synchronous speech recognition.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VertexSpeechClient

      public VertexSpeechClient() throws IOException
      Constructs a VertexSpeechClient, initializing the underlying Google Cloud SpeechClient.
      Throws:
      IOException - if SpeechClient creation fails.
  • Method Details

    • recognize

      public com.google.cloud.speech.v1.RecognizeResponse recognize(com.google.cloud.speech.v1.RecognitionConfig config, com.google.cloud.speech.v1.RecognitionAudio audio)
      Description copied from interface: SpeechClientInterface
      Performs synchronous speech recognition.
      Specified by:
      recognize in interface SpeechClientInterface
      Parameters:
      config - The recognition configuration.
      audio - The audio data to transcribe.
      Returns:
      The recognition response.
    • close

      public void close() throws Exception
      Description copied from interface: SpeechClientInterface
      Closes the client and releases any resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface SpeechClientInterface
      Throws:
      Exception - if an error occurs during closing.