Skip to content

fix(MessageChatMemoryAdvisor): Fix incorrect prompt position for system messages #3520

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Ahoo-Wang
Copy link
Contributor

  • First position of prompt to insert system message
  • Prioritize system messages in conversation history

- First position of prompt to insert system message
- Prioritize system messages in conversation history

Signed-off-by: Ahoo Wang <[email protected]>
- Replace stream-based instruction processing with a for loop
- Improve readability and performance by avoiding unnecessary stream operations

Signed-off-by: Ahoo Wang <[email protected]>
List<Message> processedMessages = new ArrayList<>(memoryMessages);
processedMessages.addAll(chatClientRequest.prompt().getInstructions());

List<Message> processedMessages = new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why put system in the first place? In my opinion, system indicates LLMS, and all subsequent conversations are based on system.

And from https://openai.com/index/gpt-4-api-general-availability/, system and user message do not have the same function.

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

Successfully merging this pull request may close these issues.

3 participants