Build your First AI application with Firebase Genkit π(Part 2)
Now, we are already aware what Firebase Genkit is & How to run a basic Firebase Genkit Appπ₯³
If you are still new to Firebase Genkit, feel free to check (Part 1)
Build your First AI application with Firebase Genkit π(Part 1)
To get started with additional Genkit capabilities, we will explore Developer tools & Learn how to set up and use Genkitβs CLI and developer UI to help you locally test and debug your app.
Doesnβt it sound exciting for you ποΈβπ¨ οΈ?
Genkit provides 2 key developer tools,
- A Node.js CLI for Command Line Operations
- A local web app, called the Developer UI, that interfaces with your Genkit configuration for interactive testing and development
Command Line Interface (CLI)
- Install the CLI in your project using
npm install -D genkit-cli
2. You can check the list of available option using below command
npx genkit --help
// Output
Usage: genkit [options] [command]
Firebase Genkit CLI
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
ui:start [options] start the Developer UI which connects to runtimes in the same directory
ui:stop stops any running Genkit Developer UI in this directory
flow:run [options] <flowName> [data] run a flow using provided data as input
flow:batchRun [options] <flowName> <inputFileName> batch run a flow using provided set of data from a file as input
eval:extractData [options] <flowName> extract evaludation data for a given flow from the trace store
eval:run [options] <dataset> evaluate provided dataset against configured evaluators
eval:flow [options] <flowName> [data] evaluate a flow against configured evaluators using provided data as input
config set development environment configuration
start [options] runs a command in Genkit dev mode
help
We already have a main.js file in our project. To run a JavaScript/TypeScript file directly you can use this command
npx genkit start -- node --watch main.js
Genkit Developer UI
You can run this command
npx genkit start
Hurray β¦ π₯³π₯³π₯³ Your Developer UI is in action π₯³π₯³π₯³
NOTE: The Genkit Developer UI requires a runtime (your project) to be running alongside it. If the runtime isnβt detected, this message will persist.
Now, it is expected that the Developer UI is supposed to start your app.
To fix this add this inside our package.json file
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "node main.js"
}
To run the Developer UI with our project run this below command
npx genkit start -- npm run dev
You can see our genkit-app running with Developer UI.
Fantastic.
The Developer UI has action runners for flow
, prompt
, model
, tool
, retriever
, indexer
, embedder
and evaluator
based on the components you will define in your code.
What Next ???
We will Learn how to use Genkitβs unified generation API to generate text and structured data from any supported model.
ππππππππππππππππππππππππππ
Stay Tuned and Keep Watch for Part 3, Happy Learning.
Feel Free to Clap π and Keep me Motivated π to come up with Next Parts.