Search Types
Auto Search (prev. Magic Search)
Where you would use it |
---|
When you want optimal results without manually choosing between neural and keyword search. When you might not know ahead of time what the best search type is. Note Auto Search is the default search type - when unspecified, Auto Search is used. |
result = exa.search("hottest AI startups", type="auto")
Neural Search
Description | Where you would use it |
---|
Uses Exa’s embeddings-based index and query model to perform complex queries and provide semantically relevant results. | For exploratory searches or when looking for conceptually related content rather than exact keyword matches. To find hard to find, specific results from the web |
result = exa.search("Here is a startup building innovative solutions for climate change:", type="neural")
Keyword Search
Description | Where you would use it |
---|
Traditional search method that matches specific words or phrases. | When doing simple, broad searches where the user can refine results manually. Good for general browsing and finding exact matches. Good for matching proper nouns or terms of art that are rarely used in other contexts. When neural search fails to return what you are looking for. |
result = exa.search("Paris", type="keyword")
Phrase Filter Search
Description | Where you would use it |
---|
Apply keyword filters atop of a neural search before returning results | When you want the power of Neural Search but also need to specify and filter on some key phrase. Often helpful when filtering on a piece of jargon where a specific match is crucial |
result = exa.search(query, type='neural', includeText='Some_key_phrase_to_fiter_on')
See a worked example here
Large-scale Searches
Description | Where you would use it |
---|
Exa searches that return a large number of search results. | When desiring comprehensive, semantically relevant data for batch use cases, e.g., for enrichment of CRMs or full topic scraping. |
result = exa.search("Companies selling sonar technology", num_results=1000)
Note high return results cost more and higher result caps (e.g., 1000 returns) are restricted to Enterprise/Custom plans only. Get in touch if you are interested in learning more.
Content Retrieval
Contents Retrieval
Description | Where you would use it |
---|
Instantly retrieves whole, cleaned and parsed webpage contents from search results. | When you need the full text of webpages for analysis, summarization, or other post-processing. |
result = exa.search_and_contents("latest advancements in quantum computing", text=True)
Highlights Retrieval
Description | Where you would use it |
---|
Extracts relevant excerpts or highlights from retrieved content. | When you want a quick or targeted outputs from the most relevant parts of a search entity without wanted to handle the full text. |
result = exa.search_and_contents("AI ethics", highlights=True)
Prompt Engineering
Prompt engineering is crucial for getting the most out of Exa’s capabilities. The right prompt can dramatically improve the relevance and usefulness of your search results. This is especially important for neural search and advanced features like writing continuation.
Writing continuation queries
Description | Where you would use it |
---|
Prompt crafted by post-pending ‘Here is a great resource to continue writing this piece of writing:‘. Useful for research writing or any other citation-based text generation after passing to an LLM. | When you’re in the middle of writing a piece and need to find relevant sources to continue or expand your content. This is particularly useful for academic writing, content creation, or any scenario where you need to find information that logically follows from what you’ve already written. |
current_text = """
The impact of climate change on global agriculture has been significant.
Rising temperatures and changing precipitation patterns have led to shifts
in crop yields and growing seasons. Some regions have experienced increased
drought stress, while
"""
continuation_query = current_text + " If you found the above interesting, here's another useful resource to read:"
result = exa.search(continuation_query, type="neural", use_autoprompt=False)
Long queries
Description | Where you would use it |
---|
Utilizing Exa’s long query window to perform matches against semantically rich content. | When you need to find content that matches complex, detailed descriptions or when you want to find content similar to a large piece of text. This is particularly useful for finding niche content or when you’re looking for very specific information. |
long_query = """
Abstract: In this study, we investigate the potential of quantum-enhanced machine learning algorithms
for drug discovery applications. We present a novel quantum-classical hybrid approach that leverages
quantum annealing for feature selection and a quantum-inspired tensor network for model training.
Our results demonstrate a 30% improvement in prediction accuracy for binding affinity in protein-ligand
interactions compared to classical machine learning methods. Furthermore, we show a significant
reduction in computational time for large-scale molecular dynamics simulations. These findings
suggest that quantum machine learning techniques could accelerate the drug discovery process
and potentially lead to more efficient identification of promising drug candidates.
"""
result = exa.search(long_query, type="neural", use_autoprompt=False)
Use Autoprompt (incl. Autodate)
Description | Where you would use it |
---|
Automatically optimizes your query for Exa’s neural search. | When you want to leverage Exa’s neural search capabilities without manually crafting the perfect prompt. It’s particularly useful for general-purpose queries or when you’re not sure how to phrase your query for optimal results. |
result = exa.search("AI startups in healthcare", use_autoprompt=True)
Note: use_autoprompt
is set to False
in some examples above where manual prompt engineering is demonstrated. For most general use cases, leaving it as True
(the default) will yield good results.
Using autoprompt will also automatically fetch date information as a filter to apply onto searches. For instance, the query:
Here is the latest news from Russia in the last 7 days
On July 15 2024, will produce results with an autoDate
response attribute:
"autopromptString": "\"Here is the latest news from Russia:",
"autoDate": "2024-07-08T17:18:57.152Z",
"results": ...
}
Note the date is no longer in the query, but rather is applied as a strict filter as though you had applied it as a date.