What this doc covers
- Using Exa’s Auto search to pick the best search setting for each query
- Using search_and_contents() through Exa’s Python SDK
In this example, we will build Exa Researcher, a Python app that, given a research topic, automatically searches for relevant sources with Exa’s auto search and synthesizes the information into a reliable research report. To run this code, first we need a Exa API key and an OpenAI API key. If you would like to se the full code for this tutorial as a Colab notebook, click here
Setup
Let’s import the Exa and OpenAI SDKs and set up our API keys to create client objects for each. We’ll use environment variables to securely store our API keys.Python
Python
Exa Auto search
The researcher should be able to automatically generate research reports for all kinds of different topics. Here’s two to start:Python
Python
Python
Writing a report with GPT-3.5 Turbo
The final step is to instruct the LLM to synthesize the content into a research report, including citations of the original links. We can do that by pairing the content and the URLs and writing them into the prompt.Python
All Together Now
Now, let’s just wrap everything into one Researcher function that strings together all the functions we’ve written. Given a user’s research topic, the Researcher will generate search queries, feed those queries to Exa Auto search, and finally use an LLM to synthesize the retrieved information. Three simple steps!Python
Python

