Skip to content

Add structured output with CMI example notebook#710

Open
manuwaik wants to merge 1 commit into
aws-samples:mainfrom
manuwaik:structured-output-cmi-example
Open

Add structured output with CMI example notebook#710
manuwaik wants to merge 1 commit into
aws-samples:mainfrom
manuwaik:structured-output-cmi-example

Conversation

@manuwaik

@manuwaik manuwaik commented May 22, 2026

Copy link
Copy Markdown

Closes #711

Summary

  • Adds custom-models/structured_output_with_cmi.ipynb demonstrating how to constrain Custom Model Import (CMI) outputs to a JSON schema via the response_format parameter on InvokeModel (OpenAIChatCompletion shape).
  • Walks through a news-article metadata extraction use case: baseline prompted JSON vs. schema-constrained generation, with a Pydantic-defined schema used for both the constraint and downstream validation.
  • Updates custom-models/README.md to link the new notebook.

Test plan

  • Run the notebook end-to-end against qwen.qwen3-coder-30b-a3b-v1:0 in us-east-1 and verify both baseline and structured-output cells succeed.
  • Confirm the structured-output JSON parses and validates against the Pydantic Article schema.
  • Swap MODEL_ARN for an imported CMI model ARN and confirm the same payload shape works.

Adds an example notebook under custom-models/ demonstrating how to
constrain imported model outputs to a JSON schema using `response_format`,
with a Pydantic-defined schema and validation step.
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

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.

Missing example: structured output with Custom Model Import (CMI)

1 participant