|
This file is a merged representation of the entire codebase, combined into a single document by Repomix. |
|
|
|
<file_summary> |
|
This section contains a summary of this file. |
|
|
|
<purpose> |
|
This file contains a packed representation of the entire repository's contents. |
|
It is designed to be easily consumable by AI systems for analysis, code review, |
|
or other automated processes. |
|
</purpose> |
|
|
|
<file_format> |
|
The content is organized as follows: |
|
1. This summary section |
|
2. Repository information |
|
3. Directory structure |
|
4. Repository files (if enabled) |
|
5. Multiple file entries, each consisting of: |
|
- File path as an attribute |
|
- Full contents of the file |
|
</file_format> |
|
|
|
<usage_guidelines> |
|
- This file should be treated as read-only. Any changes should be made to the |
|
original repository files, not this packed version. |
|
- When processing this file, use the file path to distinguish |
|
between different files in the repository. |
|
- Be aware that this file may contain sensitive information. Handle it with |
|
the same level of security as you would the original repository. |
|
</usage_guidelines> |
|
|
|
<notes> |
|
- Some files may have been excluded based on .gitignore rules and Repomix's configuration |
|
- Binary files are not included in this packed representation. Please refer to the Repository Structure section for a complete list of file paths, including binary files |
|
- Files matching patterns in .gitignore are excluded |
|
- Files matching default ignore patterns are excluded |
|
- Files are sorted by Git change count (files with more changes are at the bottom) |
|
</notes> |
|
|
|
</file_summary> |
|
|
|
<directory_structure> |
|
.claude/ |
|
settings.local.json |
|
.container-use/ |
|
AGENT.md |
|
environment.json |
|
.env.example |
|
.gitignore |
|
.python-version |
|
chatbot.py |
|
CLAUDE.md |
|
process1.md |
|
pyproject.toml |
|
README.md |
|
</directory_structure> |
|
|
|
<files> |
|
This section contains the contents of the repository's files. |
|
|
|
<file path=".claude/settings.local.json"> |
|
{ |
|
"permissions": { |
|
"allow": [ |
|
"mcp__container-use__environment_open", |
|
"mcp__container-use__environment_update", |
|
"mcp__container-use__environment_file_write" |
|
], |
|
"deny": [] |
|
} |
|
} |
|
</file> |
|
|
|
<file path=".env.example"> |
|
# HF API Key for smol-agent |
|
HF_API_TOKEN=your_huggingface_api_token_here |
|
|
|
# Chatbot settings |
|
MODEL_NAME=HuggingFaceH4/zephyr-7b-beta |
|
MAX_NEW_TOKENS=500 |
|
TEMPERATURE=0.7 |
|
</file> |
|
|
|
<file path=".gitignore"> |
|
# Environment variables |
|
.env |
|
|
|
# Python |
|
__pycache__/ |
|
*.py[cod] |
|
*$py.class |
|
*.so |
|
.Python |
|
env/ |
|
build/ |
|
develop-eggs/ |
|
dist/ |
|
downloads/ |
|
eggs/ |
|
.eggs/ |
|
lib/ |
|
lib64/ |
|
parts/ |
|
sdist/ |
|
var/ |
|
*.egg-info/ |
|
.installed.cfg |
|
*.egg |
|
|
|
# Virtual environments |
|
venv/ |
|
ENV/ |
|
.venv |
|
|
|
# IDE files |
|
.idea/ |
|
.vscode/ |
|
*.swp |
|
*.swo |
|
</file> |
|
|
|
<file path=".python-version"> |
|
3.12 |
|
</file> |
|
|
|
<file path="process1.md"> |
|
# Create a chat bot |
|
|
|
Create HF smol-agent lets create a simple chatbot that read a string and reply. |
|
Use python-dotenv to load all the variables from the .env |
|
Use uvx to manage python dependencies. |
|
</file> |
|
|
|
<file path=".container-use/AGENT.md"> |
|
This environment contains a chatbot project using HuggingFace's smol-agent. |
|
- Python 3.10 is installed |
|
- Use `uvx` for dependency management |
|
- Environment variables are loaded from .env file using python-dotenv |
|
- Use `uvx run` to run Python scripts with dependencies |
|
</file> |
|
|
|
<file path=".container-use/environment.json"> |
|
{ |
|
"workdir": "/workdir", |
|
"base_image": "python:3.10-slim", |
|
"setup_commands": [ |
|
"apt-get update", |
|
"apt-get install -y git", |
|
"pip install uv", |
|
"alias uvx=\"uv\"" |
|
] |
|
} |
|
</file> |
|
|
|
<file path="CLAUDE.md"> |
|
ALWAYS use ONLY Environments for ANY and ALL file, code, or shell operations—NO EXCEPTIONS—even for simple or generic requests. |
|
|
|
DO NOT install or use the git cli with the environment_run_cmd tool. All environment tools will handle git operations for you. Changing ".git" yourself will compromise the integrity of your environment. |
|
|
|
You MUST inform the user how to view your work using `cu log <env_id>` AND `cu checkout <env_id>`. Failure to do this will make your work inaccessible to others. |
|
</file> |
|
|
|
<file path="pyproject.toml"> |
|
[project] |
|
name = "huggingface-small-agent-test" |
|
version = "0.1.0" |
|
description = "Add your description here" |
|
readme = "README.md" |
|
requires-python = ">=3.12" |
|
dependencies = [ |
|
"smolagents>=1.18.0", |
|
] |
|
</file> |
|
|
|
<file path="README.md"> |
|
# HuggingFace Smol-Agent Chatbot |
|
|
|
A simple chatbot implementation using HuggingFace's smol-agent. |
|
|
|
## Setup |
|
|
|
1. Clone this repository |
|
2. Create a `.env` file based on `.env.example`: |
|
```bash |
|
cp .env.example .env |
|
``` |
|
3. Add your HuggingFace API token to the `.env` file |
|
|
|
## Usage |
|
|
|
### Install dependencies |
|
|
|
```bash |
|
uv pip install . |
|
``` |
|
|
|
### Run the CLI chatbot |
|
|
|
```bash |
|
python chatbot.py |
|
``` |
|
|
|
### Run the API server |
|
|
|
```bash |
|
python api.py |
|
``` |
|
|
|
The API will be available at http://localhost:8000 |
|
|
|
## API Endpoints |
|
|
|
- **POST /chat**: Send a message to the chatbot |
|
- Request: `{"message": "Hello, how are you?"}` |
|
- Response: `{"response": "I'm doing well, thank you for asking!"}` |
|
|
|
- **GET /health**: Check if the API is running |
|
- Response: `{"status": "ok"}` |
|
</file> |
|
|
|
<file path="chatbot.py"> |
|
# /// script |
|
# dependencies = [ |
|
# "smolagents", |
|
# ] |
|
# /// |
|
from smolagents import CodeAgent, HfApiModel |
|
model_id = "meta-llama/Llama-3.3-70B-Instruct" |
|
|
|
|
|
# Managed Agent |
|
agent = CodeAgent( |
|
tools=[], |
|
model=HfApiModel(model_id=model_id), |
|
name="mychatbot", |
|
description="A chatbot for various tasks", |
|
verbosity_level=2, |
|
max_steps=10, |
|
add_base_tools=False, |
|
) |
|
</file> |
|
|
|
</files> |
|
|