feat: list support in message.content (#122)
This commit is contained in:
parent
1951f7521c
commit
6cc3bd9752
2 changed files with 15 additions and 1 deletions
|
|
@ -151,6 +151,19 @@ def format_prompt_with_template(data: ChatCompletionRequest):
|
|||
unwrap(data.ban_eos_token, False),
|
||||
)
|
||||
|
||||
# Deal with list in messages.content
|
||||
# Just replace the content list with the very first text message
|
||||
for message in data.messages:
|
||||
if message["role"] == "user" and isinstance(message["content"], list):
|
||||
message["content"] = next(
|
||||
(
|
||||
content["text"]
|
||||
for content in message["content"]
|
||||
if content["type"] == "text"
|
||||
),
|
||||
"",
|
||||
)
|
||||
|
||||
# Overwrite any protected vars with their values
|
||||
data.template_vars.update(
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue