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

Flatten messages in PromptBuilder #424

Merged
merged 4 commits into from
Sep 18, 2023
Merged

Flatten messages in PromptBuilder #424

merged 4 commits into from
Sep 18, 2023

Conversation

javipacheco
Copy link
Contributor

@javipacheco javipacheco commented Sep 13, 2023

This PR closes issue #423 for flattening messages in the PromBuilder

When we have a prompt like this

        Prompt {
            +system("Test System")
            +user("User message 1")
            +user("User message 2")
            +assistant("Assistant message 1")
            +user("User message 3")
            +assistant("Assistant message 2")
            +assistant("Assistant message 3")
            +user("User message 4")
          }

Prompt flattens the intermediate messages with the same role automatically in order to reduce the number of tokens to the AI

@raulraja
Copy link
Contributor

This should be the default behavior and not an operator

@javipacheco
Copy link
Contributor Author

@raulraja I have addressed your proposal in the PR. Could you please review again?

Copy link
Member

@Intex32 Intex32 left a comment

Choose a reason for hiding this comment

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

Me approves.

Copy link
Contributor

@raulraja raulraja left a comment

Choose a reason for hiding this comment

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

thanks @javipacheco !

@raulraja raulraja merged commit e6d7d50 into main Sep 18, 2023
5 checks passed
@raulraja raulraja deleted the 423-flatten-messages branch September 18, 2023 18:56
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