From 9b538ff074b895528a48993527f9c9162a398c05 Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Tue, 15 Apr 2025 10:54:41 -0700 Subject: [PATCH] update assistant message format --- demos/shared/chatbot_ui/run_stream.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/demos/shared/chatbot_ui/run_stream.py b/demos/shared/chatbot_ui/run_stream.py index f06a6155..89448355 100644 --- a/demos/shared/chatbot_ui/run_stream.py +++ b/demos/shared/chatbot_ui/run_stream.py @@ -93,12 +93,16 @@ def chat( # { # "response": "", # } + # and this entire block needs to be encoded in ```json\n{json_encoded_content}\n``` if not history[-1]["model"].startswith("Arch"): assistant_response = { "response": history[-1]["content"], } - history[-1]["content"] = json.dumps(assistant_response) + history[-1]["content"] = "```json\n{}\n```".format( + json.dumps(assistant_response) + ) + log.info("history: {}".format(json.dumps(history))) def main():