Build your First AI application with Firebase Genkit πŸš€(Part 2)

Satyam Gondhale
Nerd For Tech
Published in
3 min readNov 25, 2024
Image from Google Source

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,

  1. A Node.js CLI for Command Line Operations
  2. A local web app, called the Developer UI, that interfaces with your Genkit configuration for interactive testing and development

Command Line Interface (CLI)

  1. 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.

--

--

Nerd For Tech
Nerd For Tech

Published in Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Satyam Gondhale
Satyam Gondhale

Written by Satyam Gondhale

Associate Consultant (Globallogic)

No responses yet