As mentioned in this discussion the recommendation according to the ref docs is to use the OpenAI API when using Perplexity.
Perplexity adds fields to the ChatCompletion
like citations
. Right now there is no way to deserialize and expose these additional fields.
Expected Behavior
An API to define custom fields e.g. custom metadata fields?
Current Behavior
Additional fields are swallowed silently.
Context
https://docs.spring.io/spring-ai/reference/api/chat/perplexity-chat.html
Comment From: dev-jonghoonpark
related perplexity doc: https://docs.perplexity.ai/api-reference/chat-completions#response-citations
Comment From: sunyuhan1998
Yes, this is also a problem that many people encounter. Many models claim that their interfaces follow the OpenAI API standards, but in fact there are some subtle differences with the OpenAI API. However, at present, Spring AI directly deserializes the return results of the model interface into ChatCompletionChunk, lacking some customized means.