Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feat/bedrock structured outputs#20753

Open
akintunero wants to merge 4 commits intorun-llama:mainfrom
akintunero:feat/bedrock-structured-outputs
Open

Feat/bedrock structured outputs#20753
akintunero wants to merge 4 commits intorun-llama:mainfrom
akintunero:feat/bedrock-structured-outputs

Conversation

@akintunero
Copy link
Contributor

Description

AWS Bedrock launched native structured outputs in February 2026 via theoutputConfig.textFormat parameter. This feature adds native support for structured outputs to thellama-index-llms-bedrock-converse integration, replacing the function calling workaround for supported models.

Changes:

  • AddBEDROCK_STRUCTURED_OUTPUT_SUPPORTED_MODELS tuple with supported models (Claude 4.5+, Amazon Nova, DeepSeek, Mistral)
  • Addis_bedrock_structured_output_supported() function with region prefix support
  • Implementstructured_predict() andastructured_predict() methods
  • Fall back to function calling for unsupported models (backward compatible)
  • Add 4 unit tests for model support detection

Supported Models:

  • Claude 4.5+ (haiku, sonnet, opus)
  • Amazon Nova (pro, lite, micro)
  • DeepSeek R1
  • Mistral Large

Fixes#20703

New Package?

  • Yes
  • No

Version Bump?

  • Yes
  • No

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • I added new unit tests to cover this change
  • I believe this change is already covered by existing unit tests

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added Google Colab support for the newly added notebooks.
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I ranuv run make format; uv run make lint to appease the lint gods

- Add _strip_thinking_tokens() helper to remove thinking tags from text- Apply to non-streaming _get_content_and_tool_calls() method- Apply to all streaming methods (stream_chat, astream_chat)- Add Literal import that was missing from upstream- Handles Amazon Nova models that include thinking tokens in response text- Add 7 unit tests for the strip functionFixesrun-llama#20489
…erse- Add _strip_thinking_tokens() static method to remove thinking tags- Re-introduce accidentally removed generic_utils imports- Apply fix to all streaming and non-streaming methods- Bump version to 0.12.10- Update tests to use actual method instead of duplicating logicFixesrun-llama#20489
@dosubotdosubotbot added the size:LThis PR changes 100-499 lines, ignoring generated files. labelFeb 19, 2026
- Add BEDROCK_STRUCTURED_OUTPUT_SUPPORTED_MODELS tuple with supported models- Add is_bedrock_structured_output_supported() function- Implement structured_predict() and astructured_predict() methods- Fall back to function calling for unsupported models- Add 4 unit tests for model support detectionFixesrun-llama#20703
@akintuneroakintuneroforce-pushed thefeat/bedrock-structured-outputs branch from7fbac0f to53f233fCompareFebruary 19, 2026 22:19
Copy link
Member

@AstraBertAstraBert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Before review, strip_thinking_tokens should be removed

Comment on lines +389 to +398
@staticmethod
def _strip_thinking_tokens(text: str) -> str:
"""
Remove <thinking>...</thinking> tokens from text.

Some models (e.g., Amazon Nova) include thinking tokens in the response
text even when thinking is disabled. This helper removes them.
"""
return re.sub(r"<thinking>.*?</thinking>", "", text, flags=re.DOTALL).strip()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

These are unrelated changes, you prob need to rebase your PR on main instead of basing it off of the same branch where you proposed the strip thinking tokens changes

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

Reviewers

@AstraBertAstraBertAstraBert requested changes

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

size:LThis PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Feature Request: Native Structured Outputs for AWS Bedrock Converse API

2 participants

@akintunero@AstraBert

Comments


[8]ページ先頭

©2009-2026 Movatter.jp