Weather Info and Forecast Chatbot Implementation Notes

Introduction to Weather Info and Forecast Board

  • Presenter's name: इलियां.
  • Purpose of the demo: Show a chatbot built using Google Dialogflow to provide weather information and forecasts.

Objectives of the Chatbot

  • Current Weather Information: Provide current weather details for a specific city.
  • Weather Forecast: Provide weather information for the next 8 days from the current day for a specific city.

Creation of the Chatbot

  • Platform Used: Google Dialogflow.
  • Agent Created: Named "Weather Bot".
  • Entities and Intents Defined:    - Entities: Used to interpret user input.      - Example: Entity to capture city names using JioCT.    - Intents: Defining user intents based on inputs.      - Welcome Intent: Trained with expressions like 'hello' and 'hi'. Response: "This is a weather bot. How may I help you?".      - Current Weather Intent: Provides current weather based on user input.        - User expressions trained: "I'm in Dubai", "weather in लाहौर".        - Prompt provided if user does not specify a city: "Please provide your city".      - Forecast Weather Intent: User must provide both date and city to get future weather forecasts.        - API used for fetching the forecast: Open Weather API.        - Note: The free version provides forecasts only for the next 5 days.        - Supported date formats: "20 April", "Friday", etc.      - End Conversation Intent: Responses include gratitude and offers to assist further.      - Goodbye Intent: Responses for closing the conversation.

API Integration Details

  • Open Weather API: Provides weather data.   - Paid version allows forecasts for 8 days; free version limited to 5 days.   - Using parameters: JioCT (for city) and date.   - Functionality to handle various date input styles was included.

Architecture of the Chatbot

  • User Interaction: Users can request weather information.
  • Backend Processing: Requests are processed using a webhook that communicates with the Open Weather API for weather data.
  • Conversations Handling: Dialogflow manages user interactions; if needed, requests data from backend using webhooks.

Demo Testing of Chatbot

  • Example Interaction: User initiates conversation with greetings.   - If a user asks for current weather without a specified city, response prompts to provide city.   - When user specifies city, the backend responds with the current weather (e.g., "The current weather for कराची is overcast clouds").
  • Forecast Request: User can request a weather forecast by providing specific dates (e.g., "20 April").    - Expected output: Forecast for the requested date with limitation of providing data for the next 5 days due to the API constraints.    - Example output highlights the limitation (only 4 days returned).

Backend Implementation

  • Framework Used: Python Flask.
  • Rationale for Framework Choice: Flask is lightweight and suitable for the tasks required by the chatbot.
  • Functions Implemented:   - Current Weather: Uses only city as a parameter. If no date provided, the function retrieves current weather using the Open Weather API.   - Forecast Weather: Accepts both city and start date as parameters; calculates end date based on the 5-day forecast limit.
  • Webhook Functionality: Connects the backend and handles JSON requests and responses.

Conclusion

  • Summary of the demo: Completed successfully.
  • Mentioned that no parts of the process were overlooked. Ensured clarity and careful explanation throughout the demonstration.