### Install LangChain with Google Generative AI Support Source: https://python.langchain.com/docs/introduction/index Installs the LangChain library with specific support for Google Generative AI. This is a prerequisite for using Google's Gemini models within LangChain. ```shell pip install -qU "langchain[google-genai]" ``` -------------------------------- ### Invoke a Chat Model in Python Source: https://python.langchain.com/docs/introduction/index Demonstrates how to invoke a chat model to get a response to a given input string. This is a basic example of interacting with an initialized language model. ```python model.invoke("Hello, world!") ``` -------------------------------- ### Initialize Google Gemini Chat Model in Python Source: https://python.langchain.com/docs/introduction/index Initializes a chat model using Google's Gemini API. It includes logic to securely retrieve the API key from environment variables or prompt the user if it's not set. Requires the 'langchain-google-genai' package. ```python import getpass import os if not os.environ.get("GOOGLE_API_KEY"): os.environ["GOOGLE_API_KEY"] = getpass.getpass("Enter API key for Google Gemini: ") from langchain.chat_models import init_chat_model model = init_chat_model("gemini-2.5-flash", model_provider="google_genai") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.