MyGit

v0.8.0

linux-china/chatgpt-spring-boot-starter

版本发布时间: 2024-08-07 22:38:36

linux-china/chatgpt-spring-boot-starter最新发布版本:v0.8.0(2024-08-07 22:38:36)

Structured Output

Please refer OpenAI Structured Outputs for detail.

First you need to define an record for structured output:

@StructuredOutput(name = "java_example")
public record JavaExample(@Parameter("explanation") String explanation, @Parameter("answer") String answer,
		@Parameter("code") String code, @Parameter("dependencies") List<String> dependencies) {
}

Then you can use structured output record as return type as following:

        @ChatCompletion(system = "You are a helpful Java language assistant.")
   	Mono<JavaExample> generateJavaExample(String question);

Attention: if the return type is not Mono<String>, and it means structured output.

相关地址:原始地址 下载(tar) 下载(zip)

查看:2024-08-07发行的版本