# Where to Find Pre-built LangChain Demos in the Google Cloud Generative AI Repository

> Discover pre-built LangChain demos in the Google Cloud Generative AI repository. Explore examples for workshops, search, and RAG.

- Repository: [Google Cloud Platform/generative-ai](https://github.com/GoogleCloudPlatform/generative-ai)
- Tags: how-to-guide
- Published: 2026-03-09

---

**The GoogleCloudPlatform/generative-ai repository does not contain an `LLM-demos` directory, but it provides extensive pre-built LangChain demos organized across workshops, search, and retrieval-augmented generation directories.**

The GoogleCloudPlatform/generative-ai repository serves as a comprehensive resource for developers building generative AI applications on Google Cloud. While you won't find a dedicated `LLM-demos` folder, the repository contains numerous pre-built LangChain demos scattered across specialized directories for AI agents, Vertex AI Search, and RAG implementations.

## Why There Is No `LLM-demos` Directory

A recursive search of the repository confirms that a directory named `LLM-demos` does not exist. The maintainers organize LangChain examples by functional domain—such as agents, search, and enterprise integration—rather than collecting them in a single monolithic folder. This modular structure places demos in contextually appropriate paths, making it easier to locate relevant code for specific use cases.

## Where Pre-built LangChain Demos Are Located

The repository distributes working LangChain examples across several key directories. Each location targets specific integration patterns with Google Cloud services.

### AI Agents Workshop (`workshops/ai-agents/`)

The notebook `workshops/ai-agents/ai_agents_for_engineers.ipynb` demonstrates end-to-end LangChain usage for building AI agents. It imports `LLMChain` and `ChatPromptTemplate` from LangChain, then constructs a multi-step essay-writing pipeline that combines Gemini with external tools like Tavily search.

### Retrieval-Augmented Generation (`search/retrieval-augmented-generation/`)

The `search/retrieval-augmented-generation/examples/question_answering.ipynb` notebook provides a complete RAG implementation. It uses LangChain's `RetrievalQA` chain with a `VertexAISearchRetriever` to pull documents from Vertex AI Search, then generates answers using a Gemini LLM.

### Vertex AI Search Integration (`search/vertexai-search-options/`)

Located at `search/vertexai-search-options/vertexai_search_options.ipynb`, this demo focuses on configuring LangChain with Vertex AI Search. It shows how to install the required LangChain packages and wire a `VertexAISearchRetriever` into a LangChain chain for document retrieval.

### Dual LLM Comparison Demo (`search/retrieval-augmented-generation/rag_with_dual_llms/`)

This advanced demo, found in `search/retrieval-augmented-generation/rag_with_dual_llms/`, includes a Streamlit application ([`src/vertex_rag_demo_dual_llms_with_judge.py`](https://github.com/GoogleCloudPlatform/generative-ai/blob/main/src/vertex_rag_demo_dual_llms_with_judge.py)) that initializes two separate LangChain LLM instances—one using Vertex AI's text-bison model and another using Gemini. It runs both models on the same retrieved context to compare answer quality side-by-side.

### Open Source Model Integration (`search/gemini-enterprise/`)

The notebook `search/gemini-enterprise/oss_model_with_gemini_enterprise.ipynb` demonstrates wrapping an open-source model with LangChain and exposing it through Gemini Enterprise, showing how to integrate non-Google models into the Google Cloud ecosystem using LangChain abstractions.

## Code Examples from the Repository

Below are executable code snippets extracted from the notebooks listed above. These require installing `langchain`, `langchain-google-vertexai`, `langchain-google-genai`, and `langchain-google-community`.

### Basic LLMChain with Gemini

This example from `workshops/ai-agents/ai_agents_for_engineers.ipynb` shows how to create a simple chain for generating essay outlines:

```python
from langchain import LLMChain
from langchain.prompts import ChatPromptTemplate
from langchain_google_genai import ChatGoogleGenerativeAI

# Initialize Gemini model

gemini_llm = ChatGoogleGenerativeAI(model="gemini-1.5-flash")

# Define prompt template

outline_template = ChatPromptTemplate.from_messages(
    [
        ("system", "You are a helpful assistant that writes essay outlines."),
        ("human", "Create an outline for an essay about {topic}."),
    ]
)

# Create and run chain

outline_chain = LLMChain(llm=gemini_llm, prompt=outline_template)
outline = outline_chain.run({"topic": "the impact of AI on education"})
print(outline)

```

### RAG Pipeline with Vertex AI Search

This snippet from `search/retrieval-augmented-generation/examples/question_answering.ipynb` implements a complete retrieval-augmented generation flow:

```python
from langchain.chains import RetrievalQA
from langchain_google_vertexai import VertexAI
from langchain_google_community import VertexAISearchRetriever

# Configure Vertex AI LLM

vertex_llm = VertexAI(model_name="text-bison@001")

# Set up retriever for Vertex AI Search

retriever = VertexAISearchRetriever(
    project_id="my-gcp-project",
    location="us-central1",
    engine_id="my-search-engine",
)

# Build RAG chain

qa_chain = RetrievalQA.from_chain_type(
    llm=vertex_llm,
    chain_type="stuff",
    retriever=retriever,
)

# Execute query

answer = qa_chain.run("What are the security best practices for Cloud Run?")
print(answer)

```

### Dual LLM Comparison with Streamlit

This example from [`search/retrieval-augmented-generation/rag_with_dual_llms/src/vertex_rag_demo_dual_llms_with_judge.py`](https://github.com/GoogleCloudPlatform/generative-ai/blob/main/search/retrieval-augmented-generation/rag_with_dual_llms/src/vertex_rag_demo_dual_llms_with_judge.py) demonstrates initializing two LangChain LLMs for side-by-side comparison:

```python
import streamlit as st
from langchain_google_vertexai import VertexAI
from langchain_google_genai import ChatGoogleGenerativeAI
from langchain_google_community import VertexAISearchRetriever
from langchain.chains import RetrievalQA

# Initialize two different LLMs

vertex_llm = VertexAI(model_name="text-bison@001")
gemini_llm = ChatGoogleGenerativeAI(model="gemini-1.5-pro")

# Shared retriever

retriever = VertexAISearchRetriever(
    project_id="my-gcp-project",
    location="global",
    engine_id="my-search-engine",
)

def answer_with(llm):
    chain = RetrievalQA.from_chain_type(
        llm=llm,
        chain_type="stuff",
        retriever=retriever,
    )
    return chain.run(st.session_state.query)

# Streamlit UI

st.title("Dual‑LLM RAG Comparison")
st.text_input("Enter your query:", key="query")

if st.session_state.query:
    col1, col2 = st.columns(2)
    
    with col1:
        st.subheader("Vertex AI LLM")
        st.write(answer_with(vertex_llm))
    
    with col2:
        st.subheader("Gemini LLM")
        st.write(answer_with(gemini_llm))

```

## Summary

- The GoogleCloudPlatform/generative-ai repository does **not** contain an `LLM-demos` directory.
- Pre-built LangChain demos are distributed across functional directories including `workshops/ai-agents/`, `search/retrieval-augmented-generation/`, and `search/gemini-enterprise/`.
- Key implementations include AI agent pipelines using `LLMChain`, RAG chains with `RetrievalQA`, Vertex AI Search integration via `VertexAISearchRetriever`, and dual-LLM comparison tools.
- All demos integrate with Google Cloud services including Vertex AI, Gemini, and Vertex AI Search using the `langchain-google-*` package family.

## Frequently Asked Questions

### Does the Google Cloud generative AI repo have an LLM-demos folder?

No, the repository does not contain a directory named `LLM-demos`. A comprehensive search of the repository structure confirms this folder does not exist. Instead, LangChain examples are organized by functional area across directories like `workshops/`, `search/`, and `gemini-enterprise/`.

### Where can I find LangChain examples for Vertex AI?

You can find LangChain examples for Vertex AI in several locations. The `search/vertexai-search-options/vertexai_search_options.ipynb` notebook demonstrates basic Vertex AI Search integration. For RAG applications, see `search/retrieval-augmented-generation/examples/question_answering.ipynb`. The `workshops/ai-agents/ai_agents_for_engineers.ipynb` notebook also contains Vertex AI LLMChain examples.

### Are there any RAG demos using LangChain in the repository?

Yes, the repository contains multiple RAG demos using LangChain. The primary example is `search/retrieval-augmented-generation/examples/question_answering.ipynb`, which implements a full RAG pipeline using `RetrievalQA` chains with `VertexAISearchRetriever`. Additionally, the `rag_with_dual_llms` directory contains a Streamlit application that compares two different LLMs using the same RAG retrieval context.

### How do I run the dual LLM comparison demo?

To run the dual LLM comparison demo, navigate to `search/retrieval-augmented-generation/rag_with_dual_llms/` and execute the Streamlit application located at [`src/vertex_rag_demo_dual_llms_with_judge.py`](https://github.com/GoogleCloudPlatform/generative-ai/blob/main/src/vertex_rag_demo_dual_llms_with_judge.py). You will need to install dependencies including `streamlit`, `langchain-google-vertexai`, `langchain-google-genai`, and `langchain-google-community`. The application initializes two LangChain LLM instances—one using Vertex AI's text-bison model and another using Gemini—and runs both against the same Vertex AI Search retrieval context for side-by-side comparison.