<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>nogawanogawa</author_name>
  <author_url>https://blog.hatena.ne.jp/nogawanogawa/</author_url>
  <blog_title>Re:ゼロから始めるML生活</blog_title>
  <blog_url>https://www.nogawanogawa.com/</blog_url>
  <categories>
    <anon>Python</anon>
    <anon>LLM</anon>
    <anon>LangChain</anon>
  </categories>
  <description>前回までプロンプトキャッシングについて調べたりコード書いたりしていました。 www.nogawanogawa.com www.nogawanogawa.com 似たような機能で、Geminiにも明示的Context Cacheという機能があります。 ai.google.dev 公式ドキュメントにも、 暗黙的なキャッシュ保存（自動、費用削減は保証されない） 明示的なキャッシュ保存（手動、費用削減保証） とあるので、コンテキストキャッシュを使って費用削減しようと思ったら、明示的にやるのが良さそうではあります。 LangChainでそれをやっている文献が見当たらなかったので、今回試しにやってみたので…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.nogawanogawa.com%2Fentry%2Flangchain_gemini_context_cache&quot; title=&quot;LangChainでGeminiの明示的Context Cacheを使う - Re:ゼロから始めるML生活&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/n/nogawanogawa/20250607/20250607223047.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2025-06-08 00:10:00</published>
  <title>LangChainでGeminiの明示的Context Cacheを使う</title>
  <type>rich</type>
  <url>https://www.nogawanogawa.com/entry/langchain_gemini_context_cache</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
