Skip to content

fix(llms): parse Titan results outputText - #7343

Closed
aniruddhaadak80 wants to merge 1 commit into
mem0ai:mainfrom
aniruddhaadak80:fix/bedrock-titan-outputtext-7336
Closed

aniruddhaadak80 wants to merge 1 commit into
mem0ai:mainfrom
aniruddhaadak80:fix/bedrock-titan-outputtext-7336

Conversation

@aniruddhaadak80

Copy link
Copy Markdown
Contributor

Linked Issue

Closes #7336

Description

Legacy amazon (Titan) invoke_model responses always parsed to "", causing silent memory loss in Memory.add(). The request builder sends Titan shape (inputText / textGenerationConfig) but _parse_response read top-level completion, which Titan never returns (AWS shape is results[0].outputText). This PR reads results[0].outputText first and keeps completion as fallback for compat; empty/missing still returns "". Nova path untouched.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactor (no functional changes)
  • Documentation update

AI Assistance

  • No AI assistance

  • AI-assisted (autocomplete, or I asked a model questions while writing this)

  • AI-generated (an agent wrote most or all of this diff)

  • I can explain every line of this diff and how it interacts with the rest of the codebase, without asking an AI tool.

Tool: Muse Spark (OpenCode). I verified the repro before/after, ran targeted pytest, and ran ruff check locally.

Breaking Changes

N/A

Test Coverage

  • I added/updated unit tests
  • I added/updated integration tests
  • I tested manually (describe below)
  • No tests needed (explain why)

Titan body → "Hi from Titan" (test_titan_results_output_text, test_titan_generate_response); Nova content[0].text unchanged (test_nova_content_unchanged); missing/empty → ""; legacy completion fallback kept. pytest tests/llms/test_aws_bedrock.py -v: 58 passed. ruff check clean. New tests fail without fix ('' vs 'Hi from Titan').

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have added tests that prove my fix/feature works
  • New and existing tests pass locally
  • I have updated documentation if needed

Closes mem0ai#7336

Legacy amazon branch read completion which Titan never returns. Read results[0].outputText first, keep completion fallback.
@github-actions github-actions Bot added the sdk-python Python SDK specific label Sep 16, 2026
@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 16, 2026
@CLAassistant

CLAassistant commented Sep 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown

Hi @aniruddhaadak80, 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 @aniruddhaadak80 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