Here is a quick tutorial highlighting how to use Metaphor's neural search capabilities.

Find relevant articles

# pip install metaphor-python
from metaphor_python import Metaphor

metaphor = Metaphor("METAPHOR_API_KEY")

search_response = metaphor.search("Here is an article about the current state of search:")
contents_response = search_response.get_contents()

# Print content for each result
for content in contents_response.contents:
    print(f"Title: {content.title}\nURL: {content.url}\nContent:\n{content.extract}\n")
// npm install metaphor-node
import Metaphor from 'metaphor-node';

const metaphor = new Metaphor('your_api_key');
const getResultsAndContent = async (query: string) => {
	const searchResponse = await metaphor.search(query);
  return (await metaphor.getContents(searchResponse.results).contents;
};

(async () => {
  const content = await getResultsAndContent('Here is an article about the state of search:');
  console.log('content', content);
})();

Output

Title: Google is trying to reinvent search — by being more than a search engine  
URL: <https://www.theverge.com/2022/9/28/23375691/google-search-multisearch-visual-keywords>  
Content:

<div><div><p>Google is trying to blow up how you think about search. To say it’s pivoting to compete in a world where TikTok and Instagram are changing the way the internet works would be an overstatement… but not a big one. Google now exists on a more visual, more interactive internet, in which users want to be surprised and delighted as often as they just want an answer to their questions. In that world, what is a search engine even for? The Google you see tomorrow might not be completely different, but the change is already starting.</p><p>At its annual Search On event today, Google showed off a bunch of new ways for people to search the internet. Most of them continue <a href="/2021/9/29/22698504/google-search-on-event-ai-mum-google-lens-update-changes">the trend of Google’s last few years</a>: trying to find more natural and more visual ways for people to input searches and get results. You can now ask Google a question by taking a picture or rambling into your phone’s microphone rather than trying to type the perfect set of keywords into the search bar. And Google is looking for more ways to present information you might care about without you even having to ask. </p><p>It’s an interesting thought experiment, really: what would Google’s equivalent of TikTok’s For You page look like? Google’s search team doesn’t know exactly, but it’s working on it. And at least so far, it looks like the answer will start to appear on the homepage of Google’s iOS app. That’s where many of Google’s new features are getting their start and where lots of customers are already interacting with Google in new ways.</p><p>In interviews ahead of the event, Google executives said over and over that search is undergoing a total reinvention. For two decades, “roughly the rules of the game are, ‘Dear human, if you follow the rules and script your queries just right, we’ll give you amazing answers to your needs,’” says Prabhakar Raghavan, Google’s SVP

...

Here we print the content using the /contents API route. If you want to learn more about getting a website's content, visit the Get contents of webpage guide.

Filter your search

Metaphor search is also powerful enough to filter by any domain or date range. Below, we search for news about the Supreme court starting from 6/25/2023 and only over nytimes.com.

# pip install metaphor-python
from metaphor_python import Metaphor

metaphor = Metaphor("METAPHOR_API_KEY")

search_response = metaphor.search(
  "Here is news about the American supreme court:",
  include_domains=["nytimes.com"],
  start_published_date="2023-06-25",
)

contents_response = search_response.get_contents()
# Print content for each result
for content in contents_response.contents:
    print(f"Title: {content.title}\nURL: {content.url}\nContent:\n{content.extract}\n")
// npm install metaphor-node
import Metaphor from 'metaphor-node';

const metaphor = new Metaphor('your_api_key');
const getResultsAndContent = async (query: string) => {
	const searchResponse = await metaphor.search(query, {includeDomains: ['nytimes.com'], startPublishedDate: '2023-06-25'}););
  return (await metaphor.getContents(saerchResponse.results).contents;
};

(async () => {
  const content = await getResultsAndContent('Here is an article about the state of search:');
  console.log('content', content);
})();

You can also exclude domains.