poe-platform / fastapi_poe

A helper library for writing Poe API bots using FastAPI
Apache License 2.0
145 stars 25 forks source link

GPT-3.5-Turbo dependency not working when using the API #111

Open liku-amare opened 5 months ago

liku-amare commented 5 months ago

I have created a bot with GPT-3.5-Turbo dependency using the code provided here. It works well on the web (poe.com). But I wanted to call my bot through this library and tried with the following code (from here). But it keeps giving the fastapi_poe.client.BotError: {"allow_retry": true, "text": "Internal server error"} error.

import asyncio
import fastapi_poe as fp

async def get_responses(api_key, bot_name, messages):
    async for partial in fp.get_bot_response(messages=messages, bot_name=bot_name, api_key=api_key):
        print(partial)

api_key = "..."

message = fp.ProtocolMessage(role="user", content="Hello world")

bot_name = "My_Bot_Name_Here"

asyncio.run(get_responses(api_key, bot_name, [message]))

The error on my VS Code is:

Error in Poe bot: Bot request to My_Bot_Name_Here failed on try 0 
 BotError('{"allow_retry": true, "text": "Internal server error"}')
Error in Poe bot: Bot request to My_Bot_Name_Here failed on try 1 
 BotError('{"allow_retry": true, "text": "Internal server error"}')

The error on the Modal console is:

Error in Poe bot: Bot request to GPT-3.5-Turbo failed on try 0 
 BotError('{"allow_retry": true, "text": "Internal server error"}')
Error in Poe bot: Bot request to GPT-3.5-Turbo failed on try 1 
 BotError('{"allow_retry": true, "text": "Internal server error"}')

It seems the GPT-3.5-Turbo dependency is working just fine on the web interface, but not working when using the API. Why is that?

JohntheLi commented 2 months ago

Hi @liku-amare , apologies for the super late response. From your code, I do not see

async def get_settings(self, setting: fp.SettingsRequest) -> fp.SettingsResponse:
    return fp.SettingsResponse(server_bot_dependencies={"GPT-3.5-Turbo": 1})

defined anywhere. Do you have this defined in your PoeBot code? see https://creator.poe.com/docs/server-bots-functional-guides#accessing-other-bots-on-poe for details. If you still see issues, please provide the error_id and I can help take a look at the stack trace.