Punisher2444's picture
Upload folder using huggingface_hub
054839b verified
metadata
title: Agent with smolagents + DeepSeek
emoji: 🧠
colorFrom: indigo
colorTo: blue
sdk: gradio
app_file: main.py
pinned: false

Hugging Face Agent Project

This project implements a Hugging Face agent using the smolagents framework. The agent is designed to handle various tasks by utilizing custom tools and models.

Project Structure

huggingface-agent-project
β”œβ”€β”€ main.py               # Entry point for the agent
β”œβ”€β”€ agent_config.py       # Configuration and model loading
β”œβ”€β”€ tools                 # Directory for custom tools
β”‚   β”œβ”€β”€ __init__.py       # Package initializer for tools
β”‚   β”œβ”€β”€ wiki_tool.py      # Tool for fetching Wikipedia summaries
β”‚   β”œβ”€β”€ web_search_tool.py # Tool for performing web searches using DuckDuckGo
β”‚   β”œβ”€β”€ excel_analysis_tool.py # Tool for analyzing Excel files
β”œβ”€β”€ requirements.txt      # Project dependencies
└── README.md             # Project documentation

Setup Instructions

  1. Clone the repository:

    git clone <repository-url>
    cd huggingface-agent-project
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    

Usage

To run the agent, execute the following command:

python main.py

Agent Capabilities

The agent is capable of performing various tasks by leveraging the following tools:

Tools

  • WikiTool: Fetches summaries of topics from Wikipedia, handling disambiguation and page errors gracefully.
  • WebSearchTool: Performs web searches using DuckDuckGo and retrieves the first result's snippet.
  • ExcelAnalysisTool: Loads an Excel file and sums sales from items labeled as "food", excluding drinks. Returns the total sales in USD with 2 decimal places.

Models

  • The agent uses the Hugging Face Inference API via HfApiModel to interact with models such as DeepSeek-R1 or DeepSeek-Coder.

Example Workflow

  1. The agent receives a request.
  2. Based on the request, it selects the appropriate tool (e.g., WikiTool for Wikipedia lookups).
  3. The tool processes the request and returns the result.

Contributing

Contributions are welcome! Please submit a pull request or open an issue for any enhancements or bug fixes.

Future Enhancements

  • Deployment to Hugging Face Spaces.
  • Adding more tools for advanced functionalities.
  • Improving error handling and logging.