-
Notifications
You must be signed in to change notification settings - Fork 960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double remote call on DefaultChatClient with content and chatResponse #2097
Comments
Signed-off-by: Lorenzo Caenazzo <lorenzo.caenazzo@optionfactory.net>
Thanks for raising this issue. The API is designed to support only one terminal call operation via the That's the same behaviour present in other Client APIs in the Spring portfolio, such as If you need full access to the response (e.g. metadata), I suggest using the |
Ok, but maybe like "java stream API" if a terminal operation is called twice the second call throws. At the moment the feeling are the "content" call are a shortcut to invoke "chatResponse().getResult().getOutput().getText()" on SAME response. Last 2 cents seems "DefaultResponseSpec" in DefaultRestClient save the |
Bug description
In DefaultChatClient#DefaultCallResponseSpec (also in streaming) call chatResponse or conent trigger the remote call twice.
Environment
Spring AI version M5 confirmed also on
main
Steps to reproduce
simply call chatResponse and content and double remote service is invoked
Expected behavior
per "DefaultCallResponseSpec" access to same response (memoized)
Minimal Complete Reproducible example
The text was updated successfully, but these errors were encountered: