A Flask-based chatbot server that provides farming-related question answering using Azure OpenAI GPT-4o, supporting multiple languages (Hindi and English)
Single tool 'ask_question' has a reasonable description (127 chars, within 10-1024 range) and basic input schema with two parameters. However, critical gaps undermine quality: (1) Tool name 'ask_question' is generic and does not follow verb_noun pattern (should be 'answer_farming_question' or 'get_farming_advice'); (2) Input schema lacks type definitions, 'language' and 'question' parameters have descriptions but no explicit 'type' field visible in the schema structure provided; (3) No output schema documented, LLMs cannot predict response structure; (4) No error handling guidance, exception returns raw error strings with no recovery hints; (5) No parameter constraints (language enum, question length limits); (6) Credentials (API_KEY, AZURE_OPENAI_ENDPOINT) hardcoded in environment, not validated as secret-injected; (7) No idempotency or retry guidance; (8) Tool is read-only but lacks explicit readOnlyHint annotation.
Chatbot endpoint that answers farming-related questions in the specified language (Hindi or English) using Azure OpenAI GPT-4o
Tool name 'ask_question' is generic and does not follow verb_noun pattern. Should be 'answer_farming_question' or 'get_farming_advice' to clearly signal intent and distinguish from other question-answering tools.
Input schema lacks explicit type definitions for parameters. While descriptions exist, JSON Schema 'type' field is not visible for 'language' and 'question' parameters.
No output schema documented. LLMs cannot predict response structure (e.g., is it {response: string} or {response: string, confidence: float}?). This forces LLMs to guess and wastes tokens parsing unstructured output.
Error handling returns raw exception strings ('error': str(e)) with no recovery guidance. Should categorize errors (retryable vs user-fixable) and suggest next steps, e.g., 'Invalid language: must be Hindi or English.'
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | F | 32 | 2026-07-28+ | v2 |
Language parameter lacks enum constraint. Free-form string invites hallucinated values. Should declare language as enum: ['Hindi', 'English'] to prevent invalid inputs.