From dfd6c115c4259f0c9a423b7e4f980b1767985a40 Mon Sep 17 00:00:00 2001 From: LangChain4j Date: Mon, 16 Sep 2024 14:18:21 +0200 Subject: [PATCH] OpenAI: added maxCompletionTokens --- .../src/main/java/dev/langchain4j/openai/spring/AutoConfig.java | 2 ++ .../java/dev/langchain4j/openai/spring/ChatModelProperties.java | 1 + 2 files changed, 3 insertions(+) diff --git a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/AutoConfig.java b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/AutoConfig.java index 29dab48d..d3527a17 100644 --- a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/AutoConfig.java +++ b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/AutoConfig.java @@ -26,6 +26,7 @@ OpenAiChatModel openAiChatModel(Properties properties) { .topP(chatModelProperties.getTopP()) .stop(chatModelProperties.getStop()) .maxTokens(chatModelProperties.getMaxTokens()) + .maxCompletionTokens(chatModelProperties.getMaxCompletionTokens()) .presencePenalty(chatModelProperties.getPresencePenalty()) .frequencyPenalty(chatModelProperties.getFrequencyPenalty()) .logitBias(chatModelProperties.getLogitBias()) @@ -57,6 +58,7 @@ OpenAiStreamingChatModel openAiStreamingChatModel(Properties properties) { .topP(chatModelProperties.getTopP()) .stop(chatModelProperties.getStop()) .maxTokens(chatModelProperties.getMaxTokens()) + .maxCompletionTokens(chatModelProperties.getMaxCompletionTokens()) .presencePenalty(chatModelProperties.getPresencePenalty()) .frequencyPenalty(chatModelProperties.getFrequencyPenalty()) .logitBias(chatModelProperties.getLogitBias()) diff --git a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ChatModelProperties.java b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ChatModelProperties.java index b578cada..4277630a 100644 --- a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ChatModelProperties.java +++ b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ChatModelProperties.java @@ -20,6 +20,7 @@ class ChatModelProperties { Double topP; List stop; Integer maxTokens; + Integer maxCompletionTokens; Double presencePenalty; Double frequencyPenalty; Map logitBias;