acheong08 / ChatGPT

Reverse engineered ChatGPT API
GNU General Public License v2.0
28.01k stars 4.48k forks source link

[Feature Request]: Implementation for WebChatGPT #851

Closed LuckyHead11 closed 1 year ago

LuckyHead11 commented 1 year ago

Is there an existing issue for this?

What would your feature do ?

I have just come across the GitHub page: https://github.com/qunash/chatgpt-advanced ChatGPT-Advanced or WebChatGPT. The title is self-explanatory and gives ChatGPT access to the web similar to what BingGPT does through a Chrome Extension. I would like to know if you can implement something like it. This is what it does:

  1. Searches google and looks for relevant info.
  2. Changes the user's prompt to something like this: With the prompt being What is the ChatGPT Github page by acheong all about? Screenshot 2023-02-21 171235 Screenshot 2023-02-21 171814

You can ask directly to @qunash if you can implement or share code. Or you can copy the idea and make a similar feature to the API.

Proposed workflow

When you initialize the ChatBot in python you would simply add a "web" parameter. Which could be equal to True or False.

Additional information

No response

LuckyHead11 commented 1 year ago

@NymdaFromSalad How do I access the new web-enabled ChatGPT?

NymdaFromSalad commented 1 year ago

There is a separate class, in separate submodule. I wrote this all in wiki (https://github.com/NymdaFromSalad/ChatGPT-Web/blob/main/wiki/WebGPT.md). Also has an example in the end

Also, if it is for prompt testing, just use the website, the prompt is not runtime editable (well, it's python, so it is, but it is not supposed to be)

LuckyHead11 commented 1 year ago

@NymdaFromSalad So you want me to see what works, and what doesn't correct?

NymdaFromSalad commented 1 year ago

Ehm, no? I wanted you to make up a better prompt which later be used in the library. So, start with default prompt from extension (luckily, it does not hide the full text) so the chatgpt will return desired output. Library is pretty simple, and all testing which i have not done, will be easier to do in the browser, as it is the text added to the prompt which needs testing and maybe improvement

Sorry for verbosity, i just like to make sure, that we are on the same page

NymdaFromSalad commented 1 year ago

Ok, created pull request

LuckyHead11 commented 1 year ago

@NymdaFromSalad I dont wanna sound stupid ;) but you clarify 1 more time what exactly im doing. I understand python I've been working with it for years. I just don't know what you need. I guess???

NymdaFromSalad commented 1 year ago

@NymdaFromSalad I dont wanna sound stupid ;) but you clarify 1 more time what exactly im doing. I understand python I've been working with it for years. I just don't know what you need. I guess???

Don't worry.

1) How the WebChatGPT works is it puts search results and instructions at the start of each Web-enabled ChatGPT query (well, around the query to be precise), lets call the stuff it puts pattern

2) ChatGPT makes no distinction between message generated with WCGPT, and just copy-pasted message (both are just text), so you can use WCGPT to get links to websites (and a starting point) and then edit it

And what i suggested you do is change instructions and how the pattern is laid out, so it gives better results, no python use required.

NymdaFromSalad commented 1 year ago

Btw, if you want to help with the python part, you can check my code, specifically the async part, because i have no idea what i am doing there

LuckyHead11 commented 1 year ago

@

Btw, if you want to help with the python part, you can check my code, specifically the async part, because i have no idea what i am doing there

Async code is on my weak side... ask ChatGPT 🤣

acheong08 commented 1 year ago

There are a few problems with V1 async that needs fixing that I haven't gotten around to. Also don't know async well in Python.

acheong08 commented 1 year ago

Async V1 responses are slower for an unknown reason

LuckyHead11 commented 1 year ago

@NymdaFromSalad Try this:

Instructions: Using the provided web search results, write a comprehensive reply to the given query. Make sure to cite results using [[number](URL)] notation after the reference. If the provided search results refer to multiple subjects with the same name, write separate answers for each subject.
Query: tele-tubbies
LuckyHead11 commented 1 year ago

Also include this:

[1] "Experience the Teletubbies like never before! Join Tinky-Winky, Dipsy, Laa-Laa, and Po as they laugh, dance, and explore the magical world of Teletubbyland. The Teletubbies colourful appearance ..." URL: https://www.youtube.com/channel/UCOk55dAgB8VnMlhaTEMeX5A

[2] "Teletubbies is a British childrens television series created by Anne Wood and Andrew Davenport for the BBC. The programme focuses on four differently coloured characters known as the Teletubbies, named after the television screens on their bellies. Recognised throughout popular culture for the uniquely shaped antenna protruding from the head ..." URL: https://en.wikipedia.org/wiki/Teletubbies

Current date: 3/4/2023

NymdaFromSalad commented 1 year ago

@acheong08 @LuckyHead11 Gentlemen, my honest reaction to our likemindedness: stop-async

NymdaFromSalad commented 1 year ago

@NymdaFromSalad Try this:

Instructions: Using the provided web search results, write a comprehensive reply to the given query. Make sure to cite results using [[number](URL)] notation after the reference. If the provided search results refer to multiple subjects with the same name, write separate answers for each subject.
Query: tele-tubbies

Isn't it same what WebChatGPT uses? Because, thanks, but i already used this instruction, so i asked for any improvements on it or alternative queues

LuckyHead11 commented 1 year ago

@NymdaFromSalad I did some adjustments..

LuckyHead11 commented 1 year ago

I'll do some more adjustments tomorrow.

NymdaFromSalad commented 1 year ago

I'll do some more adjustments tomorrow.

K, thanks

LuckyHead11 commented 1 year ago

@NymdaFromSalad I've spent some time testing and this prompt works 99% of the time:

Instructions: You are a chatbot that has access to the web. Use the given web results above to write an easy-to-read and straightforward response. Make sure to cite results using [[number(URL)]. Make sure each website has its own section. All I want you to do is summarize the given web results. Don't say "sure" or anything like that. Just get to the point. Don't forget to cite the results with [[number(URL)]

Query: Teletubbies

Make sure that you replace the query with whatever the user asks, and add the current date and time to the end of the chat. Also for this to work make sure to give ChatGPT the URL of the website for each section.

NymdaFromSalad commented 1 year ago

@NymdaFromSalad I've spent some time testing and this prompt works 99% of the time:

Instructions: You are a chatbot that has access to the web. Use the given web results above to write an easy-to-read and straightforward response. Make sure to cite results using [[number(URL)]. Make sure each website has its own section. All I want you to do is summarize the given web results. Don't say "sure" or anything like that. Just get to the point. Don't forget to cite the results with [[number(URL)]

Query: Teletubbies

Make sure that you replace the query with whatever the user asks, and add the current date and time to the end of the chat. Also for this to work make sure to give ChatGPT the URL of the website for each section.

Ok, thank you very much, will use!

LuckyHead11 commented 1 year ago

@NymdaFromSalad @acheong08 Should I be concerned?: Screenshot 2023-03-05 114420

NymdaFromSalad commented 1 year ago

@NymdaFromSalad @acheong08 Should I be concerned?: Screenshot 2023-03-05 114420

That's what we call in the industry "good enough"

LuckyHead11 commented 1 year ago

@NymdaFromSalad any progress?

NymdaFromSalad commented 1 year ago

@NymdaFromSalad any progress?

On v3? Haven't looked yet, i have some personal matters to attend to. Will look, when done, hopefully won't take me too long

qunash commented 1 year ago

Hey everyone. Glad you liked the idea of WebChatGPT extension. @noseon I'd very much appreciate if you didn't put additional load on my backend server. I plan to sunset it anyway, so relying on it is not the best option.

I've made the backend repo public: https://github.com/qunash/ddg-webapp. It's just a thin wrapper around the duckduckgo-search Python package. You can use it directly instead.

NymdaFromSalad commented 1 year ago

Hey everyone. Glad you liked the idea of WebChatGPT extension. @noseon I'd very much appreciate if you didn't put additional load on my backend server. I plan to sunset it anyway, so relying on it is not the best option.

I've made the backend repo public: https://github.com/qunash/ddg-webapp. It's just a thin wrapper around the duckduckgo-search Python package. You can use it directly instead.

Hi, yea, i figured that out myself. Not sure, why you haven't made it public earlier. Will also make V3 use ddg instead soon

(For context, i made WebGPT submodule, noseon - the V3 implementation)

acheong08 commented 1 year ago
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/acheong/.local/lib/python3.10/site-packages/revChatGPT/WebGPT.py", line 347, in <module>
    main(V1.configure())
  File "/home/acheong/.local/lib/python3.10/site-packages/revChatGPT/V1.py", line 55, in wrapper
    out = func(*args, **kwargs)
  File "/home/acheong/.local/lib/python3.10/site-packages/revChatGPT/WebGPT.py", line 325, in main
    for data in chatbot.webAsk(prompt):
  File "/home/acheong/.local/lib/python3.10/site-packages/revChatGPT/WebGPT.py", line 90, in webAsk
    webPrompt, headers = webify(
  File "/home/acheong/.local/lib/python3.10/site-packages/revChatGPT/WebGPT.py", line 48, in webify
    searchResults = ddg(query, numResults, timePeriod, region)
  File "/home/acheong/.local/lib/python3.10/site-packages/duckduckgo_search/ddg.py", line 80, in ddg
    "p": safesearch_base[safesearch.capitalize()],
KeyError: ''
acheong08 commented 1 year ago

@NymdaFromSalad any progress?

On v3? Haven't looked yet, i have some personal matters to attend to. Will look, when done, hopefully won't take me too long

V3 already has web searching implemented

acheong08 commented 1 year ago

(For context, i made WebGPT submodule, noseon - the V3 implementation)

I made the V3 implementation, not noseon

acheong08 commented 1 year ago

@qunash I already stated previously that I would not use third party APIs. I made my own in Go and am using my own server. Don't worry about us abusing your service

acheong08 commented 1 year ago

Will also make V3 use ddg instead soon

It already uses DDG