Add support for custom base url for OpenAI model in Spring Boot starter (#228)
This commit is contained in:
parent
f43cc8f4ca
commit
9719d8233f
|
@ -46,6 +46,7 @@ public class LangChain4jAutoConfiguration {
|
||||||
throw illegalConfiguration("\n\nPlease define 'langchain4j.chat-model.openai.api-key' property");
|
throw illegalConfiguration("\n\nPlease define 'langchain4j.chat-model.openai.api-key' property");
|
||||||
}
|
}
|
||||||
return OpenAiChatModel.builder()
|
return OpenAiChatModel.builder()
|
||||||
|
.baseUrl(openAi.getBaseUrl())
|
||||||
.apiKey(openAi.getApiKey())
|
.apiKey(openAi.getApiKey())
|
||||||
.modelName(openAi.getModelName())
|
.modelName(openAi.getModelName())
|
||||||
.temperature(openAi.getTemperature())
|
.temperature(openAi.getTemperature())
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.time.Duration;
|
||||||
|
|
||||||
class OpenAi {
|
class OpenAi {
|
||||||
|
|
||||||
|
private String baseUrl;
|
||||||
private String apiKey;
|
private String apiKey;
|
||||||
private String modelName;
|
private String modelName;
|
||||||
private Double temperature;
|
private Double temperature;
|
||||||
|
@ -16,6 +17,14 @@ class OpenAi {
|
||||||
private Boolean logRequests;
|
private Boolean logRequests;
|
||||||
private Boolean logResponses;
|
private Boolean logResponses;
|
||||||
|
|
||||||
|
public String getBaseUrl() {
|
||||||
|
return baseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBaseUrl(String baseUrl) {
|
||||||
|
this.baseUrl = baseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
public String getApiKey() {
|
public String getApiKey() {
|
||||||
return apiKey;
|
return apiKey;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue