Chatbot with ChatGPT
Made by shiftEscape
Deploy customizable chatbots using ChatGPT API and Cloud Firestore.
- Works with
- Cloud Firestore
- Version
- 0.1.2 | Source code
- Tags
- ai, chatgpt, chatbot-api, generative-ai, text-ai, language-ai, large-language-models, conversational-ai, llm, nlp, open-ai
- License
- Apache-2.0
- Publisher
- shiftEscape
- Report
- Bug
- Abuse
How this extension works
Use this extension to facilitate a basic deployment of a chatbot powered by OpenAI’s Chat Completion API via this NPM package, with prompts and responses maintained and managed via Cloud Firestore.
💡 This extension will listen to the specified collection path for new message documents.
Upon installation, you’ll be prompted a list configuration parameters to customize your Chatbot implementation.
Your prompt
might look like this:
{
prompt: “Please explain the Big Bag Theory to a five year-old”,
parentMessageId: "(Optional) Message ID coming from API to track conversations"
}
Additional Setup:
Before installing this extension, make sure you have:
Your own
OpenAI API Key
(you can get it from here).Set up the following Firebase services in your Firebase project:
2.1. Cloud Firestore to store prompts and AI responses.
Follow the steps in the documentation to create a Cloud Firestore database.
Billing
To install an extension, your project must be on the Blaze (pay as you go) plan
You will be charged a small amount (typically around $0.01/month) for the Firebase resources required by this extension (even if it is not used).
This extension uses other Firebase and Google Cloud Platform services, which have associated charges if you exceed the service’s no-cost tier:
- Cloud Firestore
- Cloud Functions (Node.js >=18 runtime. See FAQs)
This extension also uses the following third-party services:
- OpenAI ChatGPT (pricing information)
When you use Firebase Extensions, you’re only charged for the underlying resources that you use. A paid-tier billing plan is only required if the extension uses a service that requires a paid-tier plan, for example calling to a Google Cloud Platform API or making outbound network requests to non-Google services. All Firebase services offer a free tier of usage. Learn more about Firebase billing.
Configuration Parameters
Collection Path
: Path to a Cloud Firestore collection which will represent a discussion with OpenAI’s ChatGPT.Prompt Field
: The field in the message document that contains the prompt. (Default:prompt
)Response Field
: The field in the message document into which to put the response. (Default:response
System Message
: The default message that acts as an instruction for the model, ensuring it responds appropriately to the your queries.Cloud Functions Location
: Where do you want to deploy the functions created for this extension? For help selecting a location, refer to the location selection guide.Language Model
: Which languagemodel
do you want to use? Refer to OpenAI’s Model Reference.Temperature
: What samplingtemperature
to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. Learn more here.Nucleus Sampling Probability
: An alternative to sampling with temperature, callednucleus sampling
, where the model considers the results of the tokens withtop_p
probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. Learn more here.
Cloud Functions
generateAIResponse()
: Listens to Firestore data writes to generate conversations.
Access Required
This extension will operate with the following project IAM
roles:
datastore.user
(Reason: Allows this extension to access Cloud Firestore to read and process generated messages.)