@ -72,12 +72,12 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
return OpenAiChatModel . builder ( )
. baseUrl ( chatModelConfig . providerConfig ( ) . baseUrl ( ) )
. apiKey ( chatModelConfig . providerConfig ( ) . apiKey ( ) )
. modelName ( chatModelConfig . getM odelId( ) )
. temperature ( chatModelConfig . ge tT emperature( ) )
. topP ( chatModelConfig . ge tT opP( ) )
. frequencyPenalty ( chatModelConfig . getF requencyPenalty( ) )
. presencePenalty ( chatModelConfig . getP resencePenalty( ) )
. maxTokens ( chatModelConfig . getM axOutputTokens( ) )
. modelName ( chatModelConfig . m odelId( ) )
. temperature ( chatModelConfig . temperature ( ) )
. topP ( chatModelConfig . topP ( ) )
. frequencyPenalty ( chatModelConfig . f requencyPenalty( ) )
. presencePenalty ( chatModelConfig . p resencePenalty( ) )
. maxTokens ( chatModelConfig . m axOutputTokens( ) )
. timeout ( toDuration ( chatModelConfig . timeoutSeconds ( ) ) )
. maxRetries ( chatModelConfig . maxRetries ( ) )
. build ( ) ;
@ -90,12 +90,12 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
. endpoint ( providerConfig . endpoint ( ) )
. serviceVersion ( providerConfig . serviceVersion ( ) )
. apiKey ( providerConfig . apiKey ( ) )
. deploymentName ( chatModelConfig . getM odelId( ) )
. temperature ( chatModelConfig . ge tT emperature( ) )
. topP ( chatModelConfig . ge tT opP( ) )
. frequencyPenalty ( chatModelConfig . getF requencyPenalty( ) )
. presencePenalty ( chatModelConfig . getP resencePenalty( ) )
. maxTokens ( chatModelConfig . getM axOutputTokens( ) )
. deploymentName ( chatModelConfig . m odelId( ) )
. temperature ( chatModelConfig . temperature ( ) )
. topP ( chatModelConfig . topP ( ) )
. frequencyPenalty ( chatModelConfig . f requencyPenalty( ) )
. presencePenalty ( chatModelConfig . p resencePenalty( ) )
. maxTokens ( chatModelConfig . m axOutputTokens( ) )
. timeout ( toDuration ( chatModelConfig . timeoutSeconds ( ) ) )
. maxRetries ( chatModelConfig . maxRetries ( ) )
. build ( ) ;
@ -105,13 +105,13 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
public ChatModel configureChatModel ( GoogleAiGeminiChatModelConfig chatModelConfig ) {
return GoogleAiGeminiChatModel . builder ( )
. apiKey ( chatModelConfig . providerConfig ( ) . apiKey ( ) )
. modelName ( chatModelConfig . getM odelId( ) )
. temperature ( chatModelConfig . ge tT emperature( ) )
. topP ( chatModelConfig . ge tT opP( ) )
. topK ( chatModelConfig . ge tT opK( ) )
. frequencyPenalty ( chatModelConfig . getF requencyPenalty( ) )
. presencePenalty ( chatModelConfig . getP resencePenalty( ) )
. maxOutputTokens ( chatModelConfig . getM axOutputTokens( ) )
. modelName ( chatModelConfig . m odelId( ) )
. temperature ( chatModelConfig . temperature ( ) )
. topP ( chatModelConfig . topP ( ) )
. topK ( chatModelConfig . topK ( ) )
. frequencyPenalty ( chatModelConfig . f requencyPenalty( ) )
. presencePenalty ( chatModelConfig . p resencePenalty( ) )
. maxOutputTokens ( chatModelConfig . m axOutputTokens( ) )
. timeout ( toDuration ( chatModelConfig . timeoutSeconds ( ) ) )
. maxRetries ( chatModelConfig . maxRetries ( ) )
. build ( ) ;
@ -165,28 +165,28 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
// map model config to generation config
var generationConfigBuilder = GenerationConfig . newBuilder ( ) ;
if ( chatModelConfig . ge tT emperature( ) ! = null ) {
generationConfigBuilder . setTemperature ( chatModelConfig . ge tT emperature( ) . floatValue ( ) ) ;
if ( chatModelConfig . temperature ( ) ! = null ) {
generationConfigBuilder . setTemperature ( chatModelConfig . temperature ( ) . floatValue ( ) ) ;
}
if ( chatModelConfig . ge tT opP( ) ! = null ) {
generationConfigBuilder . setTopP ( chatModelConfig . ge tT opP( ) . floatValue ( ) ) ;
if ( chatModelConfig . topP ( ) ! = null ) {
generationConfigBuilder . setTopP ( chatModelConfig . topP ( ) . floatValue ( ) ) ;
}
if ( chatModelConfig . ge tT opK( ) ! = null ) {
generationConfigBuilder . setTopK ( chatModelConfig . ge tT opK( ) ) ;
if ( chatModelConfig . topK ( ) ! = null ) {
generationConfigBuilder . setTopK ( chatModelConfig . topK ( ) ) ;
}
if ( chatModelConfig . getF requencyPenalty( ) ! = null ) {
generationConfigBuilder . setFrequencyPenalty ( chatModelConfig . getF requencyPenalty( ) . floatValue ( ) ) ;
if ( chatModelConfig . f requencyPenalty( ) ! = null ) {
generationConfigBuilder . setFrequencyPenalty ( chatModelConfig . f requencyPenalty( ) . floatValue ( ) ) ;
}
if ( chatModelConfig . getF requencyPenalty( ) ! = null ) {
generationConfigBuilder . setPresencePenalty ( chatModelConfig . getF requencyPenalty( ) . floatValue ( ) ) ;
if ( chatModelConfig . f requencyPenalty( ) ! = null ) {
generationConfigBuilder . setPresencePenalty ( chatModelConfig . f requencyPenalty( ) . floatValue ( ) ) ;
}
if ( chatModelConfig . getM axOutputTokens( ) ! = null ) {
generationConfigBuilder . setMaxOutputTokens ( chatModelConfig . getM axOutputTokens( ) ) ;
if ( chatModelConfig . m axOutputTokens( ) ! = null ) {
generationConfigBuilder . setMaxOutputTokens ( chatModelConfig . m axOutputTokens( ) ) ;
}
var generationConfig = generationConfigBuilder . build ( ) ;
// construct generative model instance
var generativeModel = new GenerativeModel ( chatModelConfig . getM odelId( ) , vertexAI ) . withGenerationConfig ( generationConfig ) ;
var generativeModel = new GenerativeModel ( chatModelConfig . m odelId( ) , vertexAI ) . withGenerationConfig ( generationConfig ) ;
return new VertexAiGeminiChatModel ( generativeModel , generationConfig , chatModelConfig . maxRetries ( ) ) ;
}
@ -203,12 +203,12 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
public ChatModel configureChatModel ( MistralAiChatModelConfig chatModelConfig ) {
return MistralAiChatModel . builder ( )
. apiKey ( chatModelConfig . providerConfig ( ) . apiKey ( ) )
. modelName ( chatModelConfig . getM odelId( ) )
. temperature ( chatModelConfig . ge tT emperature( ) )
. topP ( chatModelConfig . ge tT opP( ) )
. frequencyPenalty ( chatModelConfig . getF requencyPenalty( ) )
. presencePenalty ( chatModelConfig . getP resencePenalty( ) )
. maxTokens ( chatModelConfig . getM axOutputTokens( ) )
. modelName ( chatModelConfig . m odelId( ) )
. temperature ( chatModelConfig . temperature ( ) )
. topP ( chatModelConfig . topP ( ) )
. frequencyPenalty ( chatModelConfig . f requencyPenalty( ) )
. presencePenalty ( chatModelConfig . p resencePenalty( ) )
. maxTokens ( chatModelConfig . m axOutputTokens( ) )
. timeout ( toDuration ( chatModelConfig . timeoutSeconds ( ) ) )
. maxRetries ( chatModelConfig . maxRetries ( ) )
. build ( ) ;
@ -218,11 +218,11 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
public ChatModel configureChatModel ( AnthropicChatModelConfig chatModelConfig ) {
return AnthropicChatModel . builder ( )
. apiKey ( chatModelConfig . providerConfig ( ) . apiKey ( ) )
. modelName ( chatModelConfig . getM odelId( ) )
. temperature ( chatModelConfig . ge tT emperature( ) )
. topP ( chatModelConfig . ge tT opP( ) )
. topK ( chatModelConfig . ge tT opK( ) )
. maxTokens ( chatModelConfig . getM axOutputTokens( ) )
. modelName ( chatModelConfig . m odelId( ) )
. temperature ( chatModelConfig . temperature ( ) )
. topP ( chatModelConfig . topP ( ) )
. topK ( chatModelConfig . topK ( ) )
. maxTokens ( chatModelConfig . m axOutputTokens( ) )
. timeout ( toDuration ( chatModelConfig . timeoutSeconds ( ) ) )
. maxRetries ( chatModelConfig . maxRetries ( ) )
. build ( ) ;
@ -242,14 +242,14 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
. build ( ) ;
var defaultChatRequestParams = ChatRequestParameters . builder ( )
. temperature ( chatModelConfig . ge tT emperature( ) )
. topP ( chatModelConfig . ge tT opP( ) )
. maxOutputTokens ( chatModelConfig . getM axOutputTokens( ) )
. temperature ( chatModelConfig . temperature ( ) )
. topP ( chatModelConfig . topP ( ) )
. maxOutputTokens ( chatModelConfig . m axOutputTokens( ) )
. build ( ) ;
return BedrockChatModel . builder ( )
. client ( bedrockClient )
. modelId ( chatModelConfig . getM odelId( ) )
. modelId ( chatModelConfig . m odelId( ) )
. defaultRequestParameters ( defaultChatRequestParams )
. timeout ( toDuration ( chatModelConfig . timeoutSeconds ( ) ) )
. maxRetries ( chatModelConfig . maxRetries ( ) )
@ -260,12 +260,12 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
public ChatModel configureChatModel ( GitHubModelsChatModelConfig chatModelConfig ) {
return GitHubModelsChatModel . builder ( )
. gitHubToken ( chatModelConfig . providerConfig ( ) . personalAccessToken ( ) )
. modelName ( chatModelConfig . getM odelId( ) )
. temperature ( chatModelConfig . ge tT emperature( ) )
. topP ( chatModelConfig . ge tT opP( ) )
. frequencyPenalty ( chatModelConfig . getF requencyPenalty( ) )
. presencePenalty ( chatModelConfig . getP resencePenalty( ) )
. maxTokens ( chatModelConfig . getM axOutputTokens( ) )
. modelName ( chatModelConfig . m odelId( ) )
. temperature ( chatModelConfig . temperature ( ) )
. topP ( chatModelConfig . topP ( ) )
. frequencyPenalty ( chatModelConfig . f requencyPenalty( ) )
. presencePenalty ( chatModelConfig . p resencePenalty( ) )
. maxTokens ( chatModelConfig . m axOutputTokens( ) )
. timeout ( toDuration ( chatModelConfig . timeoutSeconds ( ) ) )
. maxRetries ( chatModelConfig . maxRetries ( ) )
. build ( ) ;
@ -275,12 +275,12 @@ class Langchain4jChatModelConfigurerImpl implements Langchain4jChatModelConfigur
public ChatModel configureChatModel ( OllamaChatModelConfig chatModelConfig ) {
var builder = OllamaChatModel . builder ( )
. baseUrl ( chatModelConfig . providerConfig ( ) . baseUrl ( ) )
. modelName ( chatModelConfig . getM odelId( ) )
. temperature ( chatModelConfig . ge tT emperature( ) )
. topP ( chatModelConfig . ge tT opP( ) )
. topK ( chatModelConfig . ge tT opK( ) )
. numCtx ( chatModelConfig . getC ontextLength( ) )
. numPredict ( chatModelConfig . getContextLength ( ) )
. modelName ( chatModelConfig . m odelId( ) )
. temperature ( chatModelConfig . temperature ( ) )
. topP ( chatModelConfig . topP ( ) )
. topK ( chatModelConfig . topK ( ) )
. numCtx ( chatModelConfig . c ontextLength( ) )
. numPredict ( chatModelConfig . maxOutputTokens ( ) )
. timeout ( toDuration ( chatModelConfig . timeoutSeconds ( ) ) )
. maxRetries ( chatModelConfig . maxRetries ( ) ) ;