This comprehensive tutorial series teaches you how to build applications with Large Language Models using the Python chatlas library. These hands-on tutorials follow the Diátaxis framework to provide practical, learner-focused instruction for working with modern AI systems.
Note
This content uses examples and concepts from the chatlas library and is made available under the Creative Commons Attribution license. See LICENSE.md for details.
Large Language Models (LLMs) are AI systems that can understand and generate human-like text. They power applications like ChatGPT, Claude, and Gemini. This workshop teaches you to build your own applications using these powerful models through the chatlas Python library.
chatlas is a Python library developed by Posit that simplifies working with LLMs by providing:
- Unified Interface: Work with OpenAI, Anthropic, Google, and other providers using the same API
- Conversation Management: Automatic context and history handling
- Function Calling: Extend LLMs with custom Python functions
- Streaming Support: Real-time response processing
- Multimodal Capabilities: Work with text, images, and files
This workshop takes you from basic setup to building production-ready LLM applications. Each tutorial includes hands-on exercises and real-world examples.
- Python developers interested in AI and LLMs
- Data scientists wanting to integrate LLMs into their workflows
- Researchers looking to automate analysis and writing tasks
- Anyone wanting to build practical AI applications
- Basic Python programming knowledge
- Understanding of API concepts
- Access to LLM provider accounts (OpenAI, Anthropic, etc.)
- Familiarity with command-line interfaces
The workshop consists of four progressive tutorials:
Type: Tutorial | Duration: 45-60 minutes
Learn to set up a complete Python environment for LLM development, including API key management, virtual environments, and cost controls.
You will learn to:
- Set up Python and virtual environments for LLM work
- Install and configure the chatlas library
- Obtain and securely manage API keys from various providers
- Understand API costs and implement cost management
- Verify your setup with working examples
Type: Tutorial | Duration: 60-75 minutes
Master the fundamentals of chatlas for creating conversations, managing context, and working with different LLM models and providers.
You will learn to:
- Create chat instances with different LLM providers
- Conduct single-turn and multi-turn conversations
- Use system prompts to control model behavior
- Handle different response types and formats
- Implement error handling and debugging techniques
- Build practical assistants and tutors
Type: Tutorial | Duration: 90-120 minutes
Explore advanced features including function calling, multimodal inputs, streaming responses, and sophisticated prompt engineering techniques.
You will learn to:
- Implement function calling to extend LLM capabilities
- Create custom tools for data analysis and external system integration
- Work with images, files, and multimodal content
- Use streaming for real-time applications
- Apply advanced prompt engineering patterns
- Build intelligent agents with multiple capabilities
- Monitor performance and handle production concerns
Type: Tutorial | Duration: 120-150 minutes
Build four complete, production-ready applications that solve real business problems using advanced LLM techniques.
You will learn to:
- Build a Document Intelligence System for automated analysis
- Create a Research Assistant for information synthesis
- Develop a Code Review Bot with automated feedback
- Construct a Writing Assistant for content creation
- Implement proper error handling and user interfaces
- Understand deployment and scaling considerations
- Complete the Setup: Start with 0_setup.qmd to configure your environment
- Learn the Basics: Work through 1_basic-usage.qmd
- Explore Advanced Features: Continue with 2_advanced-techniques.qmd
- Build Applications: Complete 3_practical-applications.qmd
- Quick Start (Tutorials 0-1): 2-3 hours
- Complete Workshop: 6-8 hours
- Self-paced: Can be completed over multiple sessions
For Beginners: Complete all tutorials in order For Experienced Developers: Start with tutorial 1, skim setup as needed For Specific Applications: Complete tutorials 0-1, then focus on relevant sections of tutorials 2-3
- Python: 3.10 or newer
- Operating System: Windows, macOS, or Linux
- RAM: 4GB minimum, 8GB recommended
- Internet Connection: Required for API access
- API Budget: $10-50 for learning (varies by usage)
You'll need at least one of these:
- OpenAI: Most popular, good documentation, moderate cost
- Anthropic (Claude): High-quality responses, competitive pricing
- Google (Gemini): Good free tier, competitive features
- Local Models: Free but requires setup (Ollama, etc.)
- chatlas Documentation
- chatlas GitHub Repository
- OpenAI API Documentation
- Anthropic API Documentation
- Getting Started with chatlas - Official introduction video
This workshop follows the Diátaxis framework for technical documentation:
- Tutorials (like these): Learning-oriented, hands-on lessons with practical exercises
- How-to guides: Problem-oriented instructions for specific tasks
- Reference material: Information-oriented technical descriptions
- Explanation: Understanding-oriented discussions of concepts
All content is designed as tutorials - practical, hands-on lessons that teach through doing real projects.
- Tutorial 0-1: $2-5 (basic testing and learning)
- Tutorial 2: $5-10 (function calling and advanced features)
- Tutorial 3: $10-20 (building complete applications)
- Total Workshop: $20-35 (varies by model choice and usage)
- Start with cheaper models (gpt-3.5-turbo vs gpt-4)
- Use shorter prompts when learning
- Set up billing alerts on provider platforms
- Consider free tiers (Google Gemini, local models)
By completing this workshop, you'll have built:
-
Document Intelligence System
- Analyze and summarize documents
- Extract key information automatically
- Generate reports and insights
-
Research Assistant
- Gather information from multiple sources
- Synthesize findings into coherent reports
- Manage research sessions and bibliography
-
Code Review Bot
- Analyze code for bugs and improvements
- Provide specific feedback and suggestions
- Support multiple programming languages
-
Writing Assistant
- Create content from outlines
- Improve existing text for clarity and style
- Generate ideas and brainstorm topics
This workshop is part of the IPA Research and Data Science Training. If you find issues or have suggestions:
- Check existing GitHub Issues
- Submit new issues or suggestions
- Contribute improvements via pull requests
This workshop content is licensed under CC BY 4.0.
chatlas Library: Licensed under MIT by Posit PBC
Video Content: Getting Started with chatlas by Posit
Tutorial Content: Created for IPA Research and Data Science Training
"Cannot install chatlas":
- Ensure you're using Python 3.10+
- Try upgrading pip:
pip install --upgrade pip - Use virtual environments to avoid conflicts
API Authentication Errors:
- Verify your API keys are correct
- Check that billing is set up on provider platforms
- Ensure
.envfile is in the correct location
High API Costs:
- Monitor usage on provider dashboards
- Switch to cheaper models for testing
- Use shorter prompts and fewer iterations
Rate Limiting:
- Wait before retrying requests
- Consider upgrading your API plan
- Implement exponential backoff in your code
- Check tutorial troubleshooting sections: Each tutorial includes specific guidance
- Consult chatlas documentation: posit-dev.github.io/chatlas
- Search GitHub issues: Often questions have been asked before
- Ask on forums: Use community resources for additional support
After completing this workshop, you'll be able to:
- Build conversational AI applications with multiple LLM providers
- Create intelligent agents that can use tools and external APIs
- Process multimodal content including text, images, and documents
- Implement production-ready applications with proper error handling
- Apply prompt engineering techniques for optimal results
- Manage costs and monitor performance in production systems
Workshop Duration: 6-8 hours total | Skill Level: Beginner to Advanced | Last Updated: 2024
Ready to start building with LLMs? Begin with Tutorial 0: Setting Up Your Environment!