AdvancedAI & Machine LearningPython · JavaScript
Gemini API Chatbot¶
Command-line chatbots for Google's Gemini API, implemented in both Python and Node.js. This module demonstrates how to integrate a hosted large language model into a simple interactive application.
External API: This utility calls the Gemini API for chat responses. A network connection and a valid API key are required. All surrounding logic runs locally.
Files¶
| File | Description |
|---|---|
chatbot.py |
Python CLI chatbot using the Gemini API |
chatbot.js |
Node.js CLI chatbot using the Gemini API |
requirements.txt |
Python dependencies |
package.json |
Node.js dependencies |
Requirements¶
- Python: 3.9+
- Node.js: v18+
- A Gemini API key from Google AI Studio
The default model is gemini-2.5-flash, chosen for low latency and high throughput.
Setup¶
- Install dependencies:
- Provide your API key via a
.envfile (recommended over hardcoding): - Python — load it at startup:
- Node.js — load it at startup:
Usage¶
Type a message and press Enter to chat. Type exit to quit.
Security¶
Never commit or share your API key. Always load credentials from environment variables or a .env file, and keep that file out of version control.
References¶
License¶
MIT
Continue in AI & Machine Learning¶
-
An all-in-one learning hub that delivers progressive Python lessons through both a guided CLI and a hostable Flask web interface. Lessons combine narrative walkthroughs, executable code examples, mini quizzes, and follow-up practice ideas geared toward aspiring quantitative developers.
-
Machine Learning - Feature Engineering
The dirty secret of quant machine learning: the model is rarely the bottleneck.
-
Machine Learning - Gradient Descent
Gradient descent is the engine inside almost every model that learns. The idea
-
Machine Learning - K-Means Clustering
Given a few hundred stocks and their return characteristics, which ones behave
-
Machine Learning - Logistic Regression
Linear regression predicts a number. Logistic regression predicts a
-
Machine Learning - Random Forest
This module provides a basic implementation of a Random Forest Predictor for quantitative finance. It uses scikit-learn's
RandomForestRegressorto predict time series data or returns based on a set of features.