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

feat(prompts): Prompt interface should reference few-shot examples explicitly #51

Closed
5 tasks done
ludwiktrammer opened this issue Sep 26, 2024 · 4 comments · Fixed by #59
Closed
5 tasks done
Assignees
Labels
core Changes to the core package feature New feature or request
Milestone

Comments

@ludwiktrammer
Copy link
Collaborator

ludwiktrammer commented Sep 26, 2024

It should be more clear that the ability to add additional messages to prompt instances is intended for adding few-shot messages, not keeping there the entire conversation history.

  • Rename the static field called additional_messages to few_shots
  • Replace the add_user_message and add_assistant_message methods with a single add_few_shot method (which takes both question and answer)
  • Make sure that add_few_shot appends the messages to a separate instance field, not the static few_shot
  • Replace instance fields called system_message and user_message to rendered_system_prompt and rendered_user_prompt
  • Change the chat method so the conversation contains messages in the following order (and clearly document the order in the method docstring):
    1. rendered_system_prompt
    2. static few_shots
    3. messages added by add_few_shot
    4. rendered_user_prompt
@ludwiktrammer ludwiktrammer converted this from a draft issue Sep 26, 2024
@ludwiktrammer ludwiktrammer changed the title feat(prompts): Prompt interface should reference two-shot examples explicitely feat(prompts): Prompt interface should reference two-shot examples explicitly Sep 26, 2024
@ludwiktrammer ludwiktrammer added the feature New feature or request label Sep 26, 2024
@mhordynski
Copy link
Member

I find introducing name message is a little confusing, I would go with following naming convention:

system_prompt
user_prompt
few_shot_examples
add_few_shot_example (or add_few_shot for shorter version)

@mhordynski mhordynski changed the title feat(prompts): Prompt interface should reference two-shot examples explicitly feat(prompts): Prompt interface should reference few-shot examples explicitly Sep 26, 2024
@ludwiktrammer
Copy link
Collaborator Author

ludwiktrammer commented Sep 30, 2024

@mhordynski We already use "message". Currently "prompt" means the static prompt template (that is always the same), and "message" means the actual rendered message that is send as part of the conversation.

So for example, you can access both prompt.system_prompt and prompt.system_message. The former might be Let's talk about {{ theme }} while the latter would be Let's talk about dogs.

@ludwiktrammer ludwiktrammer self-assigned this Sep 30, 2024
@ludwiktrammer ludwiktrammer moved this from Backlog to Ready in ragbits Sep 30, 2024
@ludwiktrammer
Copy link
Collaborator Author

We decided to change system_message and user_message to something that doesn't include "message" but weren't able to come up with a good alternative yet. I'll try to come up with one.

Instead of add_few_shot_message we decided to use add_few_shot.

@ludwiktrammer
Copy link
Collaborator Author

To be honest, the current version with "message" seems quite intuitive to me, so personally I will be okay with leaving it as-is, but I can't deny your experience of getting confused by it.

Some options:

  • system_prompt_instance
  • rendered_system_prompt
  • system_prompt_text
  • bounded_system_prompt

@ludwiktrammer ludwiktrammer added this to the Ragbits 0.1 milestone Oct 3, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in ragbits Oct 3, 2024
@micpst micpst added the core Changes to the core package label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Changes to the core package feature New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants