← Back to Tutorials

Build a Multi-Modal Chatbot

Multi-Model Conversations

Use LangChain or LiteLLM to switch between frontier models (GPT-4o, Claude, Gemini) with the same interface.

pip install langchain langchain-openai litellm

Gradio UIs

Gradio lets you prototype AI interfaces in minutes.

import gradio as gr

def chat(message, history):
    return f"You said: {message}"

gr.ChatInterface(chat, title="AI Chatbot").launch()

System Prompts & Multi-Shot Prompting

system_prompt = "You are a helpful airline assistant."
messages = [
    {"role": "system", "content": system_prompt},
    {"role": "user", "content": "Book a flight from NYC to London."}
]

Tool Calling with Airline Assistant

Build an agentic workflow where the LLM calls tools to query an SQLite database for flights.

import sqlite3

def search_flights(origin, destination, date):
    conn = sqlite3.connect("flights.db")
    cursor = conn.cursor()
    cursor.execute("SELECT * FROM flights WHERE origin=? AND destination=?",
                   (origin, destination))
    return cursor.fetchall()

Multi-Modal Capabilities

✏️ Exercise: Build a multi-modal airline assistant chatbot with: (1) a Gradio ChatInterface, (2) SQLite tool for flight searches, (3) DALL-E integration for destination images, and (4) TTS for spoken responses. Use system prompts to guide the conversation.