Closed turchinc closed 2 months ago
I see it now, this PR should resolve it: the withSystemInstruction(...) is a fluent API and returns a new model.
Thank you @turchinc for catching and resolving this issue! Highly appreciated!
@tzolov thanks for applying the fix! I can confirm my app is working now with snapshot.
Bug description
The system instructions I was providing indicated a JSON output format, but were getting ignored in Spring AI. The same exact instructions and prompt in the test console work perfectly.
https://console.cloud.google.com/vertex-ai/generative/multimodal/create/text
I debugged into this and even thought I could put in a PR for it, but honestly, I don't see where this goes wrong. In
private GeminiRequest createGeminiRequest(Prompt prompt)
I can clearly see my system instructions and the code looks like it adds them to the model:But in the debugger, at the return statement, the system instructions are empty:
Environment Please provide as many details as possible: Spring AI version, Java version, which vector store you use if any, etc
I should note, until this morning the code did not work at all, but the PR from last night solved that :)
Steps to reproduce
See code below.
Expected behavior
The system instructions are passed along in the gemini request.
Minimal Complete Reproducible example
Running this code the RAG responds with something to the effect:
In the console I get
{"response": "The URL for the Google search engine is www.google.com", "link": "https://www.google.com"}