Skip to content

Commit

Permalink
add duration and boot config procoessor dep
Browse files Browse the repository at this point in the history
  • Loading branch information
markpollack committed Aug 22, 2023
1 parent 635a621 commit c9905fd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions spring-ai-spring-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public OpenAiService theoOpenAiService(OpenAiProperties openAiProperties) {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.time.Duration;

import static org.springframework.ai.autoconfigure.openai.OpenAiProperties.CONFIG_PREFIX;

@ConfigurationProperties(CONFIG_PREFIX)
Expand All @@ -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() {
Expand All @@ -55,4 +59,12 @@ public void setTemperature(Double temperature) {
this.temperature = temperature;
}

public Duration getDuration() {
return duration;
}

public void setDuration(Duration duration) {
this.duration = duration;
}

}

0 comments on commit c9905fd

Please sign in to comment.