langgraph-chat-google-genai
Connects your LLM-based applications to Google Gemini for chat and media-rich document analysis.
Install
mkdir -p .claude/skills/langgraph-chat-google-genai && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14915" && unzip -o skill.zip -d .claude/skills/langgraph-chat-google-genai && rm skill.zipInstalls to .claude/skills/langgraph-chat-google-genai
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Using ChatGoogleGenerativeAI, a chat model wrapper from langchain for Google Gemini series, for various applications including file processing.Key capabilities
- →Process PDF documents by providing base64 encoded data
- →Upload various file types to Google's servers and reference them by URI
- →Cache single files for reuse in subsequent queries
- →Cache multiple files to analyze content across them
- →Query cached content with specific instructions
- →Integrate with LangChain for model interactions
How it works
The skill uses ChatGoogleGenerativeAI to interact with Google Gemini models, allowing users to process files by either encoding them in base64 or uploading them to Google's servers and referencing them by URI. It also supports caching content for faster processing.
Inputs & outputs
When to use langgraph-chat-google-genai
- →Processing PDF content with Gemini
- →Integrating Google Generative AI in LangChain apps
- →Analyzing media files via chat interface
About this skill
Instantiation
from langchain_google_genai import ChatGoogleGenerativeAI
model = ChatGoogleGenerativeAI(model="gemini-3.1-pro-preview")
model.invoke("Write me a ballad about LangChain")
File Processing
PDF Input
Chat with model to describe a PDF document
import base64
from langchain.messages import HumanMessage
pdf_bytes = open("/path/to/your/test.pdf", "rb").read()
pdf_base64 = base64.b64encode(pdf_bytes).decode("utf-8")
message = HumanMessage(
content=[
{"type": "text", "text": "describe the document in a sentence"},
{
"type": "file",
"source_type": "base64",
"mime_type": "application/pdf",
"data": pdf_base64,
},
]
)
ai_msg = model.invoke([message])
File upload
You can also upload files to Google's servers and reference them by URI. This works for PDFs, images, videos, and audio files.
import time
from google import genai
from langchain.messages import HumanMessage
client = genai.Client()
myfile = client.files.upload(file="/path/to/your/sample.pdf")
while myfile.state.name == "PROCESSING":
time.sleep(2)
myfile = client.files.get(name=myfile.name)
message = HumanMessage(
content=[
{"type": "text", "text": "What is in the document?"},
{
"type": "media",
"file_uri": myfile.uri,
"mime_type": "application/pdf",
},
]
)
ai_msg = model.invoke([message])
Context Caching
Context caching allows you to store and reuse content (e.g., PDFs, images) for faster processing. The cached_content parameter accepts a cache name created via the Google Generative AI API.
Single file caching example
from google import genai
from google.genai import types
import time
from langchain_google_genai import ChatGoogleGenerativeAI
from langchain.messages import HumanMessage
client = genai.Client()
# Upload file
file = client.files.upload(file="path/to/your/file")
while file.state.name == "PROCESSING":
time.sleep(2)
file = client.files.get(name=file.name)
# Create cache
model = "gemini-3.1-pro-preview"
cache = client.caches.create(
model=model,
config=types.CreateCachedContentConfig(
display_name="Cached Content",
system_instruction=(
"You are an expert content analyzer, and your job is to answer "
"the user's query based on the file you have access to."
),
contents=[file],
ttl="300s",
),
)
# Query with LangChain
llm = ChatGoogleGenerativeAI(
model=model,
cached_content=cache.name,
)
message = HumanMessage(content="Summarize the main points of the content.")
llm.invoke([message])
Multiple file caching example
from google import genai
from google.genai.types import CreateCachedContentConfig, Content, Part
import time
from langchain_google_genai import ChatGoogleGenerativeAI
from langchain.messages import HumanMessage
client = genai.Client()
# Upload files
file_1 = client.files.upload(file="./file1")
while file_1.state.name == "PROCESSING":
time.sleep(2)
file_1 = client.files.get(name=file_1.name)
file_2 = client.files.upload(file="./file2")
while file_2.state.name == "PROCESSING":
time.sleep(2)
file_2 = client.files.get(name=file_2.name)
# Create cache with multiple files
contents = [
Content(
role="user",
parts=[
Part.from_uri(file_uri=file_1.uri, mime_type=file_1.mime_type),
Part.from_uri(file_uri=file_2.uri, mime_type=file_2.mime_type),
],
)
]
model = "gemini-3.1-pro-preview"
cache = client.caches.create(
model=model,
config=CreateCachedContentConfig(
display_name="Cached Contents",
system_instruction=(
"You are an expert content analyzer, and your job is to answer "
"the user's query based on the files you have access to."
),
contents=contents,
ttl="300s",
),
)
# Query with LangChain
llm = ChatGoogleGenerativeAI(
model=model,
cached_content=cache.name,
)
message = HumanMessage(
content="Provide a summary of the key information across both files."
)
llm.invoke([message])
When not to use it
- →When direct interaction with Google Generative AI is not required
- →When file processing is not a primary concern
Limitations
- →File types are limited to PDFs, images, videos, and audio files for URI uploads
- →Cached content has a Time-To-Live (TTL) that needs to be managed
How it compares
This approach integrates file processing and content caching directly into LangChain's ChatGoogleGenerativeAI, enabling direct interaction with Gemini models for file analysis without manual API calls for each file operation.
Compared to similar skills
langgraph-chat-google-genai side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| langgraph-chat-google-genai (this skill) | 0 | 4mo | No flags | Intermediate |
| similarity-search-patterns | 3 | 2mo | No flags | Advanced |
| ai-engineer | 7 | 4mo | No flags | Advanced |
| llm-application-dev | 3 | 4mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
similarity-search-patterns
wshobson
Implement efficient similarity search with vector databases. Use when building semantic search, implementing nearest neighbor queries, or optimizing retrieval performance.
ai-engineer
sickn33
Build production-ready LLM applications, advanced RAG systems, and intelligent agents. Implements vector search, multimodal AI, agent orchestration, and enterprise AI integrations. Use PROACTIVELY for LLM features, chatbots, AI agents, or AI-powered applications.
llm-application-dev
skillcreatorai
Building applications with Large Language Models - prompt engineering, RAG patterns, and LLM integration. Use for AI-powered features, chatbots, or LLM-based automation.
langchain-architecture
Kuingsmile
Design LLM applications using the LangChain framework with agents, memory, and tool integration patterns. Use when building LangChain applications, implementing AI agents, or creating complex LLM workflows.
talon
darkmice
Talon 多模融合数据引擎使用指南。当用户需要使用 Talon 数据库进行开发时触发:包括 SQL 查询、KV 存储、向量搜索、时序数据、消息队列、全文检索、地理空间、图数据库、AI 引擎(Session/Context/Memory/RAG/Agent/Trace)。也适用于:选择 Talon 引擎模块、使用 Go/Python/Node.js/Java/.NET SDK、构建 RAG 管道、Agent 工具缓存、对话管理、embedding 缓存、跨引擎融合查询(GraphRAG、Hybrid Search)。
langchain-architecture
wshobson
Design LLM applications using the LangChain framework with agents, memory, and tool integration patterns. Use when building LangChain applications, implementing AI agents, or creating complex LLM workflows.