Skip to content

Added prompt template config for system prompt and start sequence.

Hongtao Yang requested to merge hyang/anthropic-message-api into main

What does this merge request do and why?

This MR moves forward for supporting Anthropic's message API.

  • Added template config for system prompt and start of sequence.
  • Rename existing template to "user_template" and update all places that reference the old name.
  • Use the system prompt and start sequence in anthropic model call if they are provided.

As a result, the new format of the config around prompt templates is as following:

"prompt_template_config": {
  "templates": [
    {
      "name": "example_template",
      "template_path": "data/prompts/code_suggestions_complex.txt", 
      "system_template_path": "data/prompts/code_suggestions_complex_system.txt",
      "start_sequence_template_path": "data/prompts/code_suggestions_complex_start_sequence.tx"
    }
  ]
}

This MR does not use the additional template content yet, that will come in a follow up MR. Also, using the additional template content would require some refactoring on how we apply templates, because different model has a different way of constructing prompt now.

Advances #190 (parent #180 )

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Merge request checklist

  • I've ran the affected pipeline(s) to validate that nothing is broken.
  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.
Edited by Tan Le

Merge request reports