A demonstration of the Poe protocol using FastAPI
Project description
fastapi_poe
An implementation of the Poe protocol using FastAPI.
To run it:
- Create a virtual environment (Python 3.7 or higher)
pip install .
python -m fastapi_poe
- In a different terminal, run ngrok to make it publicly accessible
Write your own bot
This package can also be used as a base to write your own bot. You can inherit from
fastapi_poe.PoeHandler
to make a bot:
from fastapi_poe import PoeHandler, run
class EchoHandler(PoeHandler):
async def get_response(self, query):
last_message = query.query[-1].content
yield self.text_event(last_message)
if __name__ == "__main__":
run(EchoHandler())
For a more advanced example that exercises more of the Poe protocol, see Catbot.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastapi_poe-0.0.3.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for fastapi_poe-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fca6cf4bc3fa92087e9fb856825b119db4ed0a0871e2755d10304bb6b481d05 |
|
MD5 | df16a1830246d1278132cd171cc2be61 |
|
BLAKE2b-256 | 5aa1544c70df93ddf923dc8af40f3f5b2fd42078a5ef268f165e1c9170b2d57e |