Update chat prompt
This commit is contained in:
parent
02f9fb82fb
commit
62087514c6
1 changed files with 4 additions and 2 deletions
|
@ -696,10 +696,12 @@ class Llama:
|
||||||
Generated chat completion or a stream of chat completion chunks.
|
Generated chat completion or a stream of chat completion chunks.
|
||||||
"""
|
"""
|
||||||
stop = stop if stop is not None else []
|
stop = stop if stop is not None else []
|
||||||
|
chat_history = "".join(
|
||||||
|
f'### {"Human" if message["role"] == "user" else "Assistant"}:{message["content"]}'
|
||||||
for message in messages
|
for message in messages
|
||||||
)
|
)
|
||||||
PROMPT = f" \n\n### Instructions:{instructions}\n\n### Inputs:{chat_history}\n\n### Response:\nassistant: "
|
PROMPT = chat_history + "### Assistant:"
|
||||||
PROMPT_STOP = ["###", "\nuser: ", "\nassistant: ", "\nsystem: "]
|
PROMPT_STOP = ["### Assistant:", "### Human:", "\n"]
|
||||||
completion_or_chunks = self(
|
completion_or_chunks = self(
|
||||||
prompt=PROMPT,
|
prompt=PROMPT,
|
||||||
stop=PROMPT_STOP + stop,
|
stop=PROMPT_STOP + stop,
|
||||||
|
|
Loading…
Reference in a new issue