обратно към уроците

Как да използваме набори от умения на ChatBotKit за създаване на бот за прогнозиране на времето

Научете как да създадете бот за прогноза за времето, като използвате набора от умения на ChatBotKit. Следвайте ръководството стъпка по стъпка, за да създадете набор от умения и способност за получаване на информация за времето чрез API заявки.

To create a bot that can accurately tell the weather forecast, we need to follow the steps below:

  1. Create a Skillset in ChatBotKit.
  2. Create an ability named "get_weather" with the description "Get the weather of the provided location."
  3. Set the ability instruction to:
To get the weather you need to perform the following request: ```fetch GET https://wttr.in/{location}?format=4 HTTP/1.1 User-Agent: curl/7.61.1 ``` The {location} parameter could be any city. For example: ```fetch GET https://wttr.in/London?format=4 HTTP/1.1 User-Agent: curl/7.61.1 ``` Multiple locations can be requested like this: ```fetch GET https://wttr.in/{London,Paris}?format=4 HTTP/1.1 User-Agent: curl/7.61.1 ``` The response is a text document with weather information.

Note that we are simply describing how we want to perform requests to obtain the necessary information. Additionally, we use a special action called "fetch" to instruct your bot to retrieve information from another webpage.

Once the skillset and the ability are set, we can start using it in our conversational AI agents. Simply select the skillset in your Bot or Integration.

Now we can ask questions such as "What is the weather in London?" and the bot will be able to provide us with accurate weather information.