Messages and standard content blocks
Notebook· 01.02· 90–120 min· Lesson 11 of 129
The notebook opens in your lab, in a new tab. If your server is stopped, it starts first (a few seconds).
By the end you can
- Build conversations with
SystemMessage,HumanMessage,AIMessageandToolMessage, and with the equivalent dict and tuple formats. - Read every part of an
AIMessage:text,content,content_blocks,tool_calls,usage_metadata,response_metadata,id. - Explain
content(provider-shaped) vscontent_blocks(standard, provider-agnostic) and write one loop that reads reasoning, text and tool calls from any provider. - Send an image to a vision model with a standard image content block, knowing the provider's limits.
- Serialize a conversation to JSON and back, and render messages with rich display.
Before you start
Lesson 01.01.
