mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-05 20:27:35 +00:00
for agents API, provider data from the header is not parsed as for agents there is no provider_data_validator meta-reference implementation. Added Together data validator as the provider_data_validator for now. Did some code changes accordingly.
This commit is contained in:
parent
208b861289
commit
572c01f454
5 changed files with 32 additions and 14 deletions
|
@ -3,7 +3,6 @@
|
|||
#
|
||||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
from typing import AsyncGenerator
|
||||
|
||||
from llama_models.llama3.api.chat_format import ChatFormat
|
||||
|
@ -61,6 +60,20 @@ class TogetherInferenceAdapter(Inference):
|
|||
role = "tool"
|
||||
else:
|
||||
role = message.role
|
||||
|
||||
if role == "user" and type(message.content) == list:
|
||||
contents = []
|
||||
for content in message.content:
|
||||
if type(content) == str:
|
||||
contents.append({"type": "text", "text": content})
|
||||
elif type(content) == ImageMedia:
|
||||
contents.append(
|
||||
{
|
||||
"type": "image_url",
|
||||
"image_url": {"url": content.image.uri},
|
||||
}
|
||||
)
|
||||
message.content = contents
|
||||
together_messages.append({"role": role, "content": message.content})
|
||||
|
||||
return together_messages
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue