julep-ai/julep

Fix error handling and logging when calling OpenAI APIs

Opened this issue · 0 comments

Pass on the 400 errors from OpenAI to the user instead of causing a server error and throwing a 500.
For example; the following error caused by invalid tool spec causes a 500.
It should throw a 400 and notify the user instead:

openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid schema for function 'search_forum': 'int' is not valid under any of the given schemas.", 'type': 'invalid_request_error', 'param': None, 'code': None}}