Class AzureOpenAIEmbeddingsClient

All Implemented Interfaces:
Client, EmbeddingsClient

public class AzureOpenAIEmbeddingsClient extends AbstractEmbeddingsClient
Azure OpenAI embeddings client with rate limiting support.
Since:
0.1 (2025-06-20)
Author:
Andrey Santrosyan
  • Constructor Details

    • AzureOpenAIEmbeddingsClient

      public AzureOpenAIEmbeddingsClient()
  • Method Details

    • doCalculateEmbedding

      protected AbstractEmbeddingsClient.RawEmbedding doCalculateEmbedding(String input, EmbeddingPurpose purpose) throws IOException
      Description copied from class: AbstractEmbeddingsClient
      Implementation-specific method to calculate embeddings. Subclasses implement this to make their actual API calls. The returned vector is the provider's native output; the template method coerces it to the canonical dimension. The token count is what the provider billed for the input, which is what the call costs.
      Specified by:
      doCalculateEmbedding in class AbstractEmbeddingsClient
      Parameters:
      input - the text to embed
      purpose - whether this is a stored corpus item or a live search probe
      Returns:
      the raw provider embedding and its billed input tokens
      Throws:
      IOException - if API call fails
    • is429Error

      protected boolean is429Error(Exception e)
      Description copied from class: AbstractEmbeddingsClient
      Checks if the given exception represents a rate limit error (HTTP 429). Subclasses must implement based on their HTTP client/SDK.
      Specified by:
      is429Error in class AbstractEmbeddingsClient
      Parameters:
      e - the exception to check
      Returns:
      true if this is a rate limit error
    • extractRateLimitInfo

      protected RateLimitInfo extractRateLimitInfo(Exception e)
      Description copied from class: AbstractEmbeddingsClient
      Extracts rate limit information from an exception if possible. May return null if the information is not available.
      Specified by:
      extractRateLimitInfo in class AbstractEmbeddingsClient
      Parameters:
      e - the exception containing rate limit info
      Returns:
      rate limit info or null