Skip to content

feat: support unstreamed Bedrock responses (Converse & Messages API) - #565

Open
SHAURYASANYAL3 wants to merge 5 commits into
MemoriLabs:mainfrom
SHAURYASANYAL3:main
Open

feat: support unstreamed Bedrock responses (Converse & Messages API)#565
SHAURYASANYAL3 wants to merge 5 commits into
MemoriLabs:mainfrom
SHAURYASANYAL3:main

Conversation

@SHAURYASANYAL3

@SHAURYASANYAL3 SHAURYASANYAL3 commented May 28, 2026

Copy link
Copy Markdown

This PR addresses an explicit REQUEST FOR CONTRIBUTION in the AWS Bedrock adapter by implementing unstreamed response

parsing. It also includes repository-wide standardization for environment templates, linting, and formatting to ensure
consistent CI/CD and developer experience.

Changes

  • Bedrock Adapter: Implemented logic in _adapter.py to parse unstreamed responses across multiple formats:
    • Converse API (output.message)
    • Messages API (role and content, e.g., Claude 3 on Bedrock)
    • Legacy completion format
  • Streaming Pipeline: Updated StreamingBody.read in memori/llm/invoke/streaming.py to wrap unstreamed responses in a
    list. This ensures structural consistency with how the SDK's adapters expect response payloads.
  • Modernization: Updated pyproject.toml to use modern SPDX license strings (license = "Apache-2.0") and removed
    deprecated classifiers to resolve setuptools build warnings.
  • Linting & Formatting:
    • Fixed indentation and duplication issues in .github/workflows/ci.yml.
    • Standardized repository-wide code style using Ruff (Python), ESLint, and Prettier (TypeScript).
    • Added scripts/run-linters.sh and updated pre-commit hooks for better reliability.
  • Repository Structure:
    • Renamed all .env.example files to .env.template for consistency.
    • Added root package-lock.json and linter utility scripts.
  • Tests: Added test_get_formatted_response_unstreamed cases to
    tests/llm/adapters/bedrock/test_llm_adapters_bedrock_adapter.py to verify all supported formats.
  • Documentation: Updated CHANGELOG.md to reflect these changes.

Checklist

  • I have branched from main
  • I have added/updated tests for my changes
  • All tests, linting, and formatting pass
  • Added an entry to CHANGELOG.md

All changes have been committed and pushed to origin/main.

SHAURYASANYAL3 and others added 2 commits May 28, 2026 17:29
…roject.toml

- Support Converse API, Messages API, and legacy completion formats for unstreamed Bedrock responses.
- Wrap unstreamed responses in a list in StreamingBody.read for adapter consistency.
- Add unit tests for all newly supported unstreamed Bedrock formats.
- Modernize pyproject.toml license declaration to SPDX string and remove deprecated classifiers.
@devwdave

Copy link
Copy Markdown
Contributor

@SHAURYASANYAL3

Thanks for adding this. The implementation looks good for the response shapes it targets, and the added tests cover Converse-style output.message, Claude Messages-style role/content, and legacy Claude completion responses.

This is a step in the right direction for supporting Bedrock streaming.

Please correct the linting issues and we can proceed with the review process.

devwdave and others added 3 commits May 28, 2026 22:54
- Fix indentation and duplication in .github/workflows/ci.yml
- Rename .env.example to .env.template across the repository
- Run ruff format on Python files
- Run eslint and prettier on TypeScript files
- Add missing scripts and package-lock.json
- Update run-linters.sh to be more resilient
@SHAURYASANYAL3

Copy link
Copy Markdown
Author

@devwdave i have fixed that lint issue once check if still the errors comes again i will work on it

@devwdave

Copy link
Copy Markdown
Contributor

It looks like your update includes a lot of changes outside the scope of the Bedrock adapter work, including CI/workflow updates, repo-wide env template renames, linting/pre-commit changes, changelog updates, docs formatting changes, and TypeScript-related files. Those may be valid improvements, but they make this PR harder to review safely and increase the risk of merging unrelated behavior changes.

Can you please narrow this PR to only the Bedrock unstreamed response parsing work and the directly related tests? Any broader cleanup or repository-wide standardization should be split into separate PRs so we can review those changes independently.

Once this is scoped down, I’m happy to take another look.

@jayyao18

Copy link
Copy Markdown
Contributor

Hi @SHAURYASANYAL3,

We're very grateful for your contribution and would like to invite you to our Discord!

You'll be able to:

  • Chat with with us directly
  • Sneak peek to what's coming next
  • Collaborate with other contributors
  • Participate in exclusive giveaways

Looking forward to working with you on improving Memori.

Jay
DevRel

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.

3 participants