chapter three
3 Building Chat Clients for Model Providers
This chapter covers
- Understanding chatbots and chat clients in MEAI
- Using Chat Completions with major AI model providers
- Working with IChatClient as a unified abstraction
- Managing conversation history and basic streaming
The Microsoft.Extensions.AI (MEAI) library is the foundational layer for any AI agent, connecting your applications to large language model providers. We explore MEAI and the building blocks you’ll need. You’ll use this foundation to dive deeper into Agent Framework and build complete agent systems.
Note
From now on, MEAI refers to Microsoft.Extensions.AI; we use the full name when clarity requires.
3.1 Introducing Robby, the Robot Car Assistant
Most of the time, analogies work best when dealing with abstract concepts, so we’ll imagine things from a robot-car perspective. Let’s name our robot car Robby. As we go, we’ll see how Robby evolves from a simple chatbot to an advanced AI agent and even benefits from a team of agents and an agentic AI architecture.