update response from upstream llm to now include it in dict with "response"

This commit is contained in:
Adil Hafeez 2025-03-31 18:42:46 -07:00
parent 5bd991e97b
commit f2323f771c
No known key found for this signature in database
GPG key ID: 9B18EF7691369645
4 changed files with 30 additions and 11 deletions

View file

@ -88,6 +88,18 @@ def chat(
yield "", conversation, history, debug_output, model_selector
# update assistant response to have correct format
# arch-fc 1.1 expects following format:
# {
# "response": "<assistant response>",
# }
if not history[-1]["model"].startswith("Arch"):
assistant_response = {
"response": history[-1]["content"],
}
history[-1]["content"] = json.dumps(assistant_response)
def main():
with gr.Blocks(