Skip to content
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

The Default System Prompt is not the first element in the messages array #2216

Open
rafaelrddc opened this issue Feb 11, 2025 · 1 comment
Open
Milestone

Comments

@rafaelrddc
Copy link

rafaelrddc commented Feb 11, 2025

Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description
When we use the chatClient class with "defaultSystem" and "MessageChatMemoryAdvisor", when making the call to OpenAI with a message history, the first element of the array is not of role "system"

Image

Environment
Spring AI: 1.0.0-M5
Java version: 21.0.5-zulu

Steps to reproduce
I created a chatClient linked to a "defaultSystem" and with the "MessageChatMemoryAdvisor", and checked the order of the messages sent to OpenAI.

Expected behavior
The default system message will always be the first message in the array sent to OpenAI.

Minimal Complete Reproducible example
Please provide a failing test or a minimal complete verifiable example that reproduces the issue.
Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.

@ThomasVitale
Copy link
Contributor

Thanks for reporting this issue. I would recommend addressing this together with #873, making sure to implement a consistent and predictable strategy for placing system messages across different use cases.

@ilayaperumalg ilayaperumalg added this to the 1.0.0-M7 milestone Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants