Coder Social home page Coder Social logo

server-bot-quick-start's People

Contributors

anmolsingh95 avatar jellezijlstra avatar krisyang1125 avatar pre-commit-ci[bot] avatar tbarrella avatar tonghuikang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

server-bot-quick-start's Issues

Poe Web Api / NPM Package

Dear developers,
i just Want to say that you should make a web api like a post endpoint that will take json to commiunicate with the api. and there is an discord bot commiunity that can use ai to like use that on discord (im acually here for that lol) ...

So Pleaseeee add an web api or a npm package

`function_calling_bot` example doesn't work

I tried the function_calling_bot example but every time I send a request to the bot I get this in the terminal and the bot says " ran into a problem answering your request.".

Error in Poe bot: Bot request to GPT-3.5-Turbo failed on try 0
 BotError('{"allow_retry": true, "text": "Message m-000000xy92msflaxx6qefntpppd3e55u called on bot that has 0 or undefined call count in settings."}')
Error in Poe bot: Bot request to GPT-3.5-Turbo failed on try 1
 BotError('{"allow_retry": true, "text": "Message m-000000xy92msflaxx6qefntpppd3e55u called on bot that has 0 or undefined call count in settings."}')
ERROR:    Error responding to query
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/fastapi_poe/base.py", line 181, in handle_query
    async for event in self.get_response(request):
  File "/Users/behnam/Downloads/LLM/server-bot-quick-start/function_calling_bot.py", line 62, in get_response
    async for msg in fp.stream_request(
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/fastapi_poe/client.py", line 310, in stream_request
    tool_calls = await _get_tool_calls(
                 ^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/fastapi_poe/client.py", line 382, in _get_tool_calls
    async for message in stream_request_base(
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/fastapi_poe/client.py", line 455, in stream_request_base
    async for message in ctx.perform_query_request(
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/fastapi_poe/client.py", line 224, in perform_query_request
    raise BotError(event.data)
fastapi_poe.client.BotError: {"allow_retry": true, "text": "Message m-000000xy92msflaxx6qefntpppd3e55u called on bot that has 0 or undefined call count in settings."}

I didn't change the code of the file, except for running it locally instead of on Modal (but I made sure my local server was reachable by trying the echobot example first).

My Poe subscription just ended. Could it be because of that? (Although, GPT-3.5-Turbo is free).

Bot request fail on try

So, I tried to run the bot right on my console, by adding these codes into the main.py:

async def run(the_content):
    query = QueryRequest(
        version="1.0",
        type="query",
        query=[
            {
                "content": the_content,
                "message_id": "123",
                "role": "user",
                "content_type": "text/markdown"
                }
               ],
        user_id="u-ser123",
        conversation_id="c-onversation123",
        message_id="m-essage123",
        api_key = "MCSXqhvQATRgXiRWkIB025gPkPMuu84q"
    )    
    response = bot.get_response(query)
    async for event in response:
        print(event.data)
if __name__ == "__main__":
    content = input("something: ")
    asyncio.run(run(content))

Which the EchoBot, HuggingFaceBot worked perfectly. But when I uncommented the
bot = ChatGPTAllCapsBot(), and ran the code, the console poped me this error:

image

Compare to what I get when run the EchoBot:
image

Please help, I don't know how to run the chatGPT bot so it would look like the Echo one

Broken code to package modal

################################################################################

Something with the Modal installation seems broken.

Please email [email protected] and we will try to help!

################################################################################
#on trying to output main.py
Traceback (most recent call last):
File "/workspace/server-bot-quick-start/main.py", line 8, in
from modal import Image, Stub, asgi_app
File "/workspace/.pyenv_mirror/user/current/lib/python3.12/site-packages/modal/init.py", line 6, in
from .app import container_app, is_local
File "/workspace/.pyenv_mirror/user/current/lib/python3.12/site-packages/modal/app.py", line 17, in
from .object import _Object
File "/workspace/.pyenv_mirror/user/current/lib/python3.12/site-packages/modal/object.py", line 23, in
_BLOCKING_O = synchronize_api(O)
^^^^^^^^^^^^^^^^^^
File "/workspace/.pyenv_mirror/user/current/lib/python3.12/site-packages/modal_utils/async_utils.py", line 31, in synchronize_api
return synchronizer.create_blocking(obj, blocking_name, target_module=target_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/.pyenv_mirror/user/current/lib/python3.12/site-packages/synchronicity/synchronizer.py", line 687, in create_blocking
wrapped = self._wrap(obj, Interface.BLOCKING, name, target_module=target_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/.pyenv_mirror/user/current/lib/python3.12/site-packages/synchronicity/synchronizer.py", line 623, in _wrap
if self._wrapped_attr not in obj.dict:
^^^^^^^^^^^^
AttributeError: 'typing.TypeVar' object has no attribute 'dict'. Did you mean: 'dir'?
gitpod /workspace/server-bot-quick-start (main) $

Limited Input/Output length seriously reduces Poe's usefulness compared to ChatGPT

Recently I've been trying to create an advanced academic bot on the platform which depends on GPT-4, ChatGPT, and Mixtral 8×7b-Chat models. All was working well until I found out that there's an input limit to bots on Poe, which means I can't send long pieces of text to bots through my bot. I thought maybe the problem was with my bot, so I tried to manually use GPT-4 on Poe and send the text. I got the same result: GPT-4 says this (screenshot):

image

This is odd because I can easily send the same piece of text on the ChatGPT website and it accepts it. Not only that, I can also generate much longer pieces of text on the ChatGPT website whereas on Poe, there seems to be a length limit. This restriction essentially means my bot can't work properly on Poe.

To make things worse, I also noticed that this limitation seriously deteriorates the quality of the "function calling" feature on Poe bots (https://developer.poe.com/server-bots/using-openai-function-calling). When the input length of a bot gets restricted, it also loses its ability to accurately follow the JSON schema of the function inputs (I even tried simplifying my JSON schema a lot but to no avail). The end result is that my bot on Poe hallucinates much more than it does if I were using the OpenAI's API directly, and makes up JSON fields that don't exist in the schema...

I like Poe and have advertised it to my friends, which is why I hope you consider fixing these problems. My project is time critical and I'm afraid without having access to the actual GPT-4 context window, I would have to use something else like ChatGPT's GPT store. I really prefer to use Poe though because of the flexibility you have provided through your API and good documentation. If you have any questions, please feel free to ask!

Message called on bot that has 0 or undefined call count in settings.

Attempting to set up this repo with Poe, but I keep getting this error when I try to run any models. I haven't changed any code in the example, so I'm a bit confused as to why this is happening.

I get this error in Modal when I deploy and try to send any message.

Error in Poe bot: Bot request to GPT-3.5-Turbo failed on try 1 
 BotError('{"allow_retry": true, "text": "Message m-000000xy92lvkqap8y0ljx2d0d4ko5mb called on bot that has 0 or undefined call count in settings."}')
Error responding to query
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/fastapi_poe/base.py", line 181, in handle_query
    async for event in self.get_response(request):
  File "/root/turbo_allcapsbot.py", line 24, in get_response
    async for msg in stream_request(request, "GPT-3.5-Turbo", request.access_key):
  File "/usr/local/lib/python3.10/site-packages/fastapi_poe/client.py", line 307, in stream_request
    async for message in ctx.perform_query_request(request):
  File "/usr/local/lib/python3.10/site-packages/fastapi_poe/client.py", line 209, in perform_query_request
    raise BotError(event.data)
fastapi_poe.client.BotError: {"allow_retry": true, "text": "Message m-000000xy92lvkqap8y0ljx2d0d4ko5mb called on bot that has 0 or undefined call count in settings."}

I don't understand why it's saying the bot has a 0 or undefined call count, when it's clearly defined in the settings. I'm running the GPT35TurboAllCapsBot:

"""

Sample bot that wraps GPT-3.5-Turbo but makes responses use all-caps.

"""
from __future__ import annotations

from typing import AsyncIterable

from fastapi_poe import PoeBot
from fastapi_poe.client import stream_request
from fastapi_poe.types import (
    PartialResponse,
    QueryRequest,
    SettingsRequest,
    SettingsResponse,
)


class GPT35TurboAllCapsBot(PoeBot):
    async def get_response(
        self, request: QueryRequest
    ) -> AsyncIterable[PartialResponse]:
        async for msg in stream_request(request, "GPT-3.5-Turbo", request.access_key):
            yield msg.model_copy(update={"text": msg.text.upper()})

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

If anyone could assist with this, that would be great.

Thanks

Error communicating with bot chatGPT

followed the tutorial in here : https://developer.poe.com/api-bots/quick-start
i also enabled the POE_API_KEY, i send it in the request in the BEARER.

EchoBot and HuggingFaceBot works perfectly when making an api calling using postman.
however, when switching to ChatGPTAllCapsBot or the example in here https://developer.poe.com/api-bots/api-to-access-bots-on-poe i get the error below:

Sending request to chatGPT...
Request finished with status 200. (execution time: 6.9 ms, total latency: 1805.2 ms)
Error in Poe API Bot: Bot request to chatGPT failed on try 0 {"allow_retry": true, "text": "Internal server error"}
Error in Poe API Bot: Bot request to chatGPT failed on try 1 {"allow_retry": true, "text": "Internal server error"}
Error occurred: Error communicating with bot chatGPT
Error responding to query
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/fastapi_poe/client.py", line 321, in stream_request
async for message in ctx.perform_query_request(request):
File "/usr/local/lib/python3.11/contextlib.py", line 222, in aexit
await self.gen.athrow(typ, value, traceback)
File "/usr/local/lib/python3.11/contextlib.py", line 222, in aexit
await self.gen.athrow(typ, value, traceback)
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1580, in stream
yield response
File "/usr/local/lib/python3.11/site-packages/httpx_sse/_api.py", line 70, in aconnect_sse
yield EventSource(response)
File "/usr/local/lib/python3.11/site-packages/fastapi_poe/client.py", line 225, in perform_query_request
raise BotError(event.data)
fastapi_poe.client.BotError: {"allow_retry": true, "text": "Internal server error"}

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/fastapi_poe/base.py", line 169, in handle_query
async for event in self.get_response(query):
File "/root/chatgpt_allcapsbot.py", line 33, in get_response
raise e
File "/root/chatgpt_allcapsbot.py", line 12, in get_response
async for msg in stream_request(query, "chatGPT", query.api_key):
File "/usr/local/lib/python3.11/site-packages/fastapi_poe/client.py", line 330, in stream_request
raise BotError(f"Error communicating with bot {bot_name}") from e
fastapi_poe.client.BotError: Error communicating with bot chatGPT
if i use the BOT i created by sending aprompt from the POE website, it works.

Response Returned by poe api is less than web

I create a bot https://poe.com/BotNhaThuocLongChau2
Then I upload some pdf files to my bot.
And also purchased a subscription to get API key
Then I tried to query from python code with the question "Có bán Vitamin B không" to compare response between web and api

For web I received the good response:
poe web - co ban vitamin b khong

Then I tried in the python code

poe- api - less response

I compared the response and surprised that the web returned much more information than API.
I don't know if I miss something in my code .

It's ok to share my python api code here


import asyncio
import fastapi_poe as fp


async def get_responses(api_key, messages):
    global last_reply
    last_reply=""
    async for partial in fp.get_bot_response(messages=messages, bot_name="BotNhaThuocLongChau2", api_key="[my_api_key]",temperature=0.0):

        last_reply += partial.text

api_key = "[my_api_key]"
message = fp.ProtocolMessage(role="user", content="Có bán Vitamin B không")

asyncio.run(get_responses("[my_api_key]", [message]))


print(last_reply)

Please advise

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.