Note
This is the Python code for Gemini in Java with Vertex AI and LangChain4j codelab geared towards Python developers to discover Gemini Large Language Model by Google using LangChain framework.
Before running the samples, it's a good idea to create a Python virtual environment and activate it:
python -m venv .venv
source .venv/bin/activate
Install the dependencies:
pip install -r requirements.txt
You also need to have a Google Cloud account and project ready and set up two environment variables:
export PROJECT_ID=YOUR_PROJECT_ID
export LOCATION=us-central1
These are the list of samples for different use cases:
-
python qa.py
-
Simple Question & Answer via streaming
python stream_qa.py
-
Hold a conversation with a chatbot
python conversation.py
-
Describing an image with multimodality
python multimodal.py
-
Extracting structured data from unstructured text
python extract_data.py
-
python template_prompt.py
-
Text classification & sentiment analysis
python text_classification.py
-
Retrieval Augmented Generation
python rag.py
-
python function_calling.py
-
python function_calling_assistant.py
-
Multi function calling assistant
python multi_function_calling_assistant.py
This is not an official Google product.