Spaces:
Running
Running
File size: 2,273 Bytes
d0c71ea | 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 | # Repository Guidelines
## Project Structure & Modules
- Root app: `app.py` (agent wiring, Langfuse tracing, Gradio launch).
- UI: `Gradio_UI.py` (streaming chat, message formatting).
- Tools: `tools/` (`final_answer.py`, `web_search.py`, `visit_webpage.py`). Add new tools here.
- Prompts & config: `prompts.yaml`, `agent.json`.
- Dependencies: `requirements.txt`; example script: `test.py`.
## Build, Test, and Run
- Create env and install deps:
- `python -m venv .venv && source .venv/bin/activate`
- `pip install -r requirements.txt`
- Required env vars:
- `OPENAI_API_KEY` (required), optional: `LLM_MODEL_ID`, `LLM_API_BASE`,
`LLM_MAX_TOKENS`, `LLM_TEMPERATURE`, `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY`.
- Run locally (starts Gradio UI):
- `python app.py`
- Quick smoke test:
- `python test.py`
## Coding Style & Conventions
- Python 3.11, PEP 8, 4‑space indentation, limit lines to ~100 chars.
- Naming: modules and functions `snake_case`; classes `CamelCase`; constants `UPPER_SNAKE_CASE`.
- Tools: subclass `smolagents.tools.Tool`, define `name`, `description`, `inputs`, `output_type`, and implement `forward(self, ...)`.
- Example file path: `tools/my_tool.py`; import and register in `app.py`.
- Prefer type hints and concise docstrings. Keep external calls isolated for easy mocking.
## Testing Guidelines
- Current repo includes `test.py` for a basic check. Prefer `pytest` for new tests.
- Place tests in `tests/` as `test_*.py`; name fixtures clearly.
- Mock network and external APIs (OpenAI, DuckDuckGo, Langfuse, Jaqpot).
- Aim for coverage on tool `forward()` logic and critical agent wiring.
## Commit & Pull Requests
- Commits: imperative mood and scoped, e.g., `feat(tool): add qsar parser`.
- PRs must include:
- Clear description, rationale, and linked issues.
- Steps to run/test, environment variables touched.
- Screenshots/GIFs for UI changes (Gradio).
- Updates to `requirements.txt` and docs when deps or behavior change.
## Security & Configuration
- Never commit secrets; use environment variables. Validate required keys at startup.
- Prefer `qsartoolbox`-based predictions over web search for accuracy (see prompts).
- Networked tools must handle timeouts and errors; return user‑friendly messages.
|