You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project is a LINE bot that uses Google's Vertex AI Gemini models through LangChain to generate responses to both text and image inputs. The bot can answer questions in Traditional Chinese and provide detailed descriptions of images.
Screenshot
Features
Text message processing using Gemini AI in Traditional Chinese
Image analysis with scientific detail in Traditional Chinese
Integration with LINE Messaging API for easy mobile access
Built with FastAPI for efficient asynchronous processing
Technologies Used
Python 3
FastAPI
LINE Messaging API
Google Vertex AI (Gemini 2.0 Flash)
LangChain
Aiohttp
PIL (Python Imaging Library)
Setup
Clone the repository to your local machine.
Set up Google Cloud:
Create a Google Cloud project
Enable Vertex AI API
Set up authentication (service account or application default credentials)
Set the following environment variables:
ChannelSecret: Your LINE channel secret
ChannelAccessToken: Your LINE channel access token
GOOGLE_PROJECT_ID: Your Google Cloud Project ID
GOOGLE_LOCATION: Google Cloud region (default: us-central1)
Optional: GOOGLE_APPLICATION_CREDENTIALS: Path to service account key file (if running locally)
Install the required dependencies:
pip install -r requirements.txt
Start the FastAPI server:
uvicorn main:app --reload
Set up your LINE bot webhook URL to point to your server's endpoint.
Usage
Text Processing
Send any text message to the LINE bot, and it will use Vertex AI's Gemini model to generate a response in Traditional Chinese.
Image Processing
Send an image to the bot, and it will analyze and describe the image with scientific detail in Traditional Chinese.
Deployment Options
Local Development
Use ngrok or similar tools to expose your local server to the internet for webhook access:
Google Cloud Run
Install the Google Cloud SDK and authenticate with your Google Cloud account.