This is a basic web app that calls the callVertexWithRC function. The
function uses values stored in Remote Config server templates with
the Firebase Admin SDK to dynamically update Vertex AI Gemini API
parameters. Access is controlled using Firebase App Check.
- Read more about Remote Config for servers.
- Read more about App Check.
- Read more about the Vertex AI Node.js Client library.
Important: Vertex AI and Cloud Functions require a billing account. Review Vertex AI pricing and Firebase pricing before running this function. If you're new to Firebase and Google Cloud, check to see if you're eligible for a $300 credit and a Free Trial Cloud Billing account.
- Create a Firebase project and register a web app.
- Create a ReCAPTCHA Enterprise key in the same project.
- Enable App Check in the Firebase console with the ReCAPTCHA Enterprise site key you created.
- Copy your Firebase project config and your ReCAPTCHA Enterprise site key
into the appropriate places in
config.tsin this directory. - In this directory, run
npm install. - Set up and deploy the function as described in ../README.md.
- In this directory, run
npm run devto run the client.
To run this app against the callVertexWithRC function running in the Firebase
emulator, ensure that testModein main.ts is set to true. Before testing
with a deployed (i.e., not emulated) function, set testMode to false.
TIP: You can build the client and deploy to Firebase Hosting by running
npm run build from the client directory. Hosting deliverables are
generated and saved in client/dist and you can then deploy to
the emulator or Firebase Hosting from the parent directory. We recommend
deploying to the emulator first--you can use the following command to
deploy the function and web client simultaneously:
firebase serve --only functions,hosting
© Google, 2024. Licensed under an Apache-2 license.