Templating: Add generation prompt appending

Append generation prompts if given the flag on an OAI chat completion
request.

This appends the "assistant" message to the instruct prompt. Defaults
to true since this is intended behavior.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2023-12-17 21:34:31 -05:00
committed by Brian Dashore
parent 041070fd6e
commit de9a19b5d3
4 changed files with 14 additions and 6 deletions

View File

@@ -26,6 +26,7 @@ class ChatCompletionRequest(CommonCompletionRequest):
# Take in a string as well even though it's not part of the OAI spec
messages: Union[str, List[Dict[str, str]]]
prompt_template: Optional[str] = None
add_generation_prompt: Optional[bool] = True
class ChatCompletionResponse(BaseModel):
id: str = Field(default_factory=lambda: f"chatcmpl-{uuid4().hex}")