Why searches currently needs to be prompt engineered

Exa uses a transformer architecture to predict links given text, and it gets its power from having been trained on the way that people talk about links on the Internet. This training produces a model that returns links that are both high in relevance and quality. However, the model does expect queries that look like how people describe a link on the Internet. For example, 'best restaurants in SF" is a bad query, whereas "Here is the best restaurant in SF:" is a good query.

We know this limitation is annoying and we're actively working to eliminate the need (we're fairly close!). However, the model is extremely powerful. In fact, we benchmark better than OpenAI embeddings and many other open source embeddings on information retrieval benchmarks.

If you don't want to think about prompting

We are working hard on eliminating the need to prompt engineer. However, in the meantime, we have solutions that work very well and might actually have added benefits for an LLM.

Autoprompting

If you set the useAutoprompt flag to true, you can input any text as a query, we will transform that query into a Exa-optimized query, and then you should receive fairly high quality results. This is extremely powerful because it means that you can input an entire user input to your LLM as a query and get relevant results. No extra prompt chaining is needed, as long as your system can determine that the Exa API must be called.

Keyword search

If you're unable to find relevant results for your use case, you should first talk to us because we believe our index and search should be able to support almost all use cases. However, as a fallback, we support keyword-based search if you specify search type as "keyword" in the /search endpoint. Additionally, keyword search can be useful if you need to perform searches that do not need to be semantic, or that require a more complete index.

Tips and Tricks

When possible, try to avoid keyword searches.

The results tend to be less robust and useful, because they look very different from the type of ways people might talk about links on the internet. Instead of “Jeopardy archive” try something like “Here is the Jeopardy archive:”

Rephrase questions to look more like answers.

Questions tend to be bad prompts because people sharing links on the internet don’t usually precede links with questions. If you add "I found a good answer here:" after the question the results are often better.

For example, instead of searching for “What’s the best way to get started with cooking?”, try rephrase the question to resemble an answer;

“This is the best tutorial on how to get started with cooking:”

Use modifiers to control the type of results returned.

If you’re looking for a particular kind or style of result (a goodreads link, or a funny post) try specifying that in the prompt.

Pay attention to the punctuation at the end of prompts.

You’ll notice many of the example prompts above end in colons “:” because that mimics how someone would share a link.