Vision-capable MS Agent Framework demo that accepts image and PDF attachments.
- Frontend:
src/app/demos/multimodal/page.tsxmounts<CopilotChat />withAttachmentsConfigso the user can attach files via paperclip, drag-and-drop, clipboard paste, or the bundled sample buttons. - Runtime:
src/app/api/copilotkit-multimodal/route.ts-- dedicated Next.js route that proxies to the Python agent server at/multimodal. Scoped to its own endpoint so the vision-capable model does not bleed into other demos. - Agent:
src/agents/multimodal_agent.py-- a vision-capableAgentFrameworkAgentbacked byOpenAIChatClientwithgpt-4o-mini. Images are forwarded natively to OpenAI; PDFdocumentparts are flattened to text viapypdfin a pre-run hook so the model can reason about them even if the chat client does not accept thedocumentcontent-part shape. - Mounting: see
src/agent_server.py-- the multimodal agent is mounted on/multimodalbefore the catch-all/endpoint.
Drop sample.png and sample.pdf into public/demo-files/ if you want the
bundled-sample buttons to work. The sample buttons fetch those URLs and
drive the same hidden file input the paperclip button uses, so they exercise
the exact same onUpload pipeline.
pypdf is imported lazily so the module stays importable even if the
package is missing. Add it to requirements.txt if you need PDF flattening.