Metaphor API Guide -TS/JS SDK-Neural Search API Integration

Empower your apps with AI-powered search

Home > GPTs > Metaphor API Guide -TS/JS SDK
Get Embed Code
YesChatMetaphor API Guide -TS/JS SDK

How can I implement the Metaphor search functionality in my TypeScript project?

What are the best practices for using the 'useAutoprompt' feature in Metaphor's API?

Can you provide an example of a neural search query using the Metaphor SDK?

How do I exclude certain domains when searching with Metaphor?

Rate this tool

20.0 / 5 (200 votes)

Introduction to Metaphor API Guide - TS/JS SDK

Metaphor API Guide - TS/JS SDK is designed to assist software engineers in utilizing the Metaphor Search API, a powerful, neural search engine. The SDK simplifies the process of integrating Metaphor's capabilities into applications, particularly those involving complex, context-rich search queries. It offers a set of TypeScript/JavaScript interfaces and classes to interact with Metaphor's search, findSimilar, and getContents endpoints. The SDK is tailored to handle queries that are optimized for Metaphor's unique embedding-based search approach, which focuses on high-quality, shareable internet content. Examples include crafting search queries that mimic how people refer to content on the internet, handling responses, and fetching detailed content information. Powered by ChatGPT-4o

Main Functions of Metaphor API Guide - TS/JS SDK

  • Search Functionality

    Example Example

    Searching for recent, high-quality articles on climate change

    Example Scenario

    A developer building a news aggregation site can use the search function to retrieve the latest, most relevant articles on climate change from various high-quality sources.

  • Find Similar Content

    Example Example

    Finding content similar to a specific article on renewable energy

    Example Scenario

    In a research tool for academics, the findSimilar function helps users discover additional resources related to a specific article on renewable energy, enhancing their research depth.

  • Fetching Document Contents

    Example Example

    Retrieving the main content of a scientific paper

    Example Scenario

    An educational platform can use the getContents function to extract the core content of scientific papers, allowing students to access key information directly within the platform.

Ideal Users of Metaphor API Guide - TS/JS SDK

  • Web Developers and Software Engineers

    Professionals who are building web applications or platforms requiring advanced search capabilities. They benefit from the SDK's ability to handle complex queries and return contextually relevant results, enhancing user experience on their platforms.

  • Data Scientists and Researchers

    These users utilize the SDK for aggregating and analyzing web content. The nuanced search capabilities allow for the collection of specific types of web content, aiding in data-driven research and analysis.

  • Content Curators and Digital Marketers

    Individuals responsible for curating high-quality content or conducting market research. They benefit from Metaphor's focus on shareable, high-quality web content, enabling them to discover trending topics and valuable resources.

Getting Started with Metaphor API Guide - TS/JS SDK

  • 1

    Begin your journey at yeschat.ai to explore Metaphor API with a free trial, no login or ChatGPT Plus subscription required.

  • 2

    Install the `metaphor_node` package in your project using npm or yarn to integrate the Metaphor API into your TypeScript or JavaScript application.

  • 3

    Configure the Metaphor client by initializing it with your API key. Ensure you handle authentication securely to protect your API access.

  • 4

    Utilize the `search`, `findSimilar`, or `getContents` methods to interact with the Metaphor API. Craft your queries thoughtfully to leverage the neural search capabilities.

  • 5

    Experiment with different search options and parameters to fine-tune your results. Use the `useAutoprompt` feature for traditional queries, ensuring they are transformed into Metaphor-optimized queries.

Frequently Asked Questions about Metaphor API Guide - TS/JS SDK

  • What is the Metaphor API and how does it work?

    The Metaphor API is a neural search engine that leverages embeddings to match queries with high-quality, relevant internet content. It's trained on associations between descriptions and content links, enabling it to understand and predict content based on how people reference it online.

  • How do I authenticate with the Metaphor API using the TS/JS SDK?

    Authentication is done by initializing the Metaphor class with your API key. This key is sent in the header of each request to authenticate and authorize your API calls.

  • Can I filter search results by domain using the Metaphor API?

    Yes, you can filter search results by including or excluding specific domains using the `includeDomains` and `excludeDomains` options in your search query.

  • What is the `useAutoprompt` feature in the Metaphor API?

    The `useAutoprompt` feature automatically converts traditional search queries into Metaphor-optimized queries, making it easier to get relevant results without crafting complex query strings.

  • How do I handle pagination or request more results?

    While the Metaphor API does not directly support pagination in the traditional sense, you can control the number of results returned by adjusting the `numResults` option in your search queries.