Download scripts/run_chatbot_qa.py from SolarWine/api: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/SolarWine/api/resolve/main/scripts/run_chatbot_qa.py
- Command line
-
hf download hf://spaces/SolarWine/api/scripts/run_chatbot_qa.py
-
curl -L -o run_chatbot_qa.py https://huggingface.co/spaces/SolarWine/api/resolve/main/scripts/run_chatbot_qa.py
1.29 kB
| """ | |
| Quick QA harness for VineyardChatbot. | |
| Runs a fixed set of questions and prints the responses so we can sanity-check | |
| behaviour before deploy. | |
| """ | |
| from __future__ import annotations | |
| import sys | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parent.parent | |
| if str(ROOT) not in sys.path: | |
| sys.path.insert(0, str(ROOT)) | |
| from src.vineyard_chatbot import VineyardChatbot | |
| def main() -> None: | |
| bot = VineyardChatbot(verbose=True) | |
| questions = [ | |
| "What is the state of the vines today?", | |
| "What was the state of the vines one month ago?", | |
| "What will be the state of the vines one month from now?", | |
| "What will be the state of the vines two months from now?", | |
| "Given today's conditions, what is your shading recommendation for today?", | |
| "What is your irrigation recommendation for today?", | |
| "What is your fertiliser recommendation for today?", | |
| ] | |
| for i, q in enumerate(questions, 1): | |
| print("\n" + "=" * 80) | |
| print(f"Q{i}: {q}") | |
| try: | |
| resp = bot.chat(q) | |
| print("A:", resp.message) | |
| except Exception as exc: # noqa: BLE001 | |
| import traceback | |
| print("ERROR:", exc) | |
| traceback.print_exc() | |
| if __name__ == "__main__": | |
| main() | |