Skip to content

hmshb/langchain-google-gemini-integration

Repository files navigation

LangChain + Google Gemini AI Model Integration Example

This repository demonstrates how to integrate LangChain with Google Gemini to build AI-powered applications using multimodal capabilities. It's designed as a starting point for developers looking to explore and experiment with LangChain and Google Gemini AI.

🚀 Features

  • Seamless integration: Connect LangChain with Google Gemini for text and multimodal tasks.
  • Beginner-friendly: Simple setup to get started quickly.
  • Extensible: Encourage contributions and customizations for advanced use cases.

🛠️ Setup Instructions

Follow these steps to set up and run the project on your local machine:

1. Clone the Repository

git clone https://github.com/hmshb/langchain-google-gemini-integration.git
cd langchain-google-gemini-integration

2. Create a Virtual Environment

python -m venv venv
source venv/bin/activate  # For Linux/Mac

.\venv\Scripts\activate # For Windows

3. Install Dependencies

pip install -r requirements.txt

img.png

4. Generate a Google API Key

  1. Visit Google AI Studio.
  2. Create an API key for accessing Google Gemini.
  3. Copy the generated API key.

img_1.png

5. Update .env File

  • Add the following line to the .env file, replacing your_google_api_key with your actual API key:
    GEMINI_API_KEY=your_google_api_key
    

6. Run the project

python index.py

img_2.png


📂 Project Structure

langchain-google-gemini-integration/
├── .env                                     # API key configuration file
├── gemini.py                                # Gemini AI LLM Model configurations file
├── index.py                                 # Simple script that translate word from English to Italian
├── prompt_template_single_variable.py       # Example of single variable usage in Prompt Template
├── prompt_template_multiple_variable.py     # Example of multiple variable usage in Prompt Template
├── prompt_template_conditional_prompts.py   # Example of conditional variable usage in Prompt Template
├── requirements.txt                         # Optional: Use for dependencies
├── README.md                                # Documentation file
├── venv/                                    # Virtual environment

⭐ Acknowledgments

Special thanks to:

  • LangChain for providing a robust framework for building LLM applications.
  • Google Gemini for their powerful multimodal AI capabilities.

📜 License

This project is open-source and licensed under the MIT License.


📢 Get Involved!

If you find this repository helpful, please consider:

  • Starring the Repository to show your support.
  • 📤 Forking the Repository to explore further and make your own customizations.
  • 💬 Sharing Your Feedback by opening issues or discussions.

Let's build amazing AI-powered applications together!