fix: convert Message objects to dicts for local LLMs (#1251)

This commit is contained in:
Sarah Wooders
2024-04-12 22:29:42 -07:00
committed by GitHub
parent a3dfb15071
commit 2f0c6296c8

View File

@@ -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)")