QuestionQ32

Prompt Engineering & Structured Output

Your get_portfolio_value tool returns the overall value of a user’s investment portfolio. You are choosing between returning a structured JSON object with explicit fields or returning the information as a formatted text string. What is the main advantage of using structured output with defined fields?

Explanation

Defined fields create a predictable data contract, allowing an agent or downstream code to retrieve a specific portfolio value directly instead of parsing a free-form formatted string. This reduces extraction mistakes in later operations. Structured Outputs are designed to make generated data conform to a supplied schema, rather than to validate the factual correctness of an underlying API response.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!