Open-Assistant
Open-Assistant copied to clipboard
Move OasstApiClient & OasstError to oasst_shared, parse Oasst standard exception
trafficstars
!! wait for changes of https://github.com/LAION-AI/Open-Assistant/pull/216 to be integrated
OasstApiClientwhich is currently part of the discord bot should be moved tooasst_sharedto be used by different python frontends (e.g. later text-frontend, testing etc.)- The exception class used in the server code
OasstErrorshould be moved tooasst_sharedand all locations that currently importoasst_backend.exceptionshave to be patched, e.g. tooasst_shared.exceptions. - The OA server supplies an error code + status message when standard OasstErrors happen. Instead of just using
response.raise_for_status()the OaastApiCient should check (e.g. inpost()) if the response (for non 2XX http status cases) contains a standard OASST JSON object (withmessageanderror_codefields) and if so raise a correspondingOasstErrorexception (including the http-status and Oasst-error code).
Json serialization of OasstError:
404 Error: Not Found
Response body:
{
"message": "Task for task_id=UUID('3fa85f64-5717-4562-b3fc-2c9a3f66afa6') not found",
"error_code": 2100
}
Response headers:
content-length: 103
content-type: application/json
Happy to take a crack at this. Feel free to assign to me
Step 1 & 2 are done in #287 and #289. Waiting to get them merged to work on step 3.
Step 1 & 2 are done in #287 and #289. Waiting to get them merged to work on step 3.
merged now :)
Step 3 is ready to go in #300