New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to supply PDF files to VertexAI object despite feature available for native Vertex AI library #215
Comments
@aaronepinto-bell You can just pass a GCS uri with LangChain, it works well for me. just construct it as:
|
@Adi8885 please, add it to our LC documentation |
@lkuligin I've tried that using the recent langchain-core version == 0.1.52 but it doesn't work
Answer
|
Any updates on this? |
please, update the version of |
@lkuligin the version is still 1.0.4 in pypi. I've seen the fix, it is the addition of the option "media" but that change is not available yet. I've seen the commit from @wafle in langchain-google-genai release . Please correct me if I'm wrong new way to use with open("file.pdf", "rb") as f:
pdf = base64.b64encode(f.read()).decode("utf-8")
content = [{
"type": "text",
"text": "prompt here",
},
{
"type": "media",
"mime_type": "application/pdf",
"data": pdf
}]
message = [HumanMessage(content=content)] |
Checked other resources
Example Code
Taken from the following discussion
Description
I am trying to pass a PDF document to a gemini-1.5-pro in multimodal mode, following a process similar to the one explained here. The documentation illustrates how to pass an image and query Gemini Pro Vision, but I want to pass a PDF directly instead.
Here is my attempt:
This approach works, but I was hoping to make the LangChain method function similarly.
System Info System Information OS: Darwin OS Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:11:05 PDT 2024; root:xnu-10063.101.17~1/RELEASE_X86_64 Python Version: 3.11.5 (main, Sep 11 2023, 08:19:27) [Clang 14.0.6 ]
Package Information
Packages not installed (Not Necessarily a Problem)
The following packages were not found:
The text was updated successfully, but these errors were encountered: