Skip to main content

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

fastapi_poe-0.0.83.tar.gz (52.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_poe-0.0.83-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

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

Hashes for fastapi_poe-0.0.83.tar.gz
Algorithm Hash digest
SHA256 39c3c1a3fab444d5a0357b1adc80512485e939ea9ff9f907c179fa484315a2c5
MD5 1efeac7c5189a807f4dcccf31dc03afb
BLAKE2b-256 54d36b8bfb88613c333a5b8f9c84645dea91dda09d3ad7780490df12ed6e1cfc

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastapi_poe-0.0.83.tar.gz:

Publisher: publish.yml on poe-platform/fastapi_poe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for fastapi_poe-0.0.83-py3-none-any.whl
Algorithm Hash digest
SHA256 ff0dcb6bed43671ff387c60c01a3a7cc9d21ef6e8d10762e9cdce1e04e79a4d2
MD5 4b950f736aa6beeb574c6eb5a6be284f
BLAKE2b-256 7860e2c3a6da3bc15a3fd3e8fc3a7743156531ecc0c4ccb1b0824c6bd6fb258f

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page