wisconsin
Lecture 24: Agent Dev 2

Lecture 24: Agent Dev 2

Content locked

The catalog is public. Reading this content requires approved access.

Sign in to read
Learning Objectives
Recap: Agent Dev 1
AI API Evolution
Today: From “Talks” to “Does”
Structured Outputs
The Problem
Naive Attempt #1 — Plain Text
How Reliable Is It?
Naive Attempt #2 — Ask For JSON
Structured Outputs
JSON Schema
Supported Types
Structured Output Request
Full Request
Response
Our Intent, as a JSON Schema
Better: Constrict Using an enum
Best (so far): Provide Fallback
Structured Outputs Summary
Defining and Using Tools
Tools
Tool Schema
Tool Schema with Parameters
Optional Parameters
Sending Tool Schemas to the Model
The Response: 2 Possible Formats
Handling Tool Calls
A Tool Response Isn’t a Chat Object!
Handling Tool Responses
The Agent Loop
Promises & Modals
The Problem: Creating a Comment
The Awkward Bit
Creating Our Own Promise
Promise Example
Our Promise Plan
Wrap the Modal in a Promise
Use the Promise to Pause Execution
Returning a “Cancelled” Message
HW11 Demo
Resources