Is it possible to use Langchain + Gemini API + Files API

I’m kinda starting with Langchain to easily manage my chatbot lifecycle such as chat history, database, function call etc.

But i was wondering if its possible to combine the files api feature it provides (for videos and pdf inputs which I use all the time) and Langchain, although I’m kinda new using these LLM frameworks, i was wondering if this is even possible, I couldn’t find relevant articles about leveraging files api with Langchain, TIA!

Are you using Langchain or Langchain.js?

On Langchain.js we’ve just started rolling out the MediaManager class which not only lets you use the File API, but does it pretty transparently. It handles most of the work for you. I don’t think the Python API has started working on this yet.

I’m using Langchain for python

Hi @zavocc306

While Langchain doesn’t directly support fileAPI, you can leverage its loaders to work with different file formats and inject the file contents into a prompt which can then be sent to Gemini. Alternatively, you can bypass Langchain and use filesAPI + GeminiAPI directly to send files as input to Gemini.

Thanks