The Poe API allows your bot to takes files as input. This means that your bot can do more interesting things than what would be possible using chat input alone. As part of this tutorial, we will create a very simple chatbot that takes in a pdf input and computes the number of pages in the pdf for the user. To enable file upload, you have to override get_settings and set the parameter called allow_attachments to True.
Poe uploads any attachments provided by the user to its storage and passes the url of the file along with other metadata such as name and type to the bot server. We will utilize a python library called pypdf2 (which you can install using pip install pypdf2) to parse the pdf and count the number of pages. We will use the requests library (which you can install using pip install requests) to download the file.
To learn how to setup Modal, please follow Steps 1 and 2 in our Quick start. If you already have Modal set up, simply run modal deploy main.py. Modal will then deploy your bot server to the cloud and output the server url. Use that url when creating a server bot on Poe. Once your bot is up, update your bot's settings (one time only after you override get_settings) by following this guide. That's it, your bot is now ready.