Skip to content

google-genai: Context is not getting cached while using Gemini 2.5 #8548

@Ayush170-Future

Description

@Ayush170-Future

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • I added a very descriptive title to this issue.
  • I searched the LangChain.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Error Message and Stack Trace (if applicable)

No response

Description

I'm not sure if LangChainJS supports context caching by Gemini: https://ai.google.dev/gemini-api/docs/caching

There is a method known as useCachedContent, but I'm not sure if it is for the same purpose or if it supports Gemini 2.5 Pro. Do we have any documentation showing how I can cache my context using a technique similar to the one shared in the Gemini docs, but with LangChainJS?

System Info

Node

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions