From c74c7fc65b1720c405cdda153c534d53f48cc98c Mon Sep 17 00:00:00 2001 From: Simon Stone Date: Mon, 19 Feb 2024 09:08:54 -0500 Subject: [PATCH] fixes fatal error in `generate()` When using the non-streaming endpoint, the payload is not returned as a list of dictionaries, but as a single dictionary. Trying to index into it raises a `KeyError`. The fix is to simply remove the index operation and unpack the payload directly. --- clients/python/text_generation/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/python/text_generation/client.py b/clients/python/text_generation/client.py index bbccbf1d..7a8e076d 100644 --- a/clients/python/text_generation/client.py +++ b/clients/python/text_generation/client.py @@ -154,7 +154,7 @@ class Client: payload = resp.json() if resp.status_code != 200: raise parse_error(resp.status_code, payload) - return Response(**payload[0]) + return Response(**payload) def generate_stream( self,