kkulakov/agents-course-final-assignment
0
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
- Clone the repository:
git clone <repository-url>
cd agents-course-final-assignment- Install dependencies:
npm install- Create a
.envfile 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_idUsage
Build the project
npm run buildThis compiles the TypeScript code to JavaScript in the dist directory.
Run the application
npm startor
npm run devThe 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:
- Download All Questions
- Downloads all available questions from the evaluation API
- Checks for and downloads any associated files
- Download Random Question
- Downloads a single random question from the evaluation API
- Checks for and downloads any associated file
- Answer Questions
- Processes all downloaded questions
- For each question:
- Checks if there's an associated file and processes it
- Uses the AI agent to generate an answer
- Caches the answer for future use
- Offers the option to submit answers for evaluation
- Exit
- 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 applicationsrc/agent.ts- AI agent implementation using LangGraphsrc/file-strategies/- Strategies for processing different file typesquestions/- Directory where downloaded questions and files are stored
