diff --git a/src/content/docs/user-guide/concepts/model-providers/ollama.mdx b/src/content/docs/user-guide/concepts/model-providers/ollama.mdx index 23c804690..2aaa2faf0 100644 --- a/src/content/docs/user-guide/concepts/model-providers/ollama.mdx +++ b/src/content/docs/user-guide/concepts/model-providers/ollama.mdx @@ -197,7 +197,7 @@ factual_agent = Agent(model=factual_model) ### Structured Output -Ollama supports structured output for models that have tool calling capabilities. When you use [`Agent.structured_output()`](@api/python/strands.agent.agent#Agent.structured_output), the Strands SDK converts your Pydantic models to tool specifications that compatible Ollama models can understand. +Ollama supports structured output for models that have tool calling capabilities. When you pass `structured_output_model` parameter to the [agent invocation](@api/python/strands.agent.agent#Agent.__call__), the Strands SDK converts your Pydantic models to tool specifications that compatible Ollama models can understand. ```python from pydantic import BaseModel, Field @@ -219,19 +219,18 @@ ollama_model = OllamaModel( agent = Agent(model=ollama_model) -result = agent.structured_output( - BookAnalysis, - """ - Analyze this book: "The Hitchhiker's Guide to the Galaxy" by Douglas Adams. +result = agent( + """Analyze this book: "The Hitchhiker's Guide to the Galaxy" by Douglas Adams. It's a science fiction comedy about Arthur Dent's adventures through space - after Earth is destroyed. It's widely considered a classic of humorous sci-fi. - """ + after Earth is destroyed. It's widely considered a classic of humorous sci-fi.""", + structured_output_model=BookAnalysis, ) -print(f"Title: {result.title}") -print(f"Author: {result.author}") -print(f"Genre: {result.genre}") -print(f"Rating: {result.rating}") +book_analysis: BookAnalysis = result.structured_output +print(f"Title: {book_analysis.title}") +print(f"Author: {book_analysis.author}") +print(f"Genre: {book_analysis.genre}") +print(f"Rating: {book_analysis.rating}") ``` ## Tool Support