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
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:
parent
bd0099aa29
commit
e58bea20ca
1 changed files with 3 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue