diff --git a/00_simple_chat_interface.py b/00_simple_chat_interface.py index d1fc757..940d56a 100644 --- a/00_simple_chat_interface.py +++ b/00_simple_chat_interface.py @@ -49,7 +49,13 @@ class Pipeline: }) ) - return response + if response.status_code == 200: + response_data = response.json() + + return response_data["choices"][0]["message"]["content"] + else: + logging.error(f"Error response {response.status_code}: {response.text}") + return f"Error: {response.status_code}" except requests.HTTPError as e: logging.error(f"Clientresponse error: {e}") return "HTTP backend error"