Welcome to the Poe server bot quick start. This repository serves as a companion to our tutorial and contains starter code that allows you to quickly get a bot running. The following are some of the examples included in this repo.
欢迎来到 Poe 服务端机器人快速入门。 本代码仓库是我们教程的配套项目,其中包含的入门代码可以让你快速运行一个机器人。以下是本仓库中包含的一些示例。
Note that the starter code assumes you have Modal setup for deployment (the instructions for which are described in the aforementioned tutorial).
请注意,入门代码假定你已经设置好用于部署的 Modal(相关说明在前述的教程中有详细描述)。
-
This bot simply repeats the user's query in the response.
-
Before you build any server bots, you should start with reproducing this bot.
-
This will ensure that your have a working fastapi_poe and modal setup.
-
To deploy, run
modal deploy echobot.py -
这个机器人只会在响应中重复用户的提问。
-
在你构建任何服务端机器人之前,都应该从复现这个机器人开始。
-
这将确保你的 fastapi_poe 和 modal 环境已正确设置并可以正常工作。
-
如需部署,请运行
modal deploy echobot.py
A correct implementation would look like https://poe.com/EchoBotDemo
一个正确的实现看起来像这样:https://poe.com/EchoBotDemo
-
This bot is an implementation of the prompt bot as a server bot.
-
It demonstrates how to use the Poe platform to cover the inference costs for your chatbot.
-
This bot uses Claude-3-Haiku and the system prompt instructs the bot to produce Haikus.
-
If you intend to call Poe server to build your bot response, you should check if you can reproduce this bot.
-
To deploy, run
modal deploy prompt_bot.py -
Before you are able to use the bot, you also need to synchronize the bot's settings with the Poe Platform, the instructions for which are specified here.
-
这个机器人是作为服务端机器人实现的提示词机器人。
-
它演示了如何利用 Poe 平台来覆盖你的聊天机器人的推理成本。
-
这个机器人使用 Claude-3-Haiku,其系统提示词指示机器人创作俳句。
-
如果你打算调用 Poe 服务器来构建你的机器人响应,你应该检查是否能复现这个机器人。
-
如需部署,请运行
modal deploy prompt_bot.py -
在使用该机器人之前,你还需要将其设置与 Poe 平台同步,具体说明请参见此处。
A correct implementation would look like https://poe.com/PromptBotDemo
一个正确的实现看起来像这样:https://poe.com/PromptBotDemo
-
This bot is an implementation of the prompt bot as a server bot, but your own model provider API key.
-
It demostrates how to wrap OpenAI API.
-
You will need your OpenAI API key.
-
To deploy, run
modal deploy wrapper_bot.py -
这个机器人是作为服务端机器人实现的提示词机器人,但使用的是你自己的模型提供商 API 密钥。
-
它演示了如何封装 OpenAI API。
-
你将需要自己的 OpenAI API 密钥。
-
如需部署,请运行
modal deploy wrapper_bot.py
A correct implementation would look like https://poe.com/WrapperBotDemo
一个正确的实现看起来像这样:https://poe.com/WrapperBotDemo
-
This bot demonstrates how to wrap an image generation endpoint.
-
It uses Fireworks AI's StableDiffusionXL endpoint. You will need to provide your own key for this.
-
Alternatively, you can change the URL to point at a different provider or model.
-
To deploy, run
modal deploy sdxl_bot.py -
这个机器人演示了如何封装一个图像生成端点。
-
它使用了 Fireworks AI 的 StableDiffusionXL 端点。你需要为此提供自己的密钥。
-
或者,你也可以更改 URL 以指向不同的提供商或模型。
-
如需部署,请运行
modal deploy sdxl_bot.py
A correct implementation would look like https://poe.com/StableDiffusionXL
一个正确的实现看起来像这样:https://poe.com/StableDiffusionXL
-
A sample bot that demonstrates the Markdown capabilities of the Poe API.
-
See instructions here.
-
To deploy, run
modal deploy catbot.py -
一个演示 Poe API 的 Markdown 功能的示例机器人。
-
请参见此处的说明。
-
如需部署,请运行
modal deploy catbot.py
A correct implementation would look like https://poe.com/CatBotDemo
一个正确的实现看起来像这样:https://poe.com/CatBotDemo
-
A bot that demonstrates how to render an image in the response using Markdown.
-
To deploy, run
modal deploy image_response_bot.py -
一个演示如何在响应中使用 Markdown 渲染图像的机器人。
-
如需部署,请运行
modal deploy image_response_bot.py
A correct implementation would look like https://poe.com/ImageResponseBotDemo
一个正确的实现看起来像这样:https://poe.com/ImageResponseBotDemo
-
A bot that demonstrates how to attach files to your bot response. This example specifically uses video, but outputting other file types is fairly similar.
-
To deploy, run
modal deploy video_bot.py -
Before you are able to use the bot, you also need to synchronize the bot's settings with the Poe Platform, the instructions for which are specified here.
-
一个演示如何将文件附加到机器人响应中的机器人。这个例子特别使用了视频,但输出其他文件类型也相当类似。
-
如需部署,请运行
modal deploy video_bot.py -
在使用该机器人之前,你还需要将其设置与 Poe 平台同步,具体说明请参见此处。
A correct implementation would look like https://poe.com/VideoBotDemo
一个正确的实现看起来像这样:https://poe.com/VideoBotDemo
-
A bot that demonstrates how to enable file upload for the users of your bot.
-
To deploy, run
modal deploy pdf_counter_bot.py -
Before you are able to use the bot, you also need to synchronize the bot's settings with the Poe Platform, the instructions for which are specified here.
-
一个演示如何为你的机器人用户启用文件上传功能的机器人。
-
如需部署,请运行
modal deploy pdf_counter_bot.py -
在使用该机器人之前,你还需要将其设置与 Poe 平台同步,具体说明请参见此处。
A correct implementation would look like https://poe.com/PDFCounterBotDemo
一个正确的实现看起来像这样:https://poe.com/PDFCounterBotDemo
-
A bot that demonstrates how to use the Poe API for function calling.
-
To deploy, run
modal deploy function_calling_bot.py -
Before you are able to use the bot, you also need to synchronize the bot's settings with the Poe Platform, the instructions for which are specified here.
-
一个演示如何使用 Poe API 进行函数调用的机器人。
-
如需部署,请运行
modal deploy function_calling_bot.py -
在使用该机器人之前,你还需要将其设置与 Poe 平台同步,具体说明请参见此处。
A correct implementation would look like https://poe.com/FunctionCallingDemo
一个正确的实现看起来像这样:https://poe.com/FunctionCallingDemo
-
A bot that manages a function calling loop and preserves function (tool) details in the chat for later user queries.
-
To deploy, run
modal deploy function_calling_loop_bot.py -
Before you are able to use the bot, you also need to synchronize the bot's settings with the Poe Platform, the instructions for which are specified here.
-
一个管理函数调用循环并在聊天中保留函数(工具)细节以供后续用户查询的机器人。
-
如需部署,请运行
modal deploy function_calling_loop_bot.py -
在使用该机器人之前,你还需要将其设置与 Poe 平台同步,具体说明请参见此处。
A correct implementation would look like https://poe.com/FunctionCallingLoopDemo
一个正确的实现看起来像这样:https://poe.com/FunctionCallingLoopDemo
-
Illustrate what is contained in the QueryRequest object.
-
To deploy, run
modal deploy log_bot.py -
展示 QueryRequest 对象中包含的内容。
-
如需部署,请运行
modal deploy log_bot.py
A correct implementation would look like https://poe.com/LogBotDemo
一个正确的实现看起来像这样:https://poe.com/LogBotDemo
-
Provides an example of how to access HTTP request information in your bot.
-
To deploy, run
modal deploy http_request_bot.py -
提供一个如何在你的机器人中访问 HTTP 请求信息的示例。
-
如需部署,请运行
modal deploy http_request_bot.py
A correct implementation would look like https://poe.com/HTTPRequestBotDemo
一个正确的实现看起来像这样:https://poe.com/HTTPRequestBotDemo
-
This bot responds to the user's query using GPT-3.5-Turbo.
-
It demonstrates how to use the Poe platform to cover the inference costs for your chatbot.
-
To deploy, run
modal deploy turbo_allcapsbot.py. -
Before you are able to use the bot, you also need to synchronize the bot's settings with the Poe Platform, the instructions for which are specified here.
-
这个机器人使用 GPT-3.5-Turbo 回应用户的提问。
-
它演示了如何利用 Poe 平台来覆盖你的聊天机器人的推理成本。
-
如需部署,请运行
modal deploy turbo_allcapsbot.py。 -
在使用该机器人之前,你还需要将其设置与 Poe 平台同步,具体说明请参见此处。
A correct implementation would look like https://poe.com/AllCapsBotDemo
一个正确的实现看起来像这样:https://poe.com/AllCapsBotDemo
-
This is a more advanced example that demonstrates how to render output in realtime comparing two different bots.
-
To deploy, run
modal deploy turbo_vs_claude.py -
Before you are able to use the bot, you also need to synchronize the bot's settings with the Poe Platform, the instructions for which are specified here.
-
这是一个更高级的示例,演示了如何实时渲染并比较两个不同机器人的输出。
-
如需部署,请运行
modal deploy turbo_vs_claude.py -
在使用该机器人之前,你还需要将其设置与 Poe 平台同步,具体说明请参见此处。
A correct implementation would look like https://poe.com/TurboVsClaudeBotDemo
一个正确的实现看起来像这样:https://poe.com/TurboVsClaudeBotDemo
-
An example bot that takes in a user-uploaded image, analyzes it with Claude-3.5-Sonnet to recommend a new top, and then generates an image of the new clothing with Imagen-3 to return to the user.
-
This is a good starting point for handling user-uploaded attachments, and also returning attachments with your bot.
-
To deploy, run
modal deploy new_top_recommender.py -
一个示例机器人,它接收用户上传的图片,使用 Claude-3.5-Sonnet 进行分析以推荐一件新上衣,然后使用 Imagen-3 生成新服装的图片并返回给用户。
-
这是处理用户上传附件以及在机器人响应中返回附件的一个很好的起点。
-
如需部署,请运行
modal deploy new_top_recommender.py
A correct implementation would look like https://poe.com/TopRecommender
一个正确的实现看起来像这样:https://poe.com/TopRecommender
-
An example bot that generates code based on the user query, runs it with the @Python bot, and attempts to debug it if there's any issue.
-
This is a good starting point for chaining requests to various text models.
-
To deploy, run
modal deploy python_runner.py -
一个示例机器人,它根据用户的查询生成代码,使用 @Python 机器人运行它,并在出现任何问题时尝试进行调试。
-
这是将请求链接到各种文本模型的良好起点。
-
如需部署,请运行
modal deploy python_runner.py
A correct implementation would look like https://poe.com/PythonCodeRunner
一个正确的实现看起来像这样:https://poe.com/PythonCodeRunner