Skip to content

Latest commit

 

History

History
153 lines (113 loc) · 4.37 KB

File metadata and controls

153 lines (113 loc) · 4.37 KB

OpenAI Agent WSQ Course

This repository contains Streamlit applications demonstrating AI-powered chatbots and multi-agent systems using both OpenAI and Gemini APIs.

Live Demo: Invoice RAG Chat

Applications

1. Simple Chat (app/simple_chat.py)

A simple chatbot agent built with the OpenAI Agents SDK that can search the internet for current information.

Features:

  • Conversational chat interface using Streamlit
  • Internet search capability via Tavily API
  • Uses GPT-4.1-mini model
  • Chat history management with "New Chat" button

Required Environment Variables:

  • OPENAI_API_KEY - Your OpenAI API key
  • TAVILY_API_KEY - Your Tavily API key for web search

Run:

streamlit run app/simple_chat.py

2. Invoice RAG Chat

A Retrieval-Augmented Generation (RAG) application for querying invoice PDFs using natural language.

OpenAI Version (app/invoice_rag.py)

Features:

  • Upload and index multiple PDF invoices
  • Extracts text from PDFs and chunks it for embedding
  • Stores embeddings in ChromaDB vector database
  • Semantic search to find relevant invoice context
  • Chat interface to ask questions about your invoices
  • Uses OpenAI's text-embedding-3-large for embeddings
  • Uses GPT-4.1-mini for generating responses

Required Environment Variables:

  • OPENAI_API_KEY - Your OpenAI API key

Run:

streamlit run app/invoice_rag.py

Gemini Version (app/invoice_rag_gemini.py)

Features:

  • Same functionality as the OpenAI version
  • Uses Gemini's text-embedding-004 for embeddings
  • Uses gemini-2.0-flash-lite for generating responses
  • Uses Gemini's OpenAI-compatible API endpoint

Required Environment Variables:

  • GEMINI_API_KEY - Your Google Gemini API key

Run:

streamlit run app/invoice_rag_gemini.py

OpenRouter Version (app/invoice_rag_openrouter.py)

Features:

  • Same functionality as the OpenAI version
  • Uses OpenRouter's API for model access
  • Uses openai/text-embedding-3-small for embeddings
  • Uses google/gemini-2.5-flash-lite for generating responses

Required Environment Variables:

  • OPENROUTER_API_KEY - Your OpenRouter API key

Run:

streamlit run app/invoice_rag_openrouter.py

3. Multi-Agent Trip Planner

A multi-agent AI system that orchestrates multiple specialized agents to plan trips. This demonstrates real-world agentic AI patterns used in enterprise automation.

OpenAI Version (app/trip_planner.py)

Features:

  • Multiple specialized AI agents working together:
    • 🧠 Planner Agent - Creates day-by-day itineraries (uses Tavily search for attractions)
    • 💰 Budget Agent - Estimates and tracks trip costs (uses Tavily search for prices)
    • 🍣 Local Guide Agent - Recommends food and local tips (uses Tavily search for restaurants)
  • ✈️ Travel Agent Orchestrator - Coordinates all agents using .as_tool() pattern
  • Tavily Search Integration - Each agent searches for real-time, accurate information
  • Interactive UI for entering trip details
  • Structured output using Pydantic models
  • Tabbed results display for organized output
  • Uses GPT-4.1-mini model for all agents

Required Environment Variables:

  • OPENAI_API_KEY - Your OpenAI API key
  • TAVILY_API_KEY - Your Tavily API key for real-time search

Run:

streamlit run app/trip_planner.py

Gemini Version (app/trip_planner_gemini.py)

Features:

  • Same multi-agent functionality as the OpenAI version
  • Uses Gemini's OpenAI-compatible API endpoint
  • Uses gemini-2.0-flash model for all agents

Required Environment Variables:

  • GEMINI_API_KEY - Your Google Gemini API key
  • TAVILY_API_KEY - Your Tavily API key for real-time search

Run:

streamlit run app/trip_planner_gemini.py

Setup

  1. Clone the repository:

    git clone https://github.com/alfredang/TGS-2025059028-openai-agent-wsq-course.git
    cd TGS-2025059028-openai-agent-wsq-course
  2. Install dependencies:

    pip install streamlit openai python-dotenv pypdf chromadb tavily-python openai-agents
  3. Create a .env file in the project root:

    OPENAI_API_KEY=your_openai_api_key
    GEMINI_API_KEY=your_gemini_api_key
    OPENROUTER_API_KEY=your_openrouter_api_key
    TAVILY_API_KEY=your_tavily_api_key
    
  4. Run any application using the commands above.