Class AzureOpenAIEmbeddingsClient
java.lang.Object
ai.redouble.nucleo.harness.llm.AbstractRateLimitedClient
ai.redouble.nucleo.harness.llm.AbstractEmbeddingsClient
ai.redouble.nucleo.providers.openai.AzureOpenAIEmbeddingsClient
- All Implemented Interfaces:
Client, EmbeddingsClient
Azure OpenAI embeddings client with rate limiting support.
- Since:
- 0.1 (2025-06-20)
- Author:
- Andrey Santrosyan
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractEmbeddingsClient
AbstractEmbeddingsClient.RawEmbeddingNested classes/interfaces inherited from class AbstractRateLimitedClient
AbstractRateLimitedClient.RateLimitedOperation<T> -
Field Summary
Fields inherited from class AbstractRateLimitedClient
modelFields inherited from interface EmbeddingsClient
DIMENSIONS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected AbstractEmbeddingsClient.RawEmbeddingdoCalculateEmbedding(String input, EmbeddingPurpose purpose) Implementation-specific method to calculate embeddings.protected RateLimitInfoExtracts rate limit information from an exception if possible.protected booleanChecks if the given exception represents a rate limit error (HTTP 429).Methods inherited from class AbstractEmbeddingsClient
embed, isServerErrorMethods inherited from class AbstractRateLimitedClient
accountIdentifier, executeWithRateLimit, getModel, isQuotaError, messageChainContains, quotaExhausted, setModelMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EmbeddingsClient
calculateEmbedding
-
Constructor Details
-
AzureOpenAIEmbeddingsClient
public AzureOpenAIEmbeddingsClient()
-
-
Method Details
-
doCalculateEmbedding
protected AbstractEmbeddingsClient.RawEmbedding doCalculateEmbedding(String input, EmbeddingPurpose purpose) throws IOException Description copied from class:AbstractEmbeddingsClientImplementation-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:
doCalculateEmbeddingin classAbstractEmbeddingsClient- Parameters:
input- the text to embedpurpose- 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
Description copied from class:AbstractEmbeddingsClientChecks if the given exception represents a rate limit error (HTTP 429). Subclasses must implement based on their HTTP client/SDK.- Specified by:
is429Errorin classAbstractEmbeddingsClient- Parameters:
e- the exception to check- Returns:
- true if this is a rate limit error
-
extractRateLimitInfo
Description copied from class:AbstractEmbeddingsClientExtracts rate limit information from an exception if possible. May return null if the information is not available.- Specified by:
extractRateLimitInfoin classAbstractEmbeddingsClient- Parameters:
e- the exception containing rate limit info- Returns:
- rate limit info or null
-