CoolFace
Apppublic

kkulakov/agents-course-final-assignment

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

Hugging Face AI Agents Course Final Assignment

This project is the final assignment for the Hugging Face AI Agents Course. It's a CLI application that uses an AI agent to answer questions, with support for processing various file types.

Features

  • Download questions from an evaluation API
  • Process different file types (MP3, PNG, Python, Excel) as context for questions
  • Use an AI agent powered by LangGraph and LangChain to answer questions
  • Submit answers to an evaluation API for scoring

Prerequisites

  • Node.js (v18+)
  • npm
  • OpenAI API key
  • Google API key and Custom Search Engine ID (for web search capability)

Installation

  1. 1.Clone the repository:
   git clone <repository-url>
   cd agents-course-final-assignment
  1. 1.Install dependencies:
   npm install
  1. 1.Create a .env file in the root directory with your API keys:
   OPENAI_API_KEY=your_openai_api_key
   GOOGLE_API_KEY=your_google_api_key
   GOOGLE_CSE_ID=your_google_custom_search_engine_id

Usage

Build the project

npm run build

This compiles the TypeScript code to JavaScript in the dist directory.

Run the application

npm start

or

npm run dev

The dev command builds and runs the application in one step.

CLI Interface

When you run the application, you'll see a menu with the following options:

  1. 1.Download All Questions
  2. 2.Downloads all available questions from the evaluation API
  3. 3.Checks for and downloads any associated files
  1. 1.Download Random Question
  2. 2.Downloads a single random question from the evaluation API
  3. 3.Checks for and downloads any associated file
  1. 1.Answer Questions
  2. 2.Processes all downloaded questions
  3. 3.For each question:
  4. 4.Checks if there's an associated file and processes it
  5. 5.Uses the AI agent to generate an answer
  6. 6.Caches the answer for future use
  7. 7.Offers the option to submit answers for evaluation
  1. 1.Exit
  2. 2.Exits the application

Agent Capabilities

The AI agent uses:

  • GPT-4.1 model from OpenAI
  • Google Custom Search for web search
  • Calculator for mathematical operations
  • Wikipedia for knowledge retrieval
  • File processing strategies for different file types

Project Structure

  • src/index.ts - Main CLI application
  • src/agent.ts - AI agent implementation using LangGraph
  • src/file-strategies/ - Strategies for processing different file types
  • questions/ - Directory where downloaded questions and files are stored