Giter VIP home page Giter VIP logo

google-chatgpt-plugin's Introduction

Google Search Plugin

A Flask app that uses the Google Custom Search API to search the web and fetch the summary for five first links in the search results as well as inner text of the first three links. The purpose of this app is to be used as a plugin for ChatGPT.

How it works

My.Movie.1.mp4

Requirements

  • Python 3.6+
  • Flask
  • Requests
  • BeautifulSoup4
  • LXML
  • python-dotenv

Installation (Heroku)

Deploy to Heroku with one click by clicking the button below:

Deploy

A Google API Key and a Custom Search Engine ID is required to complete the installation, both of which can be generated here and here.

Once the installation is complete, grab the APP URL and add it to ChatGPT Plugin installation page. To do this, click the "View" button at the bottom of the page, and copy the URL from the address bar.

Installation (Local)

  1. Clone the repository:
git clone https://github.com/Sogody/google-chatgpt-plugin.git

cd google-search-plugin
  1. Create a virtual environment and activate it:
  • On Linux and macOS:

    python3 -m venv venv
    source venv/bin/activate
  • On Windows:

    python -m venv venv
    venv\Scripts\activate
  1. Install the required packages:
pip install -r requirements.txt
  1. Create a .env file in the project directory with the following content:
GOOGLE_API_KEY=your_google_api_key
CUSTOM_SEARCH_ENGINE_ID=your_custom_search_engine_id

Replace your_google_api_key and your_custom_search_engine_id with your actual API key and custom search engine ID.

You can create your Google API KEY in https://console.cloud.google.com/apis/credentials.

You can get your custom search engine id in https://cse.google.com/cse/create/new.

Usage

  1. Run the Flask app:
python main.py
  1. Access the app at http://localhost:5000/.

  2. To search using the Google Custom Search API and fetch the inner text of the first link in the search results, send a GET request to the /search endpoint with the query parameter q:

http://localhost:5000/search?q=your_search_query

Replace your_search_query with your actual search query.

Deploy

For compatibility with ChatGPT, deploy the plugin on a publicly accessible host. Deployment steps vary depending on the platform, however, at the end, you need to enter the domain name (and possibly port if deploying to a non-standard port) at ChatGPT Plugin installation page.

License

MIT

google-chatgpt-plugin's People

Contributors

synim-sogody avatar ttomor 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

google-chatgpt-plugin's Issues

Docker image and docker compose sample

For an easier setup, I'd appreciate it, if a pre-built Docker image would be available (built via GitHub action into the ghcr for example) and a sample docker-compose.yaml be added to this repo.

Message you submitted was too long

I got everything working, but I keep getting the error:

"The message you submitted was too long, please reload the conversation and submit something shorter."

Is there a way to combat this? The full_content is the issue, but not sure how to have ChatGPT use that information as a resource rather adding it to the prompt?

Here are images of the full request and response:

1

2

However I was able to reproduce your demo prompt and the full_content was quite long. hmm..

3

4

Getting "no such app" inside ChatGPT

Really excited about your plugin!

I just got GPT Plugin access last night and wanted to give your project a go!

I installed to Heroku by clicking on the one-click button here.

But after installing the plugin, I'm getting this error:

Xnip2023-05-11_19-09-32

I also do not see a good response when I hit the /search endpoint directly:

Xnip2023-05-11_19-11-20

I'm wondering if there's a bug. Not sure what else I can check.
Please let me know if you need any more info. Thanks!

Error 412

Brilliant idea and seems amazing - however am Unable to read or get any content from sites, although searching is fantastic and it gets them super quickly - no issues otherwise and fetched and manifested plugin properly. Have tried many sites. Bot says “The error message I'm receiving is "Error communicating with plugin: 412". This is a technical error that typically indicates a problem with the request made to the plugin. In this case, it seems to be preventing the Google Custom Search plugin from fetching the requested content” Any insight please?

Custom Search API also needs to be enabled

The plugin was failing for me, I added print(response.text) in the response.status_code == 200 else branch and I saw:

"message": "Custom Search API has not been used in project... and it included a URL for me to visit to enable Custom Search API.

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.