Add support for custom base url for OpenAI model in Spring Boot starter (#228)

This commit is contained in:
marlukcz 2023-10-17 21:26:45 +02:00 committed by GitHub
parent f43cc8f4ca
commit 9719d8233f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -46,6 +46,7 @@ public class LangChain4jAutoConfiguration {
throw illegalConfiguration("\n\nPlease define 'langchain4j.chat-model.openai.api-key' property");
}
return OpenAiChatModel.builder()
.baseUrl(openAi.getBaseUrl())
.apiKey(openAi.getApiKey())
.modelName(openAi.getModelName())
.temperature(openAi.getTemperature())

View File

@ -4,6 +4,7 @@ import java.time.Duration;
class OpenAi {
private String baseUrl;
private String apiKey;
private String modelName;
private Double temperature;
@ -16,6 +17,14 @@ class OpenAi {
private Boolean logRequests;
private Boolean logResponses;
public String getBaseUrl() {
return baseUrl;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
public String getApiKey() {
return apiKey;
}