This project is a Python backend service that runs on Google Cloud Functions. It utilizes ChatGPT to provide custom knowledge-based querying by reading an index.json
file from Firebase Storage and using it as a Llama index for generating responses.
- Reads
index.json
file from Firebase Storage and uses it as a Llama index - Provides custom knowledge-based querying powered by ChatGPT
- Accepts
input_text
as an API parameter and generates a relevant response along with the source of the information
This project is designed to be deployed as a Google Cloud Function. Follow the official Google Cloud Functions documentation to set up and deploy the function.
Deploy using script below in the command line:
gcloud functions deploy hello_world --runtime python310 --trigger-http --allow-unauthenticated --entry-point hello_world --source . --set-env-vars OPENAI_API_KEY=YOUR_SECRET_KEY --memory 1024MB
Change YOUR_SECRET_KEY to your own OpenAI secret key
- A Google Cloud account with billing enabled
- Firebase Storage configured with an
index.json
file - Google Cloud SDK installed on your local machine
- OpenAI API key
- Clone this repository.
- Install the required dependencies with
pip install -r requirements.txt
. - Set the
OPENAI_API_KEY
environment variable in your Google Cloud Function configuration. - Configure the
storageBucket
option infirebase_admin.initialize_app()
to match your Firebase Storage bucket. - Deploy the function to Google Cloud Functions following their documentation.
Make a GET request to the deployed Cloud Function with an input_text
query parameter. The response will be a JSON object containing a generated response and the source of the information.
GET https://<your-cloud-function-url>/hello_world?input_text=<your-query-text>
Fork the project. Create a new branch (git checkout -b feature_branch). Commit your changes (git commit -am 'Add a new feature'). Push to the branch (git push origin feature_branch). Create a new Pull Request.
This project is licensed under the MIT License.