Skip to content

A Cloudflare Worker using Google Programmable Search API and analyzing the results via a OpenAI GPT

Notifications You must be signed in to change notification settings

mrpapawheelie/gse-cf-openapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom Google Search API for your own ChatGPT

Disclaimer: Although most of this setup is free, you need a premium ChatGPT account to create the plugin as far as I know. This may change in the future, so double check

This Cloudflare Worker leverages OpenAPI 3.1 and itty-router-openapi to create a powerful and efficient interface for Google Programmable Search designed to work with your own custom GPT action. Designed for rapid development and deployment, this example project serves as an ideal starting point for developers looking to integrate Google's search capabilities into their applications with the scalability and reliability of Cloudflare Workers.

The openapi and swagger docs give you the freedom to use this functionality in whatever app you choose, not just GPT.

By automatically generating the openapi.json schema from your code and validating incoming requests against defined parameters, this project simplifies the process of creating an OpenAPI-compliant interface for web search functionalities. Whether you're building an internal tool or a customer-facing application, this worker provides a robust foundation for your search-related features.

Demo

Get started

  1. Sign up for Cloudflare Workers. The free tier is sufficient for most use cases.
  2. Clone this project.
  3. Install dependencies:

Installation Instructions

Choose one of the following package managers to install dependencies:

Yarn

yarn

Bun

bun install

NPM

npm install

PNPM

pnpm install

Update Info

Update the contact info to your information at src/index.ts

Update the server url to your Cloudflare url after deploying in src/index.ts

Local Development

Authenticate Cloudflare

npx wrangler login

Store Secrets

Setup a Google Programmable Search at: https://programmablesearchengine.google.com/

Get your Google Programmable Search ID from the overview page

npx wrangler secret put SEARCH_ENGINE_ID

Get an API Key from Google for GSE at: https://developers.google.com/custom-search/v1/introduction and run

npx wrangler secret put GSE_API_KEY

Ship It!

npx wrangler deploy

Visit the URL given to you in command line once it's deployed to view the OpenAPI swagger tool.

test it out from page.

Creating a GPT with your New API Interactive How-to Demo

Watch Now

About

A Cloudflare Worker using Google Programmable Search API and analyzing the results via a OpenAI GPT

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published