-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
Bug description
When requesting logprobs generation from OpenAI via OpenAiChatOptions
the logprobs are generated, but never returned as part of the ChatResponse
.
OpenAiChatOptions.builder().logprobs(true).build()
Environment
Spring AI: 1.0.0-M7
Java: 21
Steps to reproduce
- Configure ChatClient with logprobs enabled in the ChatOptions
- Make Call to model
Expected behavior
Similar to other metadata, logprobs should be returned as part of the metadata.
i.e.
chatClient.call()
.chatResponse()
.getMetadata()
.get("logprobs");
Minimal Complete Reproducible example
@Bean
ApplicationRunner applicationRunner(ChatClient.Builder builder) {
return args -> System.out.println(builder
.defaultAdvisors(new PromptChatMemoryAdvisor(new InMemoryChatMemory()))
.defaultOptions(OpenAiChatOptions.builder().logprobs(true).build())
.build().prompt().system("You are a friendly assistant helping answer questions about pets")
.user("What is the best pet?")
.call()
.chatResponse()
.getMetadata()
.keySet());
}
Example Output:
[system-fingerprint, created]
dev-jonghoonpark