log error message on bad api response (#243)

This commit is contained in:
Rich Jones 2025-02-28 15:32:27 +01:00 committed by GitHub
parent b4207162ff
commit 8e2089b6c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -139,6 +139,9 @@ class AsyncModelEvaluator:
params["extra_body"] = {"provider": {"order": [self.config.provider], "allow_fallbacks": False}}
completion = await self.client.chat.completions.create(**params)
if completion.error:
raise Exception(completion.error["message"])
response = completion.choices[0].message.content
if self.verbose: