use pydantic v2's model_dump() instead of dict()

This commit is contained in:
Matthew Farrellee 2024-11-21 10:04:26 -05:00
parent 5fbfb9d854
commit 3ed2e816fa

View file

@ -118,7 +118,7 @@ def _convert_message(message: Message) -> Dict:
"""
Convert a Message to an OpenAI API-compatible dictionary.
"""
out_dict = message.dict()
out_dict = message.model_dump()
# Llama Stack uses role="ipython" for tool call messages, OpenAI uses "tool"
if out_dict["role"] == "ipython":
out_dict.update(role="tool")