Skip to content

implement prompt template for chat completion #717

Open
@ehartford

Description

@ehartford

Is your feature request related to a problem? Please describe.
When generating chat completion, it is hard-coded to generate a non-standard prompt template that looks something like:

### User: <blabla>
### Assistant: <blabla>

system message is currently ignored.

f'### {"Human" if message["role"] == "user" else "Assistant"}:{message["content"]}'

This mostly works for most models. But it's not correct.

Describe the solution you'd like

  1. add a set of built-in prompt templates user can specify at inference time ["vicuna","alpaca","chatml","llama2-chat","oasst"] at minimum
  2. recommend copying design from ooba's instruction templates or fastchat's conversation
  3. add ability to pass a template string for other nonstandard formats (such as the one currently implemented in llama-cpp-python).

Describe alternatives you've considered
modifying llama-cpp-python to hard code it to llama2-chat format, not a great solution.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions