|
# LLM Hallucination Detector Guidelines |
|
|
|
## Commands |
|
- Setup: `pip install -r requirements.txt` |
|
- Configure: Set environment variables `HF_MISTRAL_API_KEY` and `HF_OPENAI_API_KEY` |
|
- Run: `python app.py` |
|
- Lint: `ruff check app.py` |
|
- Format: `black app.py` |
|
- Type check: `mypy app.py` |
|
|
|
## Code Style |
|
- Follow PEP 8 conventions with 4-space indentation |
|
- Use type hints with Pydantic for data validation |
|
- Write descriptive docstrings using triple quotes |
|
- Name variables/functions in snake_case, classes in PascalCase |
|
- Organize imports: stdlib first, then third-party, then local |
|
- Exception handling: use try/except blocks with specific exceptions |
|
- Constants should be UPPERCASE and defined at class/module level |
|
- Prefer f-strings over other string formatting methods |
|
|
|
## Architecture |
|
- App uses Gradio for UI, SQLite for persistence |
|
- LLM integration with Mistral Large and OpenAI o3-mini |
|
- Paraphrase-based approach for hallucination detection |
|
- Maintain clean separation between UI and backend logic |