File size: 5,469 Bytes
bf5275b |
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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
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>
|