Skip to content

docs: Update method name for structured output in Ollama docs#807

Open
apikodes wants to merge 3 commits intostrands-agents:mainfrom
apikodes:patch-1
Open

docs: Update method name for structured output in Ollama docs#807
apikodes wants to merge 3 commits intostrands-agents:mainfrom
apikodes:patch-1

Conversation

@apikodes
Copy link
Copy Markdown

@apikodes apikodes commented May 2, 2026

Description

When executing the example provided in the below documentation page:
https://strandsagents.com/docs/user-guide/concepts/model-providers/ollama/#structured-output

A deprecation warning is displayed as below:

DeprecationWarning: Agent.structured_output method is deprecated. You should pass in `structured_output_model` directly into the agent invocation. see: https://strandsagents.com/latest/documentation/docs/user-guide/concepts/agents/structured-output/

Related Issues

Type of Change

  • Content update/revision
  • Typo/formatting fix

Checklist

  • I have read the CONTRIBUTING document
  • My changes follow the project's documentation style
  • Links in the documentation are valid and working

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@apikodes apikodes temporarily deployed to manual-approval May 2, 2026 22:46 — with GitHub Actions Inactive
@apikodes apikodes temporarily deployed to manual-approval May 2, 2026 22:46 — with GitHub Actions Inactive
@apikodes apikodes changed the title Update method name for structured output in Ollama docs docs: Update method name for structured output in Ollama docs May 2, 2026
Comment thread src/content/docs/user-guide/concepts/model-providers/ollama.mdx Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

Assessment: Request Changes

The intent of this PR is correct — the Agent.structured_output() method is deprecated and the docs should be updated. However, the fix replaces it with Agent.structured_output_model() which is also not a valid method on the Agent class.

Per the project's own structured output documentation, structured_output_model is a parameter passed to the agent invocation, not a method. The correct migration pattern is:

# Deprecated
result = agent.structured_output(MyModel, "prompt")
print(result.field)

# Recommended
result = agent("prompt", structured_output_model=MyModel)
print(result.structured_output.field)

The code example and the explanatory text both need to be updated to reflect this parameter-based invocation pattern. See inline comments for specific suggestions.

Thank you for identifying the deprecation issue — just needs the correct replacement pattern!

Comment thread src/content/docs/user-guide/concepts/model-providers/ollama.mdx Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

Documentation Preview Ready

Your documentation preview has been successfully deployed!

Preview URL: https://d3ehv1nix5p99z.cloudfront.net/pr-cms-807/docs/user-guide/quickstart/overview/

Updated at: 2026-05-07T14:58:31.189Z

Comment thread src/content/docs/user-guide/concepts/model-providers/ollama.mdx Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Assessment: Request Changes

The code example is now correct and follows the recommended structured_output_model parameter pattern — nice update! One remaining issue: the descriptive text on line 200 still references the deprecated Agent.structured_output() method with its old API link, which contradicts the corrected code below it. Updating that sentence to describe only the new approach will make the docs consistent.

Small change, almost there! 👍

Copy link
Copy Markdown
Contributor

@gautamsirdeshmukh gautamsirdeshmukh left a comment

Choose a reason for hiding this comment

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

Hi there, happy to shepherd this along if you are able to take care of the remaining callout!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Assessment: Approve

All previous feedback has been addressed. The code example now correctly uses the structured_output_model parameter pattern, the descriptive text references the agent invocation with appropriate API link, and the overall pattern is consistent with the project's structured output documentation.

Thanks for iterating on this — the Ollama docs will now guide users to the correct, non-deprecated approach.

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.

2 participants