Skip to content

fix(llms): parse results outputText for AWS Bedrock Titan models (#7336) - #7341

Closed
Ritiky23 wants to merge 1 commit into
mem0ai:mainfrom
Ritiky23:fix/bedrock-titan-response-parsing
Closed

Ritiky23 wants to merge 1 commit into
mem0ai:mainfrom
Ritiky23:fix/bedrock-titan-response-parsing

Conversation

@Ritiky23

@Ritiky23 Ritiky23 commented Sep 15, 2026 •

Copy link
Copy Markdown

Summary of Changes
Closes #7336

In mem0/llms/aws_bedrock.py, _parse_response() previously evaluated response_json.get("completion", "") for legacy Amazon models (such as Amazon Titan text models). However, AWS Titan InvokeModel responses return text under results[0].outputText with no top-level completion field, causing generate_response() to always return "" and silently failing memory storage in Memory.add().

Changes Made:

  • Updated AWSBedrockLLM._parse_response() for the legacy amazon provider to inspect results[0].outputText first while preserving response_json.get("completion", "") as a fallback.
  • Added comprehensive unit test coverage in tests/llms/test_aws_bedrock.py verifying standard Titan responses, empty results fallback, and missing field handling.

Verification:
Ran pytest tests/llms/test_aws_bedrock.py — all 55 unit tests passed (100% pass rate).

@CLAassistant

CLAassistant commented Sep 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown

Thanks for taking the time to open this.

We only review pull requests that fix an issue we have already agreed to take on, so this one is closed for now.
Closed does not mean rejected. It means it is not in the queue yet, and reopening takes about a minute.

To get it reviewed:

  1. Make sure an issue describes the problem, with the version you are on, a runnable reproduction, and the real output or traceback you saw.
  2. Link it from this pull request description with Closes #<number>.
  3. Ask a maintainer to label that issue accepted. This pull request reopens by itself when they do.

Issue already labeled accepted? Just add Closes #<number> to the description. That reopens this too.

Documentation-only changes skip this gate entirely.

See CONTRIBUTING.md for the full policy.

@github-actions github-actions Bot closed this Sep 15, 2026
@github-actions github-actions Bot added the sdk-python Python SDK specific label Sep 15, 2026
@github-actions

Copy link
Copy Markdown

Hi @Ritiky23, thanks for opening this pull request.

This is just a soft check: you are not yet in this repo's vouched contributor list (.github/VOUCHED.td). Nothing is blocked and there is nothing you need to do.

A maintainer can vouch for you by commenting !vouch @Ritiky23 on any issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sdk-python Python SDK specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] AWS Bedrock: legacy amazon (Titan) responses always parse to '' — _parse_response reads a 'completion' field Titan never returns

2 participants