# 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
  `VertexSpeechClient()`
  Constructs a VertexSpeechClient, initializing the underlying Google Cloud SpeechClient.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  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 on the given audio input.

  ### Methods inherited from class 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)
    Performs synchronous speech recognition on the given audio input.
    Specified by:
      `recognize` in interface `SpeechClientInterface`
    Parameters:
      `config` - Recognition configuration (e.g., language, encoding).
      `audio` - Audio data to recognize.
    Returns:
      The recognition result.

  - ### 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.