File size: 2,404 Bytes
054839b 6073dc2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
---
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. |