Giter VIP home page Giter VIP logo

chatgpt-plugins-tutorial's Introduction

ChatGPT Plugins Tutorial

This is a FastAPI-based project that demonstrates how to create your own contextual Q&A chatgpt plugin. The application can be deployed to Google Cloud Run.

Prerequisites

  • Python 3.9
  • Google Cloud SDK

Project Structure

  • main.py: The FastAPI application file.
  • Dockerfile: Docker configuration file to build the application container.
  • requirements.txt: Lists the required Python packages.
  • README.md: This file, which explains the project setup and deployment.

Setup

  1. Clone the project to your local machine.
  2. Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate  # On Windows: .\venv\Scripts\activate
  1. Install the required packages:
pip install -r requirements.txt

Run the Application Locally

Start the FastAPI application:

  1. Set the environment variables:
# windows
setx PINECONE_API_KEY your_pinecone_api_key
setx PINECONE_ENVIRONMENT your_pinecone_environment
setx OPENAI_API_KEY your_openai_api_key

# mac, linux
export PINECONE_API_KEY=your_pinecone_api_key
export PINECONE_ENVIRONMENT=your_pinecone_environment
export OPENAI_API_KEY=your_openai_api_key
  1. Start the FastAPI application:
python main.py

Deploy the Application to Google Cloud Run

  1. Authenticate with your Google account:
gcloud auth login
  1. Build the Docker image in the cloud:
gcloud builds submit --tag gcr.io/your-project-id/fastapi-app

Replace your-project-id with your Google Cloud project ID.

  1. Deploy the Docker image to Cloud Run:
# windows
gcloud run deploy fastapi-app --image gcr.io/your-project-id/fastapi-app --platform managed --region your-region --allow-unauthenticated --set-env-vars="PINECONE_API_KEY=your_pinecone_api_key,PINECONE_ENVIRONMENT=your_pinecone_environment,OPENAI_API_KEY=your_openai_api_key"

# mac, linux
gcloud run deploy fastapi-app --image gcr.io/your-project-id/fastapi-app --platform managed --region your-region --allow-unauthenticated --set-env-vars=PINECONE_API_KEY=your_pinecone_api_key,PINECONE_ENVIRONMENT=your_pinecone_environment,OPENAI_API_KEY=your_openai_api_key

Replace your-project-id with your Google Cloud project ID, and your-region with the desired region for your Cloud Run service (e.g., us-central1).

  1. Access the deployed FastAPI application using the URL provided in the output.

chatgpt-plugins-tutorial's People

Contributors

vrsen avatar

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.