#SearchGPT

374 messages · Page 1 of 1 (latest)

topaz linden
#

I've been working on a way to integrate Search Engines (google specifically), and GPT-3 into a single product to search the internet & relay answers in an easy to use way (similar to Bing's new ChatGPT type chatbot)

Basically, you can ask it a question, and it decides what actions to take ("Commands"), then calls them, and their response is used it it's generating of the final content.

This means that all information is about as up to date as it can be, and is as good as you can get without actually visiting any websites from google.
https://github.com/perrys25/SearchGPT

Demo:

https://colab.research.google.com/gist/perrys25/195fd36b6986025e7711b55189cae9b9/searchgpt-demo.ipynb

  1. Run the top two sections in order, wait for them to complete
  2. Run the third section (make sure output is shown)
  3. Paste in your OpenAI API key
  4. Ask away!

Web Demo:

https://searchgpt.perrysahnow.com/

https://media.discordapp.net/attachments/1077044323008397433/1082041503976800409/clipboard_2KrD9qILAIeUHaS1.png

#

The above image is just a CLI implementation (examples/cli), but it could totally be put in a web interface or something similar!

untold widget
#

As someone who doesn’t code or understand code how can I try this out?

topaz linden
#

Working on that- I gotta figure out how to do it safely first though

#

Maybe I'll set it up on Google colab

topaz linden
#

Run the first one and two

#

then the third one (make sure to expand the "Run the CLI" one)

#

and you'll need an OpenAI API token

#

which it should ask for

#

And if the CLI terminal thing is empty, just stop it and restart it, that happened to me a few times

topaz linden
#

That colab is having some issues right now since they're hosted in france, so it returns google results in french, and has special data laws. give me a bit to fix it

untold widget
#

Okay

vital dirge
#

hi

topaz linden
#

I got it working (I think?)

#

Just run the first two in order

#

then do the last one, enter your key, and get talking

topaz linden
#

Lmk how it works for you

untold widget
#

It works well. The answers are quite short though. Haven’t done any heavy testing yet

topaz linden
slender token
#

Is this with GPT-3 api?

topaz linden
#

mhm

slender token
#

I’ll definitely check this out later

untold widget
tender night
#

When this will be ready ?

topaz linden
#

Wdym ready? It's currently working

lone crest
#

@topaz linden Looks cool. Not working for me tho in Colabs... Getting:
/content/SearchGPT
Traceback (most recent call last):
File "examples/cli.py", line 1, in <module>
from SearchGPT.ChatBot import *
File "<frozen zipimport>", line 259, in load_module
File "/usr/local/lib/python3.8/dist-packages/SearchGPT-0.1-py3.8.egg/SearchGPT/ChatBot.py", line 1, in <module>
ModuleNotFoundError: No module named 'openai'

Ran on my PC CLI and get error:
ModuleNotFoundError: No module named 'SearchGPT'

topaz linden
#

As for the colab, my fault, I renamed the requirements file. Should work now

#

Yup ^^ testing now, seems to build fine. The colab works well now

#

Or not... now it's erroring

#

Come on colab

topaz linden
#

Okay, now it works

lone crest
#

lol ok. I will try it out.
On local PC I just used conda to create a venv but all I did was python run.py, not install will try again later. Thanks for getting back!

topaz linden
#

I'm new to python package management though

sudden ermine
#

Custom login and Intent handling could do this no?

digital cedar
topaz linden
#

Yup, I plan to do that someday, I just need to decide how I want to go about scraping google

digital cedar
topaz linden
#

For searchgpt

digital cedar
#

oh!

topaz linden
#

It does it as is from the client

#

But if I did it a ton from one server

#

Ot might be an issue

digital cedar
digital cedar
#

Okay the entire thing don't work again.. Started with step 1 and didn't execute anything. One hour ago it worked.

My fix:

digital cedar
#

First, click the menu at the top left besides the RAM view, then click Active Sessions.

#

Then click terminate to stop the errant session.

#

Get back to the same menu as first step, then click "Connect to a hosted runtime" and start again at Install Chrome

topaz linden
main vine
#

Good work @topaz linden . You don’t need to scrape google. I have something to share easy way. DM me.

#

I see someone did this a extension. Can anyone make it a web application with react js?

topaz linden
#

I plan to make it a webapp since I know react, just gotta get around to it 🙂

#

And that extension is something different, just has the same name

digital cedar
#

@main vine I'm not a developer, only an enthusiast so I do not write scripts

topaz linden
#

I'm working on a web interface for it; should be done soon

digital cedar
#

Excited to see the update!

topaz linden
#

Here's my attempt at a quick-and-dirty hosted version.
https://searchgpt.perrysahnow.com/
I am planning to make it not look ugly, but the colors are currently there for my sake developing, and I'm too tired to swap 'em out right now.
It connects to a small VPS I have set up on oracle cloud. I'd consider it pretty secure, but still please use an API key you don't use for other things, and delete it after you've used it there, as I would prefer dumb things don't happen. In the next week or so I'll clean stuff up and make it more usable & secure

#

Paste in your API key, and just ask it anything ^^

#

cc: @digital cedar

#

And here's a screenshot of my amazing UI. The "Open" at the top is basically just a debug message about if the websocket connection is open (Yes, I know it's ugly, read the above message, I'll change it in the future)

digital cedar
topaz linden
#

Thank you for the feedback! When I polish things, I'll make sure to do that

digital cedar
#

Sure

#

Oh before I forget, if someone might have consumed the tokens they have, they should be reminded of that. While in the middle of a prompt I made, the app stopped sending responses. It's token limits that make it not send new responses.
The Colab version notifies you of this. But not the new web frontend

topaz linden
#

👍

topaz linden
topaz linden
#

I just pushed a commit that makes it look less awful, and work a bit better. Actual error & update functionality will come soon

#

(The page is building now, should be public in less than 10 minutes)

topaz linden
topaz linden
#

and there's dark mode

digital cedar
topaz linden
#

Oh sure I can add that, I didn't even think of that as an option

unique surge
#

This is awesome. I've developed a similar app, but for a Discord bot. It's also using Google APi. One thing I would recommend is that it would be great if the sources could be provided as well, like how Bing works.

topaz linden
#

And I also unfortunately have my format conflicting with the markdown URL format

#

[s' are used for formatting user vs assistant, etc

topaz linden
sweet grail
#

Sir, I want to ask a question. Have you done it by yourself?

unique surge
topaz linden
#

Ah interesting. How did that work for you? I went the alternate route of scraping google

unique surge
#

So far, it's just like scraping too. I get the text from URLs and feed that to gpt3.5 turbo as the basis for facts. Also, I added those URLs to the prompt to have sources in the response.

topaz linden
#

I should do that & add citing, I just need to get around to it

#

Oh, and switching to turbo. Not sure how I want to approach it, but it needs to happen

fickle spire
#

embeddings

tacit cloak
#

@topaz linden If you want to use something other than google to get answers, you can try DuckDuckGo:

from duckduckgo_search import ddg

def ddg_search(query: str, numResults: int, region: str=None, time_period=None):
    try:
        results = ddg(query, region, 'on', time_period, numResults)
    except Exception as e:
        print(e)
        return failed_ddg_search(query)
    
    if results == None:
        return failed_ddg_search(query)

    return pd.DataFrame(results)

Try this out.

topaz linden
#

Thanks!

#

FYI the site is down rn, since I'm having issues with python environments

tacit cloak
#

pip install duckduckgo-search

If you are wondering.

topaz linden
#

cool. Right now I have ChatGPT summarizing google for me for the info boxes, but that looks like it might be useful too, especially in combo with google

tacit cloak
topaz linden
#

ah interesting

unique surge
tacit cloak
#

@topaz linden I also wanted to ask. Does GPT sometimes outputs something that is out of what you directed it to output with your prompt? I was testing LangChain Agents the other day, and the amount of times GPT tried to use a tool that didn't exist was staggering.

I saw you have your own implementation of an agent, that's why I want to know if the way you did it is consistent.

topaz linden
#

I've only ever seen it once

#

and it errored out

#

besides that though, it's never tried something else

#

I bet with prompt manipulation you could do it though

#

Unrelated: To anyone trying to use the demo, Python package management is so awful, I'm gonna give up for the night. I have no idea how I had it working before, but now nothing I try to do gets everything to work right, so I'll need to give it another shot sometime this week or next

tacit cloak
tacit cloak
topaz linden
#

The issue is with getting all the packages to install correctly (Which I think I have working?) but now it's just crashing over and over again, and hanging at random times

#

it might just be due to being on an underpowered VPS, I'm not sure

#

(Ram requirements for Chromium & google scraping are high I presume)

tacit cloak
#

I'm not sure why you are using Chromium for web scraping. Isn't BeautifulSoup enough?

oblique beacon
#

Depends on what you're trying to do

topaz linden
#

I need to execute client-side javascript

#

well, I don't need to
but it makes it way easier

oblique beacon
#

wait nvm

#

ah I see

topaz linden
#
        self.driver.execute_script(
            "[...document.getElementsByTagName('cite')].map(cite => { cite.innerHTML = cite.parentElement.parentElement.parentElement.parentElement.href; return cite.parentElement.parentElement.parentElement.parentElement.href})")
        answer = self.driver.execute_script(
            "return [...document.querySelectorAll(arguments[0])].filter(a => a.textContent === arguments[1])[0].parentElement.parentElement.innerText.substring(arguments[2], arguments[3])",
            "h1", "Search Results", 0, 5000)
oblique beacon
#

ah

topaz linden
#

it formats it in a way that GPT-3 can parse into a summary

main vine
#

Good work @topaz linden. If anyone need any support on cloud credits, let me know. I have $10k left with aws. expires soon

main vine
#

Can someone summarise what this app is doing. I see lot of threads. Can I search for “what latest updates from Elon Musk”. Does it scrape the google results and feed do the model, to show the output.
Looks like it’s doing scraping google and feeding to the model. Is google scraping a viable option, with so much of blocking and using proxies.

digital cedar
#

Maybe I can use them for the meantime

topaz linden
topaz linden
#

Those terms are then scraped from Google, and fed back into the model to determine an output

unique surge
ashen turtle
#

I can't get the SearchGPT webdemo to work. It just says the status is unable to connect even when I put my API key in. I know my API key is valid because its the same ones I use in my projects

main vine
main vine
quasi kettle
#

hi

digital cedar
#

.. Brethren you can't tell stories here, use the chat in connection with the app in question

digital cedar
topaz linden
#

Anyone here done Multithreaded websocket stuff in python?

topaz linden
#

For getting the websocket based SearchGPT server running for the demo site

#

When one connects it seems to lock others out

#

Using the async websocket library

#

Is there a better alternative?

ember spoke
topaz linden
#

And hopefully more bug-free?

#

Let me know how it works for y'all, should work better as a demo ^^

topaz linden
#

Oh, apparently the notebook linked on github (not the website) is out of date, I'll get that one fixed in the morning ^^

digital cedar
#

The typing area gets disabled when searching.

digital cedar
#

You could also have a token counter.

digital cedar
#

Unknown Error: Message: javascript error: Cannot read properties of undefined (reading 'parentElement') (Session info: headless chrome=xxx.x.xxxx.xx) Stacktrace: #0 0x55ae83e6a243 <unknown>

topaz linden
#

Wierd

#

I never ran into that once

topaz linden
digital cedar
#

Understandable

digital cedar
#

"Can you list names of employees of a certain company?"

Followup: <name of company>

topaz linden
#

Hm interesting, I will check that out

#

It's to do with my JS thing meant for sources, so I'll just remove that for now

halcyon peak
topaz linden
#

Hm wierd

#

It's unfortunately more chat focused than GPT-3

#

I need to get it to be better at generating keywords

topaz linden
topaz linden
#

SearchGPT now supports GPT-4.0 in the model drop-down menu (It should only show for those that have access to GPT-4.0)
It also has a live token counter, so you can do the math about how much it costs you (Hint: gpt-3.5 is far cheaper)

oblique beacon
#

you have access to gpt-4 api?

#

i see

digital cedar
#

But...Colab thing has errors

topaz linden
oblique beacon
#

nice I see

unique surge
#

gpt4 is expensive 🥲

digital cedar
#

Even using the current SearchGPT setup.

#

Every answer sent to the API already costs around 350 tokens. Is it possible for the prompt to cost lower tokens per message?

topaz linden
#

Unfortunately that's just how long the prompt is

#

If you''d like to help shorten it, it's open source!

silent stag
#

how are you scraping the web

#

I mean doesn't it get your IP blocked

#

I am making a college sem project with mern stack

#

I have built the chatbot but I want to have this real time internet feature

#

so if you have any guide or advice that will be very helpful sir

topaz linden
#

You could just use the API for SearchGPT, but besides that just check out SearchCommand.py

#

It literally uses a browser, gets all the text, and asks gpt to summarize it

silent stag
#

I tried it

#

with the js

#

but it is giving me error

silent stag
#

it is a college project so for now I don't have a huge usage so that is not a problem

topaz linden
silent stag
topaz linden
#

What error?

silent stag
#

as I am new I tried to put your searchCommand into chatgpt to understand it

#

that is also down

#

🙂

silent stag
#

it is not running at all

topaz linden
#

Do you have chrome & a chromedriver installed?

silent stag
#

I have installed

#

selenium webdriver

#

chrome driver

#

and chrome installed

#

first time it ran

topaz linden
#

Well without the error, I unfortunately can't help much

silent stag
#

with the search what is the capital of paris

silent stag
#

should I just use your py as a nodejs implementation?

#

oh yes I was looking for element h3 but it is saying no accessable element

#

then I deleted that part and trying to write it again

topaz linden
#

Google renders itself totally different to different people, so you'll need to play with that JS to see how to select all of the content for yourself

silent stag
#

oh

#

and is it gonna blacklist my ip?

#

After I write the code I will give it to you to check it once

topaz linden
#

I truly have no idea. I have yet to be blacklisted, but I make no promises

silent stag
#

how much request you do?

#

I mean in a minute?

topaz linden
#

Not too many, 4 or 5 max

silent stag
#

Your project is awesome

silent stag
#

mean the browser

topaz linden
#

Yeah

silent stag
#

do I need to do that?

#

i mean it is locally

topaz linden
#

Yup, selenium opens a browser for you

silent stag
#

so if I made it in production and some user use it it will open in their browser

#

gotcha

topaz linden
#

Not in their browser

#

But a server-side browser

silent stag
#

but my question is

#

if I have 10 users

#

and they are requesting at the same time

#

is it gonna have a bad impact in my ip or the server ip

topaz linden
#

I have no idea unfortunately

silent stag
#

ok

#

thanks btw

topaz linden
#

No worries!

silent stag
#

I will disturb you again if I got any problem

#

😅

silent stag
#

I mean I can msg you later on?

topaz linden
#

Just send a message, and I'll see

silent stag
#

ok

#

is it required?

trim runeBOT
#
Veuillez parler en anglais.

@jade lintel, your message was removed. We do not currently have capacity to support other languages.

silent stag
#

sir I am getting a hard time finding the selector

#

how can I do that?

topaz linden
topaz linden
silent stag
#

I at last get an answer where I get the answer from the sidebar

#

I mean knowledge graph bar

#

but all question don't have that sidebar

#

so what is the best way to get the content

#

any brief idea??

#

I mean like click any website or from dropdown or from where

#

like some of that

topaz linden
#

I have not implemented visiting websites yet for safety concerns unfortunately

silent stag
#

so are you getting that from just the link and context?

#

i mean that link title and description?

topaz linden
#

just from google, yup

silent stag
#

ok

#

so you get the link and description send them to the gpt to summarize and generate and answer?

#

got it correct?

topaz linden
#

basically, yup

silent stag
#

okkk

#

but if they dont have the answer in the description then what?

#

it can't give you a proper answer

topaz linden
#

yup, that happens sometimes

#

it's imperfect

silent stag
#

now I am getting it

#

thanks I will work in it

silent stag
#

it works fine

topaz linden
#

Nice!

silent stag
#

now I want to know that how much should I use it?

silent stag
#

also have some eye on ui ux so if you ever need any help

#

I am here

topaz linden
silent stag
#

i mean what is the limitation?

topaz linden
#

I don't know unfortunately

silent stag
# topaz linden Nice!

now I can modify it to also send some refernence links to give to the user yeah exciting

silent stag
#

do you have rate limit after one query?

#

cause a user of yours can call so much in a minute

topaz linden
#

I have some limits in place that aren't in the repo, but I'd prefer not to share them as they could let people figure out how to abuse the public instance

silent stag
#

oh in DM?

silent stag
topaz linden
silent stag
#

not a problem don't be sorry you and your repo helped me a lot

#

following this project from 20 days but didn't have the courage to ask you

#

thanks

#

i think there are not many people who did this in javascript

silent stag
silent stag
#

or any other method?

silent stag
#

is it free?

#

if you can tell me where can I access the api and what is some details

#

I took a look at google but as you have used it, that will be better to know directly from you

unique surge
#

You'll have to sign up for an account. I think you'll get $100 free credits to use as a trial. For now, I've swiched to bing search api, which I think is more reliable

silent stag
#

oh

#

bing search api

#

is it free?

#

cause I don't wanna go paid now

silent stag
#

its like

#

[search] { what is the capital of Paris}

#

this is the format I need to write in your input?

#

can't you do that by any toggle button?

topaz linden
#

you ask the question, and the AI searches based on that

silent stag
#

so I have normal gpt-turbo and the search

#

how it will know what I am asking

#

let assume I am asking

#

write an articles about someone

#

will is search on google or generate an article by chatgpt api?

topaz linden
#

the way mine works is it actually decides to search or write something

silent stag
#

oh wow

#

is it you or gpt-3 decides on its own?

#

if I don't want that is it a good way to implement a toggle on off button for

#

normal generation or google search

#

or it should be integrating both?

unique surge
# silent stag is it free?

There's a free tier as long as you limit your requests to 1000 request/month, I believe. Above that, you'll have to pay.

topaz linden
silent stag
topaz linden
#

The site now fully supports being a PWA and being installed on your phone through modern browsers, and also doesn't do that annoying thing where it flashes light mode quickly before going to dark mode 🙂

https://searchgpt.perrysahnow.com/

silent stag
#

ok

silent stag
topaz linden
silent stag
#

acha how did you get the status of openai

#

you have a red and green signal how did you do it?

topaz linden
#

Nah that's the status of my server

#

Just a websocket connection state

digital cedar
#

The web socket gets disconnected easily. I was waiting for the response after writing a question and here comes the "Unable to Connect" issue. It's consuming my tokens more and more on the web site.

Still better in the Colab if it were fixed

topaz linden
#

Hm interesting. I'll get the colab version up soon™️, and allow reconnecting to lost sessions

silent stag
#

some people I asked they don't seem to care about answering, so thanks for your time sir

topaz linden
#

No worries!

digital cedar
silent stag
#

are you using react as frontend and python as a backend?

#

if yes what python framework, flask?

topaz linden
#

I'm just using some generic websocket framework for python

#

But yes React frontend, Python backend

topaz linden
silent stag
#

should I migrate to flask

#

as I am new to the python cause this project in JavaScript has so many limitations

topaz linden
#

I unfortunately know very little about python

#

I only used it here for the sake of trying python out

#

So I've never used flask, or anything of that nature

silent stag
#

ohh

#

I see, okay

topaz linden
#

Has the site still been disconnecting people recently?

digital cedar
#

Me, yes

#

By disconnecting, people can't see message history

topaz linden
#

Yup, I was testing a small server-side change, but I'll actually implement reconnecting now

north shard
#

Hey thats really cool - have you considered adding voice to it?

topaz linden
ruby basalt
#

Trying to activate Ai as audio. Do you have a recommended WP plugin to use?

#

For Chatgpt