Final App
We will use OpenAI's API to give our chatbot some intelligence.
Configure the OpenAI API Key
Ensure you have an active OpenAI subscription. Save your API key as an environment variable named OPENAI_API_KEY
:
Install the openai
pypi package:
Using the API
We need to modify our event handler to send a request to the API.
Finally, we have our chatbot!
Final Code
We wrote all our code in three files, which you can find below.
Next Steps
Congratulations! You have built your first chatbot. From here, you can read through the rest of the documentations to learn about Reflex in more detail. The best way to learn is to build something, so try to build your own app using this as a starting point!
One More Thing
With our hosting service, you can deploy this app with a single command within minutes. Check out our Hosting Quick Start.