A demonstration of the Poe protocol using FastAPI
Project description
fastapi_poe
An implementation of the Poe protocol using FastAPI.
Installation
Install the package from PyPI:
pip install fastapi-poe
Write your own bot
This package can also be used as a base to write your own bot. You can inherit from
PoeBot to make a bot:
import fastapi_poe as fp
class EchoBot(fp.PoeBot):
async def get_response(self, request: fp.QueryRequest):
last_message = request.query[-1].content
yield fp.PartialResponse(text=last_message)
if __name__ == "__main__":
fp.run(EchoBot(), allow_without_key=True)
Now, run your bot using python <filename.py>.
- In a different terminal, run ngrok to make it publicly accessible.
- Use the publicly accessible url to integrate your bot with Poe
Enable authentication
Poe servers send requests containing Authorization HTTP header in the format "Bearer <access_key>"; the access key is configured in the bot settings page.
To validate that the request is from the Poe servers, you can either set the environment variable POE_ACCESS_KEY or pass the parameter access_key in the run function like:
if __name__ == "__main__":
fp.run(EchoBot(), access_key=<key>)
Samples
Check out our starter code repository for some examples you can use to get started with bot development.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_poe-0.0.83.tar.gz.
File metadata
- Download URL: fastapi_poe-0.0.83.tar.gz
- Upload date:
- Size: 52.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39c3c1a3fab444d5a0357b1adc80512485e939ea9ff9f907c179fa484315a2c5
|
|
| MD5 |
1efeac7c5189a807f4dcccf31dc03afb
|
|
| BLAKE2b-256 |
54d36b8bfb88613c333a5b8f9c84645dea91dda09d3ad7780490df12ed6e1cfc
|
Provenance
The following attestation bundles were made for fastapi_poe-0.0.83.tar.gz:
Publisher:
publish.yml on poe-platform/fastapi_poe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastapi_poe-0.0.83.tar.gz -
Subject digest:
39c3c1a3fab444d5a0357b1adc80512485e939ea9ff9f907c179fa484315a2c5 - Sigstore transparency entry: 844135087
- Sigstore integration time:
-
Permalink:
poe-platform/fastapi_poe@41ffd02e16f27ca22cb784fbe12eb4ec50a76ce2 -
Branch / Tag:
refs/tags/0.0.83 - Owner: https://github.com/poe-platform
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@41ffd02e16f27ca22cb784fbe12eb4ec50a76ce2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fastapi_poe-0.0.83-py3-none-any.whl.
File metadata
- Download URL: fastapi_poe-0.0.83-py3-none-any.whl
- Upload date:
- Size: 34.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff0dcb6bed43671ff387c60c01a3a7cc9d21ef6e8d10762e9cdce1e04e79a4d2
|
|
| MD5 |
4b950f736aa6beeb574c6eb5a6be284f
|
|
| BLAKE2b-256 |
7860e2c3a6da3bc15a3fd3e8fc3a7743156531ecc0c4ccb1b0824c6bd6fb258f
|
Provenance
The following attestation bundles were made for fastapi_poe-0.0.83-py3-none-any.whl:
Publisher:
publish.yml on poe-platform/fastapi_poe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastapi_poe-0.0.83-py3-none-any.whl -
Subject digest:
ff0dcb6bed43671ff387c60c01a3a7cc9d21ef6e8d10762e9cdce1e04e79a4d2 - Sigstore transparency entry: 844135103
- Sigstore integration time:
-
Permalink:
poe-platform/fastapi_poe@41ffd02e16f27ca22cb784fbe12eb4ec50a76ce2 -
Branch / Tag:
refs/tags/0.0.83 - Owner: https://github.com/poe-platform
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@41ffd02e16f27ca22cb784fbe12eb4ec50a76ce2 -
Trigger Event:
push
-
Statement type: