Skip to content

Commit 3a16a24

Browse files
authored
Examples: use agent to interact with Remote PDF Documents (#1319)
1 parent a1ad518 commit 3a16a24

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

examples/basic/remote_pdf.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import asyncio
2+
3+
from agents import Agent, Runner
4+
5+
URL = "https://www.berkshirehathaway.com/letters/2024ltr.pdf"
6+
7+
8+
async def main():
9+
agent = Agent(
10+
name="Assistant",
11+
instructions="You are a helpful assistant.",
12+
)
13+
14+
result = await Runner.run(
15+
agent,
16+
[
17+
{
18+
"role": "user",
19+
"content": [{"type": "input_file", "file_url": URL}],
20+
},
21+
{
22+
"role": "user",
23+
"content": "Can you summarize the letter?",
24+
},
25+
],
26+
)
27+
print(result.final_output)
28+
29+
30+
if __name__ == "__main__":
31+
asyncio.run(main())

0 commit comments

Comments
 (0)