Function Calling for Knowledge Retrieval
Build an agent with two functions on the Responses API: arXiv paper search with embeddings and PDF summarization. The agent decides which function to call; covers strict mode, multiple calls per turn and the built-in file_search and web_search tools.
Agent Architecture
In this example the agent has access to two functions:
- get_articles — searches arXiv for papers, downloads PDFs, computes embeddings
- read_article_and_summarize — reads a PDF from the local library and summarizes it
The example comes from an OpenAI Cookbook recipe that is now marked as archived: it uses older models and Chat Completions. Below is the same agent on the Responses API, which OpenAI recommends for new projects. gpt-6-luna is inexpensive and fits this kind of loop. The recipe's gpt-4o-mini is deprecated and shuts down on January 14, 2027, and OpenAI names gpt-6-luna as its replacement.
The rest of this lesson opens after a free sign-up
Sign up with email or Google: the first two lessons of every course stay open for good, and the whole catalog is open for 7 days. No card needed.


