https://github.com/tanmayvaij/diagem-cli-bot
A minimal TypeScript CLI chatbot built using the diaflow-gemini SDK. This example demonstrates how to connect to Google Gemini 2.0 Flash via DiaFlow and interact through your terminal.
https://github.com/tanmayvaij/diagem-cli-bot
ai ai-agents demo diaflow framework gemini
Last synced: 3 months ago
JSON representation
A minimal TypeScript CLI chatbot built using the diaflow-gemini SDK. This example demonstrates how to connect to Google Gemini 2.0 Flash via DiaFlow and interact through your terminal.
- Host: GitHub
- URL: https://github.com/tanmayvaij/diagem-cli-bot
- Owner: tanmayvaij
- Created: 2025-11-04T10:35:39.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-11-04T10:38:31.000Z (5 months ago)
- Last Synced: 2025-11-04T12:19:48.011Z (5 months ago)
- Topics: ai, ai-agents, demo, diaflow, framework, gemini
- Language: TypeScript
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# π§ DiaGem CLI Bot
A **minimal TypeScript CLI chatbot** built using the [`diaflow-gemini`](https://www.npmjs.com/package/diaflow-gemini) SDK.
This example demonstrates how to connect to **Google Gemini 2.0 Flash** via DiaFlow and interact through your terminal.
---
## π Features
- β‘ Minimal setup β less than 50 lines of code
- π¬ Interactive terminal chat (type & get instant responses)
- π Secure API key loading via `.env`
- π§© Built with modern TypeScript and Node 22+
---
## π οΈ Setup
### 1οΈβ£ Clone this repo
```bash
git clone https://github.com/tanmayvaij/diagem-cli-bot.git
cd diagem-cli-bot
````
### 2οΈβ£ Install dependencies
```bash
npm install
```
### 3οΈβ£ Configure your Gemini API key
Copy the example file and edit it:
```bash
cp .env.example .env
```
Then open `.env` and paste your Gemini API key:
```
GEMINI_API_KEY=your_api_key_here
```
You can get a key from the [Google AI Studio Console](https://aistudio.google.com/).
---
## π» Run the bot
Run with `tsx`:
```bash
npx tsx main.ts
```
Example session:
```
USER : hi
AI : Hello! How can I help you today?
USER : write a haiku about TypeScript
AI : Static types sing loud,
JavaScriptβs calm evolution,
Errors fade away.
```
Type `exit` to quit the session.
---
## π§© Project Structure
```
diagem-cli-bot/
βββ .env.example # Template for API key
βββ main.ts # Core CLI logic
βββ package.json # Dependencies & metadata
βββ README.md # You're reading it!
```
---
## π§ How It Works
1. Loads your API key from `.env`
2. Initializes a `diaflow-gemini` Agent with Gemini 2.0 Flash
3. Opens a readline interface to accept user prompts
4. Sends each prompt to the LLM and prints the response
---
## π§° Tech Stack
* Node.js (v22+)
* TypeScript
* diaflow-gemini
* dotenv
* readline/promises
---
## π§ͺ Example Use Cases
* Quick LLM experimentation
* Local chatbot or CLI assistant
* Base for plugin-style terminal tools
* Teaching resource for `diaflow-gemini` SDK
---
## π License
MIT Β© [Tanmay Vaij](https://github.com/tanmayvaij)
---
### β If you find this helpful, consider starring the repo!