feat(logging): Add debug log for empty OpenAI responses
All checks were successful
Docker CI/CD / Docker Build and Push to Docker Hub (push) Successful in 16m29s

Introduces logging for cases where OpenAI's API returns an empty response, ensuring that such occurrences are captured for debugging purposes. This change enhances visibility into the interaction with OpenAI's endpoint, facilitating easier identification and resolution of issues where empty responses are received, potentially indicating API limitations, network issues, or unexpected behavior from the AI model.
This commit is contained in:
Kumi 2024-05-16 06:40:03 +02:00
parent bd0099aa29
commit e58bea20ca
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -493,6 +493,9 @@ class OpenAI:
model=original_model,
)
if not result_text:
self.logger.log(f"Received an empty response from the OpenAI endpoint.", "debug")
try:
tokens_used = response.usage.total_tokens
except: