AI rule node: add stop sequences for all providers
This commit is contained in:
parent
d81d41fd7b
commit
0960b4b179
@ -64,6 +64,7 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
|
||||
.frequencyPenalty(modelConfig.frequencyPenalty())
|
||||
.presencePenalty(modelConfig.presencePenalty())
|
||||
.maxTokens(modelConfig.maxOutputTokens())
|
||||
.stop(modelConfig.stopSequences())
|
||||
.timeout(toDuration(modelConfig.timeoutSeconds()))
|
||||
.maxRetries(modelConfig.maxRetries())
|
||||
.build();
|
||||
@ -80,6 +81,7 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
|
||||
.frequencyPenalty(modelConfig.frequencyPenalty())
|
||||
.presencePenalty(modelConfig.presencePenalty())
|
||||
.maxTokens(modelConfig.maxOutputTokens())
|
||||
.stop(modelConfig.stopSequences())
|
||||
.timeout(toDuration(modelConfig.timeoutSeconds()))
|
||||
.maxRetries(modelConfig.maxRetries())
|
||||
.build();
|
||||
@ -97,6 +99,7 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
|
||||
.frequencyPenalty(modelConfig.frequencyPenalty())
|
||||
.presencePenalty(modelConfig.presencePenalty())
|
||||
.maxOutputTokens(modelConfig.maxOutputTokens())
|
||||
.stopSequences(modelConfig.stopSequences())
|
||||
.timeout(toDuration(modelConfig.timeoutSeconds()))
|
||||
.maxRetries(modelConfig.maxRetries())
|
||||
.build();
|
||||
@ -171,6 +174,9 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
|
||||
if (modelConfig.maxOutputTokens() != null) {
|
||||
generationConfigBuilder.setMaxOutputTokens(modelConfig.maxOutputTokens());
|
||||
}
|
||||
if (modelConfig.stopSequences() != null) {
|
||||
generationConfigBuilder.addAllStopSequences(modelConfig.stopSequences());
|
||||
}
|
||||
var generationConfig = generationConfigBuilder.build();
|
||||
|
||||
// construct generative model instance
|
||||
@ -198,6 +204,7 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
|
||||
.frequencyPenalty(modelConfig.frequencyPenalty())
|
||||
.presencePenalty(modelConfig.presencePenalty())
|
||||
.maxTokens(modelConfig.maxOutputTokens())
|
||||
.stopSequences(modelConfig.stopSequences())
|
||||
.timeout(toDuration(modelConfig.timeoutSeconds()))
|
||||
.maxRetries(modelConfig.maxRetries())
|
||||
.build();
|
||||
@ -213,6 +220,7 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
|
||||
.topP(modelConfig.topP())
|
||||
.topK(modelConfig.topK())
|
||||
.maxTokens(modelConfig.maxOutputTokens())
|
||||
.stopSequences(modelConfig.stopSequences())
|
||||
.timeout(toDuration(modelConfig.timeoutSeconds()))
|
||||
.maxRetries(modelConfig.maxRetries())
|
||||
.build();
|
||||
@ -236,6 +244,7 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
|
||||
.temperature(modelConfig.temperature())
|
||||
.topP(modelConfig.topP())
|
||||
.maxOutputTokens(modelConfig.maxOutputTokens())
|
||||
.stopSequences(modelConfig.stopSequences())
|
||||
.build();
|
||||
|
||||
return BedrockChatModel.builder()
|
||||
@ -258,6 +267,7 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
|
||||
.frequencyPenalty(modelConfig.frequencyPenalty())
|
||||
.presencePenalty(modelConfig.presencePenalty())
|
||||
.maxTokens(modelConfig.maxOutputTokens())
|
||||
.stop(modelConfig.stopSequences())
|
||||
.timeout(toDuration(modelConfig.timeoutSeconds()))
|
||||
.maxRetries(modelConfig.maxRetries())
|
||||
.build();
|
||||
|
||||
@ -20,6 +20,8 @@ import lombok.With;
|
||||
import org.thingsboard.server.common.data.ai.model.AiModelType;
|
||||
import org.thingsboard.server.common.data.ai.provider.AmazonBedrockProviderConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record AmazonBedrockChatModel(
|
||||
AiModelType modelType,
|
||||
AmazonBedrockProviderConfig providerConfig,
|
||||
@ -32,6 +34,7 @@ public record AmazonBedrockChatModel(
|
||||
Double temperature,
|
||||
Double topP,
|
||||
Integer maxOutputTokens,
|
||||
List<String> stopSequences,
|
||||
Integer timeoutSeconds,
|
||||
Integer maxRetries
|
||||
) implements AiChatModelConfig<AmazonBedrockChatModel.Config> {}
|
||||
|
||||
@ -20,6 +20,8 @@ import lombok.With;
|
||||
import org.thingsboard.server.common.data.ai.model.AiModelType;
|
||||
import org.thingsboard.server.common.data.ai.provider.AnthropicProviderConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record AnthropicChatModel(
|
||||
AiModelType modelType,
|
||||
AnthropicProviderConfig providerConfig,
|
||||
@ -33,6 +35,7 @@ public record AnthropicChatModel(
|
||||
Double topP,
|
||||
Integer topK,
|
||||
Integer maxOutputTokens,
|
||||
List<String> stopSequences,
|
||||
Integer timeoutSeconds,
|
||||
Integer maxRetries
|
||||
) implements AiChatModelConfig<AnthropicChatModel.Config> {}
|
||||
|
||||
@ -20,6 +20,8 @@ import lombok.With;
|
||||
import org.thingsboard.server.common.data.ai.model.AiModelType;
|
||||
import org.thingsboard.server.common.data.ai.provider.AzureOpenAiProviderConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record AzureOpenAiChatModel(
|
||||
AiModelType modelType,
|
||||
AzureOpenAiProviderConfig providerConfig,
|
||||
@ -34,6 +36,7 @@ public record AzureOpenAiChatModel(
|
||||
Double frequencyPenalty,
|
||||
Double presencePenalty,
|
||||
Integer maxOutputTokens,
|
||||
List<String> stopSequences,
|
||||
Integer timeoutSeconds,
|
||||
Integer maxRetries
|
||||
) implements AiChatModelConfig<AzureOpenAiChatModel.Config> {}
|
||||
|
||||
@ -20,6 +20,8 @@ import lombok.With;
|
||||
import org.thingsboard.server.common.data.ai.model.AiModelType;
|
||||
import org.thingsboard.server.common.data.ai.provider.GithubModelsProviderConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record GitHubModelsChatModel(
|
||||
AiModelType modelType,
|
||||
GithubModelsProviderConfig providerConfig,
|
||||
@ -34,6 +36,7 @@ public record GitHubModelsChatModel(
|
||||
Double frequencyPenalty,
|
||||
Double presencePenalty,
|
||||
Integer maxOutputTokens,
|
||||
List<String> stopSequences,
|
||||
Integer timeoutSeconds,
|
||||
Integer maxRetries
|
||||
) implements AiChatModelConfig<GitHubModelsChatModel.Config> {}
|
||||
|
||||
@ -20,6 +20,8 @@ import lombok.With;
|
||||
import org.thingsboard.server.common.data.ai.model.AiModelType;
|
||||
import org.thingsboard.server.common.data.ai.provider.GoogleAiGeminiProviderConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record GoogleAiGeminiChatModel(
|
||||
AiModelType modelType,
|
||||
GoogleAiGeminiProviderConfig providerConfig,
|
||||
@ -35,6 +37,7 @@ public record GoogleAiGeminiChatModel(
|
||||
Double frequencyPenalty,
|
||||
Double presencePenalty,
|
||||
Integer maxOutputTokens,
|
||||
List<String> stopSequences,
|
||||
Integer timeoutSeconds,
|
||||
Integer maxRetries
|
||||
) implements AiChatModelConfig<GoogleAiGeminiChatModel.Config> {}
|
||||
|
||||
@ -20,6 +20,8 @@ import lombok.With;
|
||||
import org.thingsboard.server.common.data.ai.model.AiModelType;
|
||||
import org.thingsboard.server.common.data.ai.provider.GoogleVertexAiGeminiProviderConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record GoogleVertexAiGeminiChatModel(
|
||||
AiModelType modelType,
|
||||
GoogleVertexAiGeminiProviderConfig providerConfig,
|
||||
@ -35,6 +37,7 @@ public record GoogleVertexAiGeminiChatModel(
|
||||
Double frequencyPenalty,
|
||||
Double presencePenalty,
|
||||
Integer maxOutputTokens,
|
||||
List<String> stopSequences,
|
||||
Integer timeoutSeconds,
|
||||
Integer maxRetries
|
||||
) implements AiChatModelConfig<GoogleVertexAiGeminiChatModel.Config> {}
|
||||
|
||||
@ -20,6 +20,8 @@ import lombok.With;
|
||||
import org.thingsboard.server.common.data.ai.model.AiModelType;
|
||||
import org.thingsboard.server.common.data.ai.provider.MistralAiProviderConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record MistralAiChatModel(
|
||||
AiModelType modelType,
|
||||
MistralAiProviderConfig providerConfig,
|
||||
@ -34,6 +36,7 @@ public record MistralAiChatModel(
|
||||
Double frequencyPenalty,
|
||||
Double presencePenalty,
|
||||
Integer maxOutputTokens,
|
||||
List<String> stopSequences,
|
||||
Integer timeoutSeconds,
|
||||
Integer maxRetries
|
||||
) implements AiChatModelConfig<MistralAiChatModel.Config> {}
|
||||
|
||||
@ -20,6 +20,8 @@ import lombok.With;
|
||||
import org.thingsboard.server.common.data.ai.model.AiModelType;
|
||||
import org.thingsboard.server.common.data.ai.provider.OpenAiProviderConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record OpenAiChatModel(
|
||||
AiModelType modelType,
|
||||
OpenAiProviderConfig providerConfig,
|
||||
@ -34,6 +36,7 @@ public record OpenAiChatModel(
|
||||
Double frequencyPenalty,
|
||||
Double presencePenalty,
|
||||
Integer maxOutputTokens,
|
||||
List<String> stopSequences,
|
||||
Integer timeoutSeconds,
|
||||
Integer maxRetries
|
||||
) implements AiChatModelConfig<OpenAiChatModel.Config> {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user