As of now, the Message can be either of type :text, image_url or :image, .
Would it be possible to also add the types: :pdf and :pdf_url.
To me, it looks like the process of sending the pdf to the llm is very similar to that of image. Atleast, in the case of Gemini APIs.
Here is code of snippet from the Gemini SDK:
from google import genai
from google.genai import types
import pathlib
import httpx
client = genai.Client()
doc_url = "https://discovery.ucl.ac.uk/id/eprint/10089234/1/343019_3_art_0_py4t4l_convrt.pdf" # Replace with the actual URL of your PDF
# Retrieve and encode the PDF byte
filepath = pathlib.Path('file.pdf')
filepath.write_bytes(httpx.get(doc_url).content)
prompt = "Summarize this document"
response = client.models.generate_content(
model="gemini-1.5-flash",
contents=[
types.Part.from_bytes(
data=filepath.read_bytes(),
mime_type='application/pdf',
),
prompt])
print(response.text)
Since, the pdf parsing library in Elixir aren't that great, the general advice is to either use NIFs or rely on third party services. I think this would be very helpful if it could be implemented.
Thanks!
As of now, the Message can be either of type
:text,image_urlor:image, .Would it be possible to also add the types:
:pdfand:pdf_url.To me, it looks like the process of sending the pdf to the llm is very similar to that of image. Atleast, in the case of Gemini APIs.
Here is code of snippet from the Gemini SDK:
Since, the pdf parsing library in Elixir aren't that great, the general advice is to either use NIFs or rely on third party services. I think this would be very helpful if it could be implemented.
Thanks!