Synchronous is Gold #207
AverniteDF
started this conversation in
General
Replies: 3 comments
-
I've created a starting point for this effort at https://github.com/AverniteDF/poe-bot-server-wsgi for anyone who's interested. The WSGI-implemented server bot is currently available on Poe as Server-Bot-WSGI. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Does anybody know what URL I should use when forwarding a conversation to a bot on Poe? THIRD_PARTY_BOT = 'GPT-4o-Mini'
def forward_to_third_party_bot(conversation):
"""
Forwards the conversation to the third-party bot and returns its response.
Handles both regular and streaming responses.
"""
try:
# Define the third-party bot's URL
third_party_bot_url = f"https://api.poe.com/bot/{THIRD_PARTY_BOT}" # Is this correct?
# Construct the payload based on the incoming query
payload = {
"version": "1.1",
"type": "query",
"query": conversation.query_list, # Forward the entire query list
"language_code": "en" # Optional: Adjust based on your use case
}
# Set the headers, including the Authorization header for the third-party bot
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {ACCESS_KEY}" # Use the same ACCESS_KEY
}
# Rest of function... |
Beta Was this translation helpful? Give feedback.
0 replies
-
It's working! Yay 🎉 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What I find most interesting about this project is its ability to access Poe's API in a synchronous manner (WSGI-compatible).
Has anyone gotten a cPanel-created Python web application in a shared hosting environment to work as a functional server bot?
The difficult part is getting such a server bot to communicate with an LLM such as 'GPT-3.5-Turbo' via Poe's API to relay interesting responses back to the user.
This is because Poe's documentation pushes Modal cloud service and asynchronous (ASGI) code examples that use
fastapi_poe
.But what about the hobbyist who just wants to play around with creating a server bot using a Python web app on their inexpensive shared hosting account?
At the end of the day we're just passing JSON payloads from one endpoint to another via HTTP POSTs. Sync implementation should work for this and async should be optional, no?
Could the synchronous methods in
poe_api_wrapper/api.py
be adapted to create a library that would make it practical (and safe) for the everyman to create server chatbots on their shared hosting account? This would be useful to a lot of people, including myself! No dependency on cloud service so you can sleep at night.Beta Was this translation helpful? Give feedback.
All reactions