From 4789b9355d3c9e342eeed6fd05d6fbab32aefaec Mon Sep 17 00:00:00 2001 From: Enrique Barcelli Date: Sat, 6 Sep 2025 00:29:31 +0800 Subject: [PATCH] Add extraction and display of the model response text from the json API response --- create_model_response.py | 2 ++ retrieve_model_response.py | 1 + 2 files changed, 3 insertions(+) diff --git a/create_model_response.py b/create_model_response.py index f2be4ad..51f68a5 100644 --- a/create_model_response.py +++ b/create_model_response.py @@ -23,5 +23,7 @@ def create_model_response(conversation,model,message): response = requests.request("POST", url, headers=headers, data=payload) print(response.text) + print(response.json()["output"][-1]["content"][0]["text"]) + if __name__ == '__main__': create_model_response(str(sys.argv[1]),str(sys.argv[2]),str(sys.argv[3])) diff --git a/retrieve_model_response.py b/retrieve_model_response.py index 9412b87..89a41ab 100644 --- a/retrieve_model_response.py +++ b/retrieve_model_response.py @@ -13,6 +13,7 @@ def retrieve_model_response(response): response = requests.request("GET", url, headers=headers, data=payload) print(response.text) + print(response.json()["output"][-1]["content"][0]["text"]) if __name__ == '__main__': retrieve_model_response(str(sys.argv[1]))