Spaces:
Running
Running
A newer version of the Gradio SDK is available:
6.0.2
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/activatepip 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; classesCamelCase; constantsUPPER_SNAKE_CASE. - Tools: subclass
smolagents.tools.Tool, definename,description,inputs,output_type, and implementforward(self, ...).- Example file path:
tools/my_tool.py; import and register inapp.py.
- Example file path:
- Prefer type hints and concise docstrings. Keep external calls isolated for easy mocking.
Testing Guidelines
- Current repo includes
test.pyfor a basic check. Preferpytestfor new tests. - Place tests in
tests/astest_*.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.txtand 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.