Skip to content

Commit

Permalink
Removed max retries from OpenAI streaming chat model (helidon-io#9767)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-langer authored Feb 11, 2025
1 parent ffb25fd commit cf9acb4
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ interface OpenAiChatModelConfigBlueprint extends OpenAiCommonConfig {
*/
String CONFIG_ROOT = "langchain4j.open-ai.chat-model";

/**
* The maximum number of retries for failed API requests.
*
* @return an {@link java.util.Optional} containing the maximum number of retries
*/
@Option.Configured
Optional<Integer> maxRetries();

/**
* The sampling temperature to use, between 0 and 2.
* Higher values make the output more random, while lower values make it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ interface OpenAiCommonConfig {
@Option.Configured
Optional<Duration> timeout();

/**
* The maximum number of retries for failed API requests.
*
* @return an {@link java.util.Optional} containing the maximum number of retries
*/
@Option.Configured
Optional<Integer> maxRetries();

/**
* Proxy to use.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ interface OpenAiEmbeddingModelConfigBlueprint extends OpenAiCommonConfig {
*/
String CONFIG_ROOT = "langchain4j.open-ai.embedding-model";

/**
* The maximum number of retries for failed API requests.
*
* @return an {@link java.util.Optional} containing the maximum number of retries
*/
@Option.Configured
Optional<Integer> maxRetries();

/**
* The dimensionality of the embeddings generated by the model.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ interface OpenAiImageModelConfigBlueprint extends OpenAiCommonConfig {
*/
String CONFIG_ROOT = "langchain4j.open-ai.image-model";

/**
* The maximum number of retries for failed API requests.
*
* @return an {@link java.util.Optional} containing the maximum number of retries
*/
@Option.Configured
Optional<Integer> maxRetries();

/**
* The desired size of the generated images.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ interface OpenAiLanguageModelConfigBlueprint extends OpenAiCommonConfig {
*/
String CONFIG_ROOT = "langchain4j.open-ai.language-model";

/**
* The maximum number of retries for failed API requests.
*
* @return an {@link java.util.Optional} containing the maximum number of retries
*/
@Option.Configured
Optional<Integer> maxRetries();

/**
* The sampling temperature to use, between 0 and 2.
* Higher values make the output more random, while lower values make it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

package io.helidon.integrations.langchain4j.providers.openai;

import java.util.Optional;

import io.helidon.builder.api.Option;
import io.helidon.builder.api.Prototype;

/**
Expand All @@ -26,11 +29,17 @@
*/
@Prototype.Configured(OpenAiLanguageModelConfigBlueprint.CONFIG_ROOT)
@Prototype.Blueprint
// we want to have an explicit type for configuration, even if it does not add methods
@SuppressWarnings("checkstyle:InterfaceIsType")
interface OpenAiModerationModelConfigBlueprint extends OpenAiCommonConfig {
/**
* Default configuration prefix.
*/
String CONFIG_ROOT = "langchain4j.open-ai.moderation-model";

/**
* The maximum number of retries for failed API requests.
*
* @return an {@link java.util.Optional} containing the maximum number of retries
*/
@Option.Configured
Optional<Integer> maxRetries();
}

0 comments on commit cf9acb4

Please sign in to comment.