From 658465e08886c5656fab3053642bd644abb5c505 Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Wed, 26 Feb 2025 15:30:23 -0500 Subject: [PATCH] always include the type field in requests some endpoints, e.g. nvidia's hosted meta/llama-3.2-11b-vision-instruct, are strict about input schema. they require messages to include the type field, i.e. {"text": ..., "type": "text"}. the type field needs to be specified at construction time for it to be included in the request. --- llama_stack/providers/utils/inference/openai_compat.py | 1 + 1 file changed, 1 insertion(+) diff --git a/llama_stack/providers/utils/inference/openai_compat.py b/llama_stack/providers/utils/inference/openai_compat.py index 1e684f4a3..88d68a4f1 100644 --- a/llama_stack/providers/utils/inference/openai_compat.py +++ b/llama_stack/providers/utils/inference/openai_compat.py @@ -527,6 +527,7 @@ async def convert_message_to_openai_dict_new(message: Message | Dict) -> OpenAIC elif isinstance(content, TextContentItem): return OpenAIChatCompletionContentPartTextParam( text=content.text, + type="text", ) elif isinstance(content, ImageContentItem): return OpenAIChatCompletionContentPartImageParam(