From the course: Creating Agents with Python and the AI Toolkit for Visual Studio Code
Unlock this course with a free trial
Join today to access over 25,200 courses taught by industry experts.
Understanding and modifying schemas for structured output
From the course: Creating Agents with Python and the AI Toolkit for Visual Studio Code
Understanding and modifying schemas for structured output
When you want your agent to return results in a predictable format, you'll need to use a schema. A schema is essentially a blueprint that defines what the output should look like. By applying a JSON schema, you can make sure the agent's responses are consistent, structured, and machine readable. So why does this matter? Without a schema, responses may vary in style or format, which can make it difficult to process them programmatically. With a schema, you know exactly what fields to expect, what types of values they hold, and how they're organized. Here's some tips for working with schemas. Define the structure. Use JSON schemas to specify required fields, optional fields, and the data types such as strings, numbers, or arrays. Guide the agent. By providing the schema, you give the agent a framework to follow, so its output matches what your application needs. Modify as needed. You can edit schemas to adapt the output format, whether you're adding a new field, changing a data type, or…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.