Spaces:
Sleeping
Sleeping
| { | |
| "test_examples": { | |
| "crop_advice": { | |
| "description": "Get crop recommendations based on location", | |
| "method": "POST", | |
| "endpoint": "/chat/crop", | |
| "examples": [ | |
| { | |
| "name": "English - First request (no session_id)", | |
| "body": { | |
| "query": "What crops should I grow in my area?", | |
| "lat": 28.6139, | |
| "lon": 77.2090, | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "en" | |
| } | |
| }, | |
| { | |
| "name": "Hindi - First request", | |
| "body": { | |
| "query": "मेरे क्षेत्र में कौन सी फसलें उगानी चाहिए?", | |
| "lat": 17.3850, | |
| "lon": 78.4867, | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "hi" | |
| } | |
| }, | |
| { | |
| "name": "Telugu - With existing session", | |
| "body": { | |
| "query": "నా ప్రాంతంలో ఏ పంటలు పండించాలి?", | |
| "lat": 17.3850, | |
| "lon": 78.4867, | |
| "uid": "user123", | |
| "session_id": "session_20241201_123456", | |
| "language": "te" | |
| } | |
| }, | |
| { | |
| "name": "Punjabi - Auto-detect language", | |
| "body": { | |
| "query": "ਮੇਰੇ ਖੇਤਰ ਵਿੱਚ ਕਿਹੜੀਆਂ ਫਸਲਾਂ ਉਗਾਉਣੀਆਂ ਚਾਹੀਦੀਆਂ ਹਨ?", | |
| "lat": 31.6340, | |
| "lon": 74.8723, | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "" | |
| } | |
| } | |
| ] | |
| }, | |
| "fertilizer_advice": { | |
| "description": "Get fertilizer recommendations for crops", | |
| "method": "POST", | |
| "endpoint": "/chat/fertilizer", | |
| "examples": [ | |
| { | |
| "name": "English - Basic fertilizer advice", | |
| "body": { | |
| "crop": "Wheat", | |
| "stage": "Vegetative", | |
| "soil_test": "Nitrogen: Low, Phosphorus: Medium", | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "en" | |
| } | |
| }, | |
| { | |
| "name": "Hindi - With stage information", | |
| "body": { | |
| "crop": "गेहूं", | |
| "stage": "वानस्पतिक अवस्था", | |
| "soil_test": "", | |
| "uid": "user123", | |
| "session_id": "session_20241201_123456", | |
| "language": "hi" | |
| } | |
| }, | |
| { | |
| "name": "Tamil - Simple crop only", | |
| "body": { | |
| "crop": "நெல்", | |
| "stage": "", | |
| "soil_test": "", | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "ta" | |
| } | |
| } | |
| ] | |
| }, | |
| "soil_health": { | |
| "description": "Get soil health advice and improvement tips", | |
| "method": "POST", | |
| "endpoint": "/chat/soil", | |
| "examples": [ | |
| { | |
| "name": "English - Soil health diagnosis", | |
| "body": { | |
| "soil_info": "pH level is 6.5, organic matter is low, clay soil type", | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "en" | |
| } | |
| }, | |
| { | |
| "name": "Hindi - Soil information", | |
| "body": { | |
| "soil_info": "मिट्टी का pH 6.5 है, कार्बनिक पदार्थ कम है, मिट्टी चिकनी है", | |
| "uid": "user123", | |
| "session_id": "session_20241201_123456", | |
| "language": "hi" | |
| } | |
| }, | |
| { | |
| "name": "Bengali - Auto-detect language", | |
| "body": { | |
| "soil_info": "মাটির pH 6.5, জৈব পদার্থ কম, মাটি কাদাময়", | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "" | |
| } | |
| } | |
| ] | |
| }, | |
| "weather_advice": { | |
| "description": "Get weather forecasts and farming advice", | |
| "method": "POST", | |
| "endpoint": "/chat/weather", | |
| "examples": [ | |
| { | |
| "name": "English - 3 day forecast", | |
| "body": { | |
| "lat": 28.6139, | |
| "lon": 77.2090, | |
| "days": 3, | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "en" | |
| } | |
| }, | |
| { | |
| "name": "Hindi - 5 day forecast", | |
| "body": { | |
| "lat": 17.3850, | |
| "lon": 78.4867, | |
| "days": 5, | |
| "uid": "user123", | |
| "session_id": "session_20241201_123456", | |
| "language": "hi" | |
| } | |
| }, | |
| { | |
| "name": "Marathi - Default days", | |
| "body": { | |
| "lat": 18.5204, | |
| "lon": 73.8567, | |
| "days": 3, | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "mr" | |
| } | |
| } | |
| ] | |
| }, | |
| "pest_detection": { | |
| "description": "Get pest detection page information", | |
| "method": "GET", | |
| "endpoint": "/chat/pest", | |
| "examples": [ | |
| { | |
| "name": "With farmer ID", | |
| "url": "/chat/pest?farmer_id=farmer_001&uid=user123&language=hi" | |
| }, | |
| { | |
| "name": "Without farmer ID", | |
| "url": "/chat/pest?uid=user123&language=en" | |
| }, | |
| { | |
| "name": "With session ID", | |
| "url": "/chat/pest?farmer_id=farmer_001&uid=user123&session_id=session_20241201_123456&language=te" | |
| } | |
| ] | |
| }, | |
| "phishing_check": { | |
| "description": "Check if a URL is safe or phishing", | |
| "method": "POST", | |
| "endpoint": "/chat/phishing", | |
| "examples": [ | |
| { | |
| "name": "English - Check safe URL", | |
| "body": { | |
| "url": "https://www.google.com", | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "en" | |
| } | |
| }, | |
| { | |
| "name": "Hindi - Check suspicious URL", | |
| "body": { | |
| "url": "http://suspicious-site.com", | |
| "uid": "user123", | |
| "session_id": "session_20241201_123456", | |
| "language": "hi" | |
| } | |
| }, | |
| { | |
| "name": "Gujarati - Auto-detect language", | |
| "body": { | |
| "url": "https://www.example.com", | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "" | |
| } | |
| } | |
| ] | |
| }, | |
| "sentiment_analysis": { | |
| "description": "Analyze sentiment of text", | |
| "method": "POST", | |
| "endpoint": "/chat/sentiment", | |
| "examples": [ | |
| { | |
| "name": "English - Positive sentiment", | |
| "body": { | |
| "query": "I am very happy with the crop yield this year!", | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "en" | |
| } | |
| }, | |
| { | |
| "name": "Hindi - Negative sentiment", | |
| "body": { | |
| "query": "इस साल फसल की पैदावार बहुत खराब है", | |
| "uid": "user123", | |
| "session_id": "session_20241201_123456", | |
| "language": "hi" | |
| } | |
| }, | |
| { | |
| "name": "Telugu - Mixed sentiment", | |
| "body": { | |
| "query": "ఈ సంవత్సరం పంట దిగుబడి బాగుంది కానీ కీటకాల సమస్య ఉంది", | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "te" | |
| } | |
| } | |
| ] | |
| }, | |
| "government_schemes": { | |
| "description": "Get information about government schemes", | |
| "method": "POST", | |
| "endpoint": "/chat/schemes", | |
| "examples": [ | |
| { | |
| "name": "English - Farming subsidies query", | |
| "body": { | |
| "text": "I need information about farming subsidies and government schemes", | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "en" | |
| } | |
| }, | |
| { | |
| "name": "Hindi - Loan schemes", | |
| "body": { | |
| "text": "कृषि ऋण और सब्सिडी योजनाओं के बारे में जानकारी चाहिए", | |
| "uid": "user123", | |
| "session_id": "session_20241201_123456", | |
| "language": "hi" | |
| } | |
| }, | |
| { | |
| "name": "Punjabi - Auto-detect language", | |
| "body": { | |
| "text": "ਮੈਨੂੰ ਖੇਤੀਬਾੜੀ ਸਬਸਿਡੀ ਅਤੇ ਸਰਕਾਰੀ ਯੋਜਨਾਵਾਂ ਬਾਰੇ ਜਾਣਕਾਰੀ ਚਾਹੀਦੀ ਹੈ", | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "" | |
| } | |
| } | |
| ] | |
| }, | |
| "conversation_history": { | |
| "description": "Get conversation history for a user session", | |
| "method": "GET", | |
| "endpoint": "/chat/history", | |
| "examples": [ | |
| { | |
| "name": "Get current session history", | |
| "url": "/chat/history?uid=user123" | |
| }, | |
| { | |
| "name": "Get specific session history", | |
| "url": "/chat/history?uid=user123&session_id=session_20241201_123456" | |
| } | |
| ] | |
| }, | |
| "start_new_chat": { | |
| "description": "Explicitly start a new chat session", | |
| "method": "POST", | |
| "endpoint": "/chat/new", | |
| "examples": [ | |
| { | |
| "name": "Start new chat", | |
| "url": "/chat/new?uid=user123" | |
| } | |
| ] | |
| } | |
| }, | |
| "curl_examples": { | |
| "crop_advice_english": "curl -X POST \"http://localhost:8000/chat/crop\" -H \"Content-Type: application/json\" -d '{\"query\": \"What crops should I grow?\", \"lat\": 28.6139, \"lon\": 77.2090, \"uid\": \"user123\", \"session_id\": \"\", \"language\": \"en\"}'", | |
| "crop_advice_hindi": "curl -X POST \"http://localhost:8000/chat/crop\" -H \"Content-Type: application/json\" -d '{\"query\": \"मेरे क्षेत्र में कौन सी फसलें उगानी चाहिए?\", \"lat\": 17.3850, \"lon\": 78.4867, \"uid\": \"user123\", \"session_id\": \"\", \"language\": \"hi\"}'", | |
| "fertilizer_advice": "curl -X POST \"http://localhost:8000/chat/fertilizer\" -H \"Content-Type: application/json\" -d '{\"crop\": \"Wheat\", \"stage\": \"Vegetative\", \"soil_test\": \"Nitrogen: Low\", \"uid\": \"user123\", \"session_id\": \"\", \"language\": \"en\"}'", | |
| "soil_health": "curl -X POST \"http://localhost:8000/chat/soil\" -H \"Content-Type: application/json\" -d '{\"soil_info\": \"pH level is 6.5, organic matter is low\", \"uid\": \"user123\", \"session_id\": \"\", \"language\": \"en\"}'", | |
| "weather_advice": "curl -X POST \"http://localhost:8000/chat/weather\" -H \"Content-Type: application/json\" -d '{\"lat\": 28.6139, \"lon\": 77.2090, \"days\": 3, \"uid\": \"user123\", \"session_id\": \"\", \"language\": \"hi\"}'", | |
| "pest_detection": "curl -X GET \"http://localhost:8000/chat/pest?farmer_id=farmer_001&uid=user123&language=hi\"", | |
| "phishing_check": "curl -X POST \"http://localhost:8000/chat/phishing\" -H \"Content-Type: application/json\" -d '{\"url\": \"https://www.google.com\", \"uid\": \"user123\", \"session_id\": \"\", \"language\": \"en\"}'", | |
| "sentiment_analysis": "curl -X POST \"http://localhost:8000/chat/sentiment\" -H \"Content-Type: application/json\" -d '{\"query\": \"I am very happy with the crop yield!\", \"uid\": \"user123\", \"session_id\": \"\", \"language\": \"en\"}'", | |
| "government_schemes": "curl -X POST \"http://localhost:8000/chat/schemes\" -H \"Content-Type: application/json\" -d '{\"text\": \"I need information about farming subsidies\", \"uid\": \"user123\", \"session_id\": \"\", \"language\": \"en\"}'", | |
| "conversation_history": "curl -X GET \"http://localhost:8000/chat/history?uid=user123\"", | |
| "start_new_chat": "curl -X POST \"http://localhost:8000/chat/new?uid=user123\"" | |
| }, | |
| "python_requests_examples": { | |
| "crop_advice": "import requests\n\nurl = \"http://localhost:8000/chat/crop\"\npayload = {\n \"query\": \"What crops should I grow?\",\n \"lat\": 28.6139,\n \"lon\": 77.2090,\n \"uid\": \"user123\",\n \"session_id\": \"\",\n \"language\": \"en\"\n}\nresponse = requests.post(url, json=payload)\nprint(response.json())", | |
| "fertilizer_advice": "import requests\n\nurl = \"http://localhost:8000/chat/fertilizer\"\npayload = {\n \"crop\": \"Wheat\",\n \"stage\": \"Vegetative\",\n \"soil_test\": \"Nitrogen: Low\",\n \"uid\": \"user123\",\n \"session_id\": \"\",\n \"language\": \"en\"\n}\nresponse = requests.post(url, json=payload)\nprint(response.json())", | |
| "weather_advice": "import requests\n\nurl = \"http://localhost:8000/chat/weather\"\npayload = {\n \"lat\": 28.6139,\n \"lon\": 77.2090,\n \"days\": 3,\n \"uid\": \"user123\",\n \"session_id\": \"\",\n \"language\": \"hi\"\n}\nresponse = requests.post(url, json=payload)\nprint(response.json())" | |
| }, | |
| "test_flow_example": { | |
| "description": "Complete conversation flow example", | |
| "steps": [ | |
| { | |
| "step": 1, | |
| "action": "Start new chat", | |
| "endpoint": "POST /chat/new?uid=user123", | |
| "expected_response": { | |
| "message": "New chat session started", | |
| "session_id": "session_XXXXXX", | |
| "uid": "user123" | |
| } | |
| }, | |
| { | |
| "step": 2, | |
| "action": "First crop question", | |
| "endpoint": "POST /chat/crop", | |
| "body": { | |
| "query": "What crops should I grow?", | |
| "lat": 28.6139, | |
| "lon": 77.2090, | |
| "uid": "user123", | |
| "session_id": "", | |
| "language": "en" | |
| }, | |
| "note": "session_id will be auto-created and returned" | |
| }, | |
| { | |
| "step": 3, | |
| "action": "Follow-up question (reuse session_id from step 2)", | |
| "endpoint": "POST /chat/crop", | |
| "body": { | |
| "query": "Tell me more about wheat", | |
| "lat": 28.6139, | |
| "lon": 77.2090, | |
| "uid": "user123", | |
| "session_id": "session_XXXXXX", | |
| "language": "en" | |
| }, | |
| "note": "Chatbot will remember previous conversation" | |
| }, | |
| { | |
| "step": 4, | |
| "action": "Check conversation history", | |
| "endpoint": "GET /chat/history?uid=user123&session_id=session_XXXXXX", | |
| "expected_response": { | |
| "uid": "user123", | |
| "session_id": "session_XXXXXX", | |
| "history": [ | |
| { | |
| "user": "What crops should I grow?", | |
| "assistant": "...", | |
| "timestamp": "..." | |
| }, | |
| { | |
| "user": "Tell me more about wheat", | |
| "assistant": "...", | |
| "timestamp": "..." | |
| } | |
| ] | |
| } | |
| } | |
| ] | |
| } | |
| } | |