From 2f0c6296c83cf7e1982af6e2eaed1dcdfeb621f2 Mon Sep 17 00:00:00 2001 From: Sarah Wooders Date: Fri, 12 Apr 2024 22:29:42 -0700 Subject: [PATCH] fix: convert `Message` objects to dicts for local LLMs (#1251) --- memgpt/local_llm/chat_completion_proxy.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/memgpt/local_llm/chat_completion_proxy.py b/memgpt/local_llm/chat_completion_proxy.py index b6fa2a75..47b8c9d5 100644 --- a/memgpt/local_llm/chat_completion_proxy.py +++ b/memgpt/local_llm/chat_completion_proxy.py @@ -58,6 +58,10 @@ def get_chat_completion( global has_shown_warning grammar = None + # TODO: eventually just process Message object + if not isinstance(messages[0], dict): + messages = [m.to_openai_dict() for m in messages] + if function_call is not None and function_call != "auto": raise ValueError(f"function_call == {function_call} not supported (auto or None only)")