Skip to content

fix: handle 202 Accepted response in demo store method#211

Open
haifengqiu wants to merge 1 commit intoEverMind-AI:mainfrom
haifengqiu:bugfix/demo-202-handling
Open

fix: handle 202 Accepted response in demo store method#211
haifengqiu wants to merge 1 commit intoEverMind-AI:mainfrom
haifengqiu:bugfix/demo-202-handling

Conversation

@haifengqiu
Copy link
Copy Markdown

When background mode is enabled (the default), the memorize endpoint returns HTTP 202 Accepted. The current code calls raise_for_status() then unconditionally parses the response as a v1 completion response, but a 202 response body lacks the expected "data.status" field, causing store() to report failure even though the request was accepted.

Add an explicit 202 check after raise_for_status() to return success when the request has been queued for background processing.

Summary

Area

  • Architecture method
  • Benchmark
  • Use case
  • Documentation
  • Developer experience
  • CI, build, or release

Verification


Checklist

  • I kept the change scoped to the relevant area.
  • I updated docs, examples, or setup notes when behavior changed.
  • I added or updated tests when the change affects behavior.
  • I did not commit secrets, .env files, dependency folders, or generated output.
  • Active relative links in Markdown files resolve.

Notes for Reviewers

By submitting this pull request, I agree that my contribution is licensed under
the Apache License 2.0.

When background mode is enabled (the default), the memorize endpoint
returns HTTP 202 Accepted. The current code calls raise_for_status()
then unconditionally parses the response as a v1 completion response,
but a 202 response body lacks the expected "data.status" field,
causing store() to report failure even though the request was accepted.

Add an explicit 202 check after raise_for_status() to return success
when the request has been queued for background processing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

1 participant