1from pathlib import Path
2
3from kern.agent import Agent
4from kern.media import File
5from kern.models.anthropic import Claude
6from kern.utils.media import download_file
7
8pdf_path = Path(__file__).parent.joinpath("ThaiRecipes.pdf")
9
10# Download the file using the download_file function
11download_file(
12 "https://kern-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf", str(pdf_path)
13)
14
15agent = Agent(
16 model=Claude(id="claude-sonnet-4-20250514"),
17 markdown=True,
18)
19
20agent.print_response(
21 "Summarize the contents of the attached file.",
22 files=[
23 File(
24 content=pdf_path.read_bytes(),
25 ),
26 ],
27)
28run_response = agent.get_last_run_output()
29print("Citations:")
30print(run_response.citations)