Currently, complete() takes an argument prompt of type Union[str, List[ConversationMessage], snowpark.Column].
Where ConversationMessage is defined as:
class ConversationMessage(TypedDict):
"""Represents an conversation interaction."""
role: str
"""The role of the participant. For example, "user" or "assistant"."""
content: str
"""The content of the message."""
But, in the documentation of the JSON arguments for the body of the REST API endpoint, another structure should be supported.
An array of objects representing a conversation in chronological order. Each object must contain either the content key or the content_list key.
So, we should have another supported type, with content_list.
Also, the parsing of the response seems to not support content_list.
yield parsed_resp["choices"][0]["delta"]["content"]
But, it looks like – as shown in the examples here: https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-rest-api#response – that it should support content_list, at least for the tool calls.
data: {"id":"78fe5630-95b1-4960-ac2b-7eb85536b08e","model":"claude-3-5-sonnet","choices":[{"delta":{"content_list":[{"name":"get_weather","tool_use_id":"tooluse_Iwuh-FEeTC-Iefsxu2ueKQ"}]}}],"usage":{}}
I think this is required to support prompts with images and/or tool calls.
Currently,
complete()takes an argumentpromptof typeUnion[str, List[ConversationMessage], snowpark.Column].Where
ConversationMessageis defined as:But, in the documentation of the JSON arguments for the body of the REST API endpoint, another structure should be supported.
So, we should have another supported type, with
content_list.Also, the parsing of the response seems to not support
content_list.But, it looks like – as shown in the examples here: https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-rest-api#response – that it should support
content_list, at least for the tool calls.I think this is required to support prompts with images and/or tool calls.