{"id":29414019,"url":"https://github.com/kuro-2/travel-agent-","last_synced_at":"2026-05-06T08:31:25.465Z","repository":{"id":302264270,"uuid":"1011820395","full_name":"kuro-2/travel-agent-","owner":"kuro-2","description":" A conversational AI-powered travel assistant for India, built with Flask and Hugging Face LLMs. It provides real-time and fallback information about weather, trains, road routes, tourist attractions, and trip planning for Indian cities.","archived":false,"fork":false,"pushed_at":"2025-07-01T15:00:02.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-11T13:01:58.880Z","etag":null,"topics":["agent","api","apiintegration","chatbot","flask","html","huggingface","json","llm","mistral-7b","promptflow","python","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kuro-2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-01T11:40:04.000Z","updated_at":"2025-07-01T15:00:05.000Z","dependencies_parsed_at":"2025-07-05T11:45:47.846Z","dependency_job_id":null,"html_url":"https://github.com/kuro-2/travel-agent-","commit_stats":null,"previous_names":["kuro-2/travel-agent-"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kuro-2/travel-agent-","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuro-2%2Ftravel-agent-","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuro-2%2Ftravel-agent-/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuro-2%2Ftravel-agent-/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuro-2%2Ftravel-agent-/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kuro-2","download_url":"https://codeload.github.com/kuro-2/travel-agent-/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuro-2%2Ftravel-agent-/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32684593,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T02:33:58.958Z","status":"ssl_error","status_checked_at":"2026-05-06T02:33:39.611Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","api","apiintegration","chatbot","flask","html","huggingface","json","llm","mistral-7b","promptflow","python","rest-api"],"created_at":"2025-07-11T12:01:22.459Z","updated_at":"2026-05-06T08:31:25.448Z","avatar_url":"https://github.com/kuro-2.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# travel-agent-\n\nA conversational AI-powered travel assistant for India, built with Flask and Hugging Face LLMs. It provides real-time and fallback information about weather, trains, road routes, tourist attractions, and trip planning for Indian cities.\n\n---\n\n## Features\n\n- **Conversational Chatbot**: Interact via a web-based chat UI.\n- **Weather Info**: Get current weather for Indian cities.\n- **Train Schedules**: Query by train number or between cities.\n- **Road Routes**: Get driving time and distance between cities.\n- **Tourist Information**: Learn about attractions and best times to visit.\n- **Trip Planning**: Get a comprehensive travel plan (multi-modal).\n- **Fallback Data**: Uses local JSON data if APIs are unavailable.\n- **LLM-powered Intent Parsing**: Uses Hugging Face Llama-3 for robust intent extraction and natural responses, with rule-based fallback.\n\n---\n\n## Project Structure\n\n```\nTravel Agent/\n│\n├── PROMPTFLOW/\n│   ├── chat_server.py         # Flask server and API endpoints\n│   ├── promptflow_router.py   # Intent parsing, routing, and response generation\n│   ├── rail_api.py            # Blueprint for rail API\n│   ├── road_api.py            # Blueprint for road API\n│   ├── weather_api.py         # Blueprint for weather API\n│   ├── updated-data-weather.json\n│   ├── updated-json-data-for-train.json\n│   ├── updated-routes-data.json\n│   ├── tourism-data.json\n│  \n├── templates/\n│   └── index.html             # Chat UI\n├── .env                       # Environment variables (not committed)\n├── .gitignore\n└── README.md\n```\n\n---\n\n## How It Works\n\n1. **User Interaction**: User sends a message via the chat UI.\n2. **Intent Classification**: The message is parsed using an LLM (Llama-3 via Hugging Face) or a rule-based fallback to determine the user's intent (weather, train, road, etc.).\n3. **Parameter Extraction**: Relevant parameters (city, train number, etc.) are extracted.\n4. **Data Retrieval**: The system queries APIs (weather, train, road) or uses local JSON data as fallback.\n5. **Response Generation**: The LLM generates a conversational answer, or a template-based fallback is used.\n6. **Reply**: The answer is sent back to the user.\n\n---\n\n## Setup Instructions\n\n### 1. Clone the Repository\n\n```sh\ngit clone https://github.com/kuro-2/travel-agent-.git\ncd \"Travel Agent\"\n```\n\n### 2. Install Dependencies\n\nIt's recommended to use a virtual environment:\n\n```sh\npython -m venv venv\nvenv\\Scripts\\activate\npip install -r requirements.txt\n```\n\n**Main dependencies:**\n- Flask\n- requests\n- python-dotenv\n- huggingface_hub\n\n### 3. Prepare Environment Variables\n\nCreate a `.env` file in the root directory:\n\n```\nHF_TOKEN=your_huggingface_api_token\n```\n\n\u003e **Note:** The `.env` file is ignored by git.\n\n### 4. Prepare Data Files\n\nEnsure the following JSON files are present in the `PROMPTFLOW` directory:\n- `updated-data-weather.json`\n- `updated-json-data-for-train.json`\n- `updated-routes-data.json`\n- `tourism-data.json`\n\nYou can use your own data or sample data for testing.\n\n### 5. Run the Server\n\n```sh\ncd PROMPTFLOW\npython chat_server.py\n```\n\nThe server will start on [http://localhost:5000](http://localhost:5000).\n\n### 6. Access the Chat UI\n\nOpen your browser and go to [http://localhost:5000](http://localhost:5000) to interact with the assistant.\n\n---\n\n## How to Build a Similar Project\n\n1. **Define Your Use Cases**: Decide what information your assistant should provide.\n2. **Collect Data/APIs**: Gather APIs or datasets for your domains (weather, transport, etc.).\n3. **Design Intent Schema**: List possible user intents and required parameters.\n4. **Build Intent Classifier**: Use an LLM (like Llama-3) or rule-based methods to classify user queries and extract parameters.\n5. **Implement Data Retrieval**: Write functions to fetch data from APIs or local files.\n6. **Generate Responses**: Use LLMs for natural language generation, or fallback to templates.\n7. **Integrate with a Web Framework**: Use Flask or FastAPI to build a backend and serve a chat UI.\n8. **Handle Fallbacks**: Always provide fallback data or error messages for robustness.\n9. **Test and Iterate**: Test with real user queries and improve intent detection and responses.\n\n---\n\n## Workflow Diagram\n\n```mermaid\ngraph TD\n    A[User Message] --\u003e B{Intent Classification}\n    B --\u003e|LLM| C[Extract Parameters]\n    B --\u003e|Rule-based| C\n    C --\u003e D{Intent Type}\n    D --\u003e|Weather| E[Get Weather Data]\n    D --\u003e|Train| F[Get Train Data]\n    D --\u003e|Road| G[Get Road Data]\n    D --\u003e|Tourist Info| H[Get Place Info]\n    D --\u003e|Trip Planning| I[Combine All Data]\n    E --\u003e J[Generate Response]\n    F --\u003e J\n    G --\u003e J\n    H --\u003e J\n    I --\u003e J\n    J --\u003e K[Send Reply to User]\n```\n\n---\n\n## Notes\n\n- **LLM Usage**: The project uses Hugging Face's hosted Llama-3 model for intent classification and response generation. If the token is missing or the API fails, it falls back to rule-based logic and template responses.\n- **Extensibility**: You can add more APIs, intents, or data sources by extending the router and intent schema.\n- **Security**: Never commit your `.env` file or API keys to version control.\n- **Customization**: Update the `tourism-data.json` and other data files to include more places or richer information.\n\n---\n\n## License\n\nThis project is for educational and demonstration purposes.\n\n---\n\n## Author\n\nBuilt by an AI travel enthusiast using Python, Flask, and Hugging Face LLMs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuro-2%2Ftravel-agent-","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuro-2%2Ftravel-agent-","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuro-2%2Ftravel-agent-/lists"}