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

Harrison/summary message rol #1783

Merged
merged 4 commits into from
Mar 19, 2023
Merged

Harrison/summary message rol #1783

merged 4 commits into from
Mar 19, 2023

Conversation

hwchase17
Copy link
Contributor

No description provided.

Aratako and others added 4 commits March 19, 2023 09:50
…ion memory (#1750)

In the current `ConcersationSummaryMemory`,
`ConversationSummaryBufferMemory` and `ConversationKGMemory`, summarized
messages are stored as `SystemMessage`.
However, according to the official documentation, gpt-3.5-turbo does not
pay much attention to the `system` role message and prefers important
information to be provided in the `user` role.

Quote 1 (https://github.com/openai/openai-python/blob/main/chatml.md)
> If adding instructions in the `system` message doesn't work, you can
also try putting them into a `user` message. (In the near future, we
will train our models to be much more steerable via the system message.
But to date, we have trained only on a few system messages, so the
models pay much more attention to user examples.)

Quote 2
(https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb)
> The system message can be used to prime the assistant with different
personalities or behaviors.
>
> However, the model does not generally pay as much attention to the
system message, and therefore we recommend placing important
instructions in the user message instead.

Therefore, this PR changes the behavior to allow storing summary
messages in roles other than system.
A new variable `summary_message_role` is added with a default value of
`"system"`. Depending on the value of this variable, the summary will be
stored as a `HumanMessage`, `AIMessage`, or `SystemMessage`.
@hwchase17 hwchase17 merged commit 951c158 into master Mar 19, 2023
@hwchase17 hwchase17 deleted the harrison/summary-message-rol branch March 19, 2023 17:09
hwchase17 pushed a commit that referenced this pull request Mar 19, 2023
After the changes in #1783, `summary_message_role` is no longer used in
`ConversationSummaryBufferMemory`, so this PR removes it.
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.

2 participants