add duration and boot config procoessor dep
This commit is contained in:
@@ -19,7 +19,7 @@ public class BeanOutputParser<T> implements OutputParser<T> {
|
||||
|
||||
private Class clazz;
|
||||
|
||||
public BeanOutputParser(Class clazz) {
|
||||
public BeanOutputParser(Class<T> clazz) {
|
||||
Objects.requireNonNull(clazz, "Java Class can not be null;");
|
||||
this.clazz = clazz;
|
||||
generateSchema();
|
||||
|
||||
@@ -41,6 +41,12 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -46,7 +46,7 @@ public class OpenAiAutoConfiguration {
|
||||
throw new IllegalArgumentException(
|
||||
"You must provide an API key with the property name " + CONFIG_PREFIX + ".api-key");
|
||||
}
|
||||
return new OpenAiService(openAiProperties.getApiKey());
|
||||
return new OpenAiService(openAiProperties.getApiKey(), openAiProperties.getDuration());
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -18,6 +18,8 @@ package org.springframework.ai.autoconfigure.openai;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import static org.springframework.ai.autoconfigure.openai.OpenAiProperties.CONFIG_PREFIX;
|
||||
|
||||
@ConfigurationProperties(CONFIG_PREFIX)
|
||||
@@ -29,6 +31,8 @@ public class OpenAiProperties {
|
||||
|
||||
private Double temperature = 0.7;
|
||||
|
||||
private Duration duration = Duration.ofSeconds(60);
|
||||
|
||||
private String model = "gpt-3.5-turbo";
|
||||
|
||||
public String getApiKey() {
|
||||
@@ -55,4 +59,12 @@ public class OpenAiProperties {
|
||||
this.temperature = temperature;
|
||||
}
|
||||
|
||||
public Duration getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(Duration duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user