#GPT Will View Websites and Run Code for You!
134 messages Β· Page 1 of 1 (latest)
Your personal AI Assistant! | GPT-3xecute | give tasks, get resulrs
Your personal AI Assistant! | GPT-3xecute | give tasks, get results
So it can connect to the internet?
Yes
It can run any python code using your machine
so it can connect to the internet
Check the GitHub readme. You need to provide two API keys. One is the telegram API key for the telegram bot and one is the openAI API key
@urban spear
i have some erros, i hope u can help me
def handle_user_commands(updates: list[Update], history: ChatHistory) -> list[Update]:
^
SyntaxError: invalid syntax
Interesting. did you modify the code at all? it would be surprising that this throws for you and not for me
I just updated the repo! The changes should not impact functionality at all though
Wrote up a blog post on this as well! https://www.thornewolf.com/let/
"Demo" by Thorne Wolfenbarger
OpenAI has a publicly available API for their GPT-3 model, "text-davinci-003". This API provides a simple and clean interface for text completions. See the example below for a demonstration for just how easy it is.
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Completion.create(
I haven't made any changes. I cloned the repo, filled in the .env file, and started it with python main.py.
python main.py
Traceback (most recent call last):
File "main.py", line 1, in <module>
from logic import read_and_respond_to_chats_forever
File "/home/mike/Downloads/ai/gpt-3-execution/logic.py", line 18
def handle_user_commands(updates: list[Update], history: ChatHistory) -> list[Update]:
^
SyntaxError: invalid syntax
Ah what version of python are you using. Perhaps you are using something before python 3.6?
Python 3.6 was released in 2016, so if that is the case I do recommend you upgrade.
Telegram + GPT! It runs code and looks at the internet!
GPT Will View Websites and Run Code for You!
if it also work on vs code
I typically am running the code using VSCode
@candid river this is really neat. How does it interface to ChatGPT?
it talks to gpt-3, specifically openai's daivnci-003 model. While this is not ChatGPT, don't feel like the performance is going to be low. The difference between gpt-3 and gpt-3.5 (chatgpt) is mainly that chatgpt is optimized for conversation. Since this solves problems primarily, the slightly weaker conversational ability isn't of concern (in my opinion)
ok that makes sense. thanks. this is probably off topic but was 3.5 trained on a different data set than 3? the 3.5 model itself says it was trained on up to 2021 i think. or was 3.5 just fine-tuned 3?
See https://medium.datadriveninvestor.com/openai-quietly-released-gpt-3-5-heres-what-you-can-do-with-it-4dee22aea438 as a random citation "In the meantime, OpenAI has quietly rolled out a series of AI models based on GPT-3.5, an improved version of GPT-3. The first of these models, ChatGPT, was unveiled at the end of November.
ChatGPT is a fine-tuned version of GPT-3.5 that can engage in conversations about a variety of topics, such as prose writing, programming, script and dialogues, and explaining scientific concepts to varying degrees of complexity."
So theoretically there is some difference between the models, but it hasn't really been surfaced in my experimentation
have you reversed how the throttling works on chatgpt? I was wondering if it is token based so you only get so many tokens before you get the to many requests in the last hour. cool down period message? also wondering how long you have to wait exactly.
This is using OpenAI's official API, not the hidden ChatGPT API. Therefore it doesn't have the same throttling limitations you are familiar with with the hacky ChatGPT API wrappers
oh yeah, i should have mentioned that it was another off topic question. sorry I haven't used discord much so maybe that question about chatgpt would better go in a chatgpt channel.
@candid river, I've hit a roadblock while trying to get this working. I keep receiving an error message from the botfather saying "Sorry, this username is invalid." Do you have any suggestions for resolving this issue?
make sure to end the bot's name with _bot? Try rereading the instructions carefully
here is a bot name i set up recently
According to the instructions, we are supposed to pick a username for our bot that ends in "bot", like "TetrisBot" or "tetris_bot". However, when I attempted to use "gptbot", it was unsuccessful. The instructions appear to be ambiguous. I then attempted to use "gpt" as the name and "gpt_bot" as the username but it also failed, and I got a message stating "Sorry, this username is already taken. Please try something different." Is there a way to view a list of already taken names?
Finally managed to find a bot name that wasn't already taken. That took forever! Still couldn't figure out how to see all the names that are already taken. Excited to get this set up!
it seems locked up here
/Volumes/git/gpt-3-execution (main)$ python main.py
MASTER:
Hello
Assistant:
what is this magic number? offset = 2083323969
ah sorry that was a debugging value to skip over already read messages. Go ahead and set it to 0. I will update the repo to do the same
success!
I left the offset in there and found I was missing just going to the telegram UI and starting up a conversation with the bot.
guess I'll go set that offset to 0 though
this is amazing! really nice work!
Thanks! Feel free to make any improvements you can think of and send me a pull request. Especially if you decide to integrate with another frontend like Whatsapp or discord
@candid river hey there, I've got a question, so I'm building a poweful ai myself which also should be able to search web, get urls, return the most accurate info from first 3 or 5 urls in either duckduckgo or google.
Recently been fixing other errors so haven't got to that part, does your project cover those aspects?
I have no hard coded snippets of code, so it is whatever the AI comes up with. Since sophisticated code is normally necessary to scrape web search results, I would expect my repo here to fall short of that goal.
Love to work on your repo, are you planning to update any feature or currently working on something in this project bro?
@candid river no worries at all, appreciate it!
yeah, made some touch ups yesterday on it. Plan on improving by shrinking the initial prompt size and offloading the coding work to a dedicated GPT instance for coding. It won't be my full time job, but I'll keep working on it
Hey all, just pushed a refactoring update for the repo. You shouldn't see any changes in model performance, but the code should be a lot simpler to extend. For example, this is now what the core read+respond loop implementation looks like:
You now can implement alternative frontend interfaces by conforming to TextInterface as specified in https://github.com/thornewolf/gpt-3-execution/blob/main/text_interface.py
nice update. thanks. On another note: I hit an exception when it retrieves an edited message: result [{'update_id': 881893917, 'edited_message': {'message_id':...
File "/Volumes/git/gpt-3-execution/telegram.py", line 82, in <listcomp>
return [Update(**e) for e in result]
^^^^^^^^^^^
File "pydantic/main.py", line 342, in pydantic.main.BaseModel.init
pydantic.error_wrappers.ValidationError: 1 validation error for Update
message
field required (type=value_error.missing)
I think Update class is expecting a 'message' but this one had a 'edited_message' instead
Hi
Traceback (most recent call last):
File "main.py", line 1, in <module>
from logic import read_and_respond_to_chats_forever
File "/home/Bricon/api/gpt-3-execution/logic.py", line 17, in <module>
from text_interface import Message, TextInterface
File "/home/Bricon/api/gpt-3-execution/text_interface.py", line 17, in <module>
class TextInterface(ABC):
File "/home/Bricon/api/gpt-3-execution/text_interface.py", line 18, in TextInterface
def get_new_messages(self) -> list[Message]:
TypeError: 'type' object is not subscriptable
Good afternoon, has anyone got this error?
Hi @knotty nova , I am using python typing features introduced in Python3.9. This Python version was released in 2021, whereas the latest version (3.11) was released a few months ago. You can update to any current python version to take advantage of these features.
Thanks for this bug report, I'll make a batch that excludes events that are not simply new messages
Thanks! π
Starting bot...
Traceback (most recent call last):
File "/soc/api/gpt-3-execution/main.py", line 12, in <module>
main()
File "/soc/api/gpt-3-execution/main.py", line 7, in main
read_and_respond_to_chats_forever(ChatHistory(), TelegramInterface())
File "/soc/api/gpt-3-execution/logic.py", line 137, in read_and_respond_to_chats_forever
messages = chat_interface.get_new_messages()
File "/soc/api/gpt-3-execution/telegram.py", line 115, in get_new_messages
updates = get_updates(offset=self.message_read_offset)
File "/soc/api/gpt-3-execution/telegram.py", line 55, in wrapper
return fn(*args, token=TELEGRAM_API_KEY, **kwargs)
File "/soc/api/gpt-3-execution/telegram.py", line 86, in get_updates
return [Update(**e) for e in result]
File "/soc/api/gpt-3-execution/telegram.py", line 86, in <listcomp>
return [Update(**e) for e in result]
File "pydantic/main.py", line 342, in pydantic.main.BaseModel.init
pydantic.error_wrappers.ValidationError: 1 validation error for Update
message -> text
field required (type=value_error.missing)
randomly stopped working, need to do any more configuration?
I suspect that this is related to the bug mentioned by resen earlier. Did you edit any of your messages? I'll prioritize this fix.
I didn't make any edits to the question
Thanks!
I have just pushed an update to the repo that ignores invalid telegram updates. Lmk if this helps fix your error
also @spiral totem
Thank you my friend! I will validate π
thanks, I had deleted the telegram bot so it would delete the message history and remove the edited messages as a workaround. I had tried to fix myself but failed. I'll take a look at your solution.
I believe the 'edited_message' issue is resolved. Thanks. Ran into another issue though. Am I using it correctly? The time in NYC should have been 8:14PM.
gpt will view website
this looks like a regression in my prompts. Due to some weird python quirk GPT needs to put the import statements inside the solve function, but sometimes it forgets to. I'll see if I can make this prompt more reliable.
In the meantime you can tell it something along the lines of "move the imports for requests and json inside the solve function"
I've just made an update that I believe improves the performance
This is my transcript
I made some changes to improve the prompt size, but this caused the code to sometimes not give GPT the full transcript, leading to it not being able to answer questions
I just pulled your latest changes but I don't have the change that moved the imports into solve.
never mind, I just saw the prompt where you added this:
{HUMAN_TITLE}:
Thanks! Always put the import statement inside of the solve function. It is bad practice to put it outside of the function.
I guess the model is just ignoring it lol
I have python 3.9 under debian 11 and always get the following error:
gpt-3-execution$ python3.9 main.py
Traceback (most recent call last):
File "/home/mike/Downloads/ai/gpt-3-execution/main.py", line 1, in <module>
from logic import read_and_respond_to_chats_forever
File "/home/mike/Downloads/ai/gpt-3-execution/logic.py", line 89, in <module>
) -> str | None:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
maybe I use too many very current python features. I guess that was added in Python 3.10 or 3.11
How to create a website for e-commerce
thats amazing) i dreamed about smth like this
This could be a great product in my opinion if you finish the various nuances
`PS C:\Users\CLEVO\Desktop\gpt-3-execution-main\examples> & C:/Users/CLEVO/AppData/Local/Programs/Python/Python310/python.exe c:/Users/CLEVO/Desktop/gpt-3-execution-main/main.py
Starting bot...
RECEIVED USER MESSAGE
[Message(text='π', message_id='791', user_id='793494085', chat_id='793494085'), Message(text='/stop', message_id='792', user_id='793494085', chat_id='793494085')]
Traceback (most recent call last):
File "c:\Users\CLEVO\Desktop\gpt-3-execution-main\main.py", line 12, in <module>
main()
File "c:\Users\CLEVO\Desktop\gpt-3-execution-main\main.py", line 7, in main
read_and_respond_to_chats_forever(ChatHistory(), TelegramInterface())
File "c:\Users\CLEVO\Desktop\gpt-3-execution-main\logic.py", line 151, in read_and_respond_to_chats_forever
handle_user_message(message, history, chat_interface)
File "c:\Users\CLEVO\Desktop\gpt-3-execution-main\logic.py", line 30, in handle_user_message
response = get_llm_completion_for_chat(message.chat_id, history)
File "c:\Users\CLEVO\Desktop\gpt-3-execution-main\logic.py", line 119, in get_llm_completion_for_chat
response = get_gpt_response(history.get(chat_id))
File "c:\Users\CLEVO\Desktop\gpt-3-execution-main\gpt.py", line 54, in get_gpt_response
write_most_recent_prompt_to_file(prompt)
File "c:\Users\CLEVO\Desktop\gpt-3-execution-main\gpt.py", line 45, in write_most_recent_prompt_to_file
f.write(prompt)
File "C:\Users\CLEVO\AppData\Local\Programs\Python\Python310\lib\encodings\cp1251.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f602' in position 3183: character maps to <undefined>
PS C:\Users\CLEVO\Desktop\gpt-3-execution-main\examples> `
How to fix now?
i just send him π
@candid river can you please see what went wrong, i did everything the way you instructed. maybe i missed something. sorry for bothering you π
i had same, you should create file ".env" with api inside
yeah i already created that. still not working
Then let's wait for the guru to answer
awesome bot, I really like the way it works
hopefully π
My suggestion would have been a missing .env file. Feel free to DM me with a screenshot of your directories and I'll check if anything is out of place.
If that doesn't work, I might ask you to show me the contents of .env, but we will keep that as a last resort since it's private
Looks like python is having trouble writing an emoji to a local file. I'll make an update later today to disable that by default while I investigate
very much looking forward to
it's like my virtual friend now)
Should I just download a new archive from githab?
need help
the code does not see your api keys, make sure you have created a valid .env file
Hi. I am a German psychologist. I want to use the ai chat as a kind of first point of contact in order to be able to give initial, helpful answers to possible questions, fears or problems of your patients. On Chat.open.ai I have already been able to teach the chatbot to be a corresponding psychologist. The replies were all excellent and helpful. Now I would like to take the next step and integrate this tool on my website or Whatapp - but have no idea how. Can you help?
maybe i can help you, take my friend income
My bot is working again, but for some reason does not save the history of messages as before in a text file
Ok, you know what I am looking for?
If I understand you correctly you want to connect the bot to watsap, I found the appropriate topic on the server, this is done in a similar way as the connection to telegram
did you resolve this issue or do you still need help?
how did you get it working? Did you update your python version?
i need help
@candid river How did you do, to make a conversation with the api like chatgpt? I have a similar telegram bot but Iβm struggling, the bot works perfectly but the API canβt follow the conversation so she forgets the previous answers
It is a bit more complex. I want the AI chat to act like a psychologist. Therefore I made a lot of tests at chat.openai.com (and teached him well to become a good psychologist like me) and really love the results so far. The idea is to turn this chatbot into a private messenger or app for my clients so that they can communicate with it as some kind of first, quick help. But I am not a coder π
- Can you try downloading the GitHub repo in a fresh folder.
- In this fresh repo, make a .env file with some sample values
- Run the code
- DM me the screenshots
Note: there is no need to send me anything that contains any of your real API keys
Thank you very much for the update code of my favorite bot) I communicate with him every day) Do you plan to add any more functions, and if I understand correctly that he can add his own code such as adding to it tests.
@candid river Traceback (most recent call last):
File "c:\Users\CLEVO\Desktop\1\gpt-3-execution-main\main.py", line 22, in <module>
main()
File "c:\Users\CLEVO\Desktop\1\gpt-3-execution-main\main.py", line 15, in main
read_and_respond_to_chats_forever(ChatHistory(), TelegramInterface())
File "c:\Users\CLEVO\Desktop\1\gpt-3-execution-main\logic.py", line 147, in read_and_respond_to_chats_forever
handle_user_message(message, history, chat_interface)
File "c:\Users\CLEVO\Desktop\1\gpt-3-execution-main\logic.py", line 35, in handle_user_message
response = get_llm_completion_for_chat(message.chat_id, history)
File "c:\Users\CLEVO\Desktop\1\gpt-3-execution-main\logic.py", line 122, in get_llm_completion_for_chat
response = get_gpt_prefixed_response(history.get(chat_id))
File "c:\Users\CLEVO\Desktop\1\gpt-3-execution-main\gpt.py", line 52, in get_gpt_prefixed_response
write_most_recent_prompt_to_file(prompt)
File "c:\Users\CLEVO\Desktop\1\gpt-3-execution-main\gpt.py", line 47, in write_most_recent_prompt_to_file
f.write(prompt)
File "C:\Users\CLEVO\AppData\Local\Programs\Python\Python310\lib\encodings\cp1251.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f643' in position 3334: character maps to <undefined>
PS C:\Users\CLEVO\Desktop\gpt-3-execution-main\examples>
Agean trouble with smiles
made an update for you
it should skip writing to the file unless you set a flag to do so. This means by default you shouldn't get this error
thank you so much sir, my friend and helper is now always in my pocket )
openai.error.InvalidRequestError: This model's maximum context length is 4097 tokens, however you requested 4276 tokens (3776 in your prompt; 500 for the completion). Please reduce your prompt; or completion length.
and after starting it begins to load supposedly new messages and again the error, roughly speaking - hung up. How to fix it?
By the way, no more problems with smileys, works correctly
published an update that should help mitigate this. LMK
@autumn rapids
can i have access to the bot that maybe one of you have already created so that i can tested out?