fix: 🔊 better logging for ggml completion endpoint

This commit is contained in:
Nate Sesti 2023-09-02 11:47:07 -07:00
parent 3af4d6b1ed
commit 0459b0c919

View file

@ -126,6 +126,11 @@ class GGML(LLM):
},
) as resp:
text = await resp.text()
completion = json.loads(text)["choices"][0]["text"]
self.write_log(f"Completion: \n\n{completion}")
return completion
try:
completion = json.loads(text)["choices"][0]["text"]
self.write_log(f"Completion: \n\n{completion}")
return completion
except Exception as e:
raise Exception(
f"Error calling /completion endpoint: {e}\n\nResponse text: {text}"
)