Setting an introduction message
async def get_settings(self, setting: fp.SettingsRequest) -> fp.SettingsResponse:
return fp.SettingsResponse(
introduction_message="Welcome to the trivia bot. Please provide me a topic that you would like me to quiz you on."
)from __future__ import annotations
from typing import AsyncIterable
from modal import Image, Stub, asgi_app
import fastapi_poe as fp
class TriviaBotSample(fp.PoeBot):
async def get_response(self, query: fp.QueryRequest) -> AsyncIterable[fp.PartialResponse]:
# implement the trivia bot.
yield fp.PartialResponse(text="Bot under construction. Please visit later")
async def get_settings(self, setting: fp.SettingsRequest) -> fp.SettingsResponse:
return fp.SettingsResponse(
introduction_message="Welcome to the trivia bot. Please provide me a topic that you would like me to quiz you on."
)
REQUIREMENTS = ["fastapi-poe==0.0.24"]
image = Image.debian_slim().pip_install(*REQUIREMENTS)
stub = Stub("trivia-poe")
@stub.function(image=image)
@asgi_app()
def fastapi_app():
bot = TriviaBotSample()
app = fp.make_app(bot, allow_without_key=True)
return app
Last updated