in

How to Build a Weather Bot with OpenAI function calling Capability | @OpenAI



In this video, I will show you how to use the OpenAI API Function Calling capability to build a weather bot using CHAINLIT UI that can answer questions about the current weather in any location. You will learn how to:

– Recent updates from OpenAI.
– Use the function calling capability of OpenAI’s GPT models to execute external functions from within the text generation process.
– Create a more steerable model with proper system instructions.
– Use RapidAPI to access weather data from various sources and integrate it with OpenAI’s API.
– Create a chat completion function to handle natural language queries and call external functions as needed.
– Generate natural responses from weather data using prompt engineering techniques.
– Build a simple UI for your weather bot using Chainlit.
– You will also get access to the project repo and the OpenAI cookbook that contains practical examples and tips for using OpenAI’s API.

This video is suitable for beginners and intermediate users who want to learn more about OpenAI’s new function-calling capability and how to use it for various applications.

Chapters –
00:00:00 – Intro to GPT Function calling updates and more
00:00:12 – 1st update – Function calling capability
00:01:26 – 2nd update – More steerable models
00:02:08 – 3rd update – Cost reductions
00:02:24 – 4th update – Deprection of old gpt-3.5-turbo and gpt-4 models
00:02:45 – 5th update – 16k context version of gpt-3.5-turbo model
00:02:45 – 5th update – 16k context version of gpt-3.5-turbo model
00:05:10 – Project repo created and the main tutorial starts
00:05:56 – Quick intro about function calling from the blog
00:08:42 – OpenAI cookbook reference
00:09:00 – How to get OpenAI and RapidAPI keys?
00:10:30 – Clone the repo locally and quick project setup in VScode
00:12:44 – Initial research in Jupyter-notebook starts
00:13:48 – Quick review of the old ways to connect to OpenAI GPT models
00:17:00 – Creation of weather bot example.
00:17:33 – CURL example of function calling API explained.
00:20:25 – Create chat_completion_function with function calling ability.
00:24:30 – Create system instructions for the weather bot.
00:25:51 – Create “functions” to be called by GPT.
00:26:33 – Create a function to get current weather info.
00:29:14 – 1st trial to verify system instruction.
00:31:26 – Create a function to execute the function using an assistant message.
00:34:32 – Create a function to generate a natural response from the weather API JSON object.
00:37:03 – Quick analysis of conversation till now.
00:38:24 – Creating basic file structure for the Chainlit app for the weather bot
00:39:02 – Get some base codes from the demo Jupyter notebook for the Chainlit app
00:41:40 – Define the main function of the Chainlit app
00:45:56 – First successful trial of the Chainlit app
00:47:14 – Prompt engineering to extract the relevant info from the weather API response
00:51:22 – FINAL demo of the Chainlit app for the weather bot!

Follow me for more updates:
* Github: https://github.com/c17hawke
* LinkedIn: https://www.linkedin.com/in/c17hawke/
* twitter: https://twitter.com/c17hawke/
* Medium: https://medium.com/@c17hawke

#openai #functioncalling #chainlit

FRVR AI makes game creation available to anyone

FRVR AI makes game creation available to anyone