-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
bot triaged[Bot] This issue is triaged by ADK bot[Bot] This issue is triaged by ADK botquestion[Component] This issue is asking a question or clarification[Component] This issue is asking a question or clarification
Description
Problem
Sending a PDF as a Part with mime_type='application/pdf'
but the agent:
- Always asks for “raw text”.
- Returns made-up data that doesn’t match the PDF.
Steps
- Create session
- Save PDF via
artifact_service.save_artifact
- Send:
content = Content(parts=[ Part(text=f"Patient folder: {patient_id}"), Part.from_bytes(pdf_bytes, mime_type="application/pdf") ]) async for event in runner.run_async(...): ...
- Agent never invokes OCR or
analyze_attachment
.
Questions
- Is sending PDF Parts directly supported?
- How to trigger OCR (built‑in or custom tool) on a PDF artifact?
- Should I pre-convert PDFs to text/images instead?
I'm using 2.5 pro model, that should support PDF. Any examples in ADK repos appreciated.
pdf_part = Part.from_bytes(
data=pdf_bytes,
mime_type="application/pdf"
)
session_id = f"{patient_id}_{filename}"
await session_service.create_session(
app_name=APP_NAME,
user_id=USER_ID,
session_id=session_id
)
version = await artifact_service.save_artifact(
app_name=APP_NAME,
user_id=USER_ID,
session_id=session_id,
filename=filename,
artifact=pdf_part
)
content = Content(parts=[
Part(text=f"Patient folder: {patient_id}"),
pdf_part
])
async for event in runner.run_async(
user_id=USER_ID,
session_id=session_id,
new_message=content
)
Metadata
Metadata
Assignees
Labels
bot triaged[Bot] This issue is triaged by ADK bot[Bot] This issue is triaged by ADK botquestion[Component] This issue is asking a question or clarification[Component] This issue is asking a question or clarification