Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run models API returns Internal Server Error #113

Closed
edwardzjl opened this issue Nov 4, 2022 · 3 comments
Closed

Run models API returns Internal Server Error #113

edwardzjl opened this issue Nov 4, 2022 · 3 comments

Comments

@edwardzjl
Copy link

POST to /run returns Internal Server Error:

TypeError: Object of type datetime is not JSON serializable

The RunExecutionResult has a generated_at field of type datetime.datetime, and in fastapi 0.68.1 it is not supported to serialize datetime.datetime to json.

Update fastapi to the latest release (0.86.0) will solve this problem.

@joemirizio
Copy link

Yeah, more specifically, this version of fastapi doesn't properly handle serialization of nested properties in dataclasses. Looks like it was fixed in 0.81.0.

If changing the version is not possible, another workaround would be to explicitly call dataclasses.asdict on the results or similarly call jsonable_encoder twice.

encoded_results = jsonable_encoder(jsonable_encoder(results))

@lostmygithubaccount
Copy link
Contributor

hello! apologies for the slow response here. there should be fixed in a future release -- we've fixed this in our own testing internally either with the solution above or similarly json_encoder(results.to_dict())

that /run endpoint is not officially supported yet (perhaps despite clear documentation) -- stay tuned for that and more soon!

@racheldaniel
Copy link
Contributor

Closing this issue, as the endpoint in question has been deprecated in favor of the /invocations endpoint and should not have the same bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants