The Desearch JavaScript SDK provides a seamless way to integrate AI-powered search functionalities into your applications. This guide outlines the installation process, available methods, and example implementations.
To install the desearch-js SDK, use the following command:
Once installed, you can initialize the Desearch client as follows:
📘 API Keys
Get API Key (Follow link to get your API key) https://console.desearch.ai/api-keys.
The Desearch SDK provides the following methods for AI-powered search:
AISearch MethodThe AISearch method allows users to perform AI-powered searches across multiple tools, retrieving links and summaries.
| Parameter | Type | Description | Default |
|---|---|---|---|
| prompt | string | Search query prompt | Bittensor |
| tools | List[string] | A list of tools to be used for the search | ["Web Search", "Hacker News Search", "Reddit Search", "Wikipedia Search", "Youtube Search", "Twitter Search", "ArXiv Search"] |
| date_filter | Optional[string] | The date filter to be used for the search | LINKS_FIRST |
| streaming | Optional[bool] | Whether to stream results | True |
| count | Optional[int] | The number of results to return per source. Min 10. Max 200. | 10 |
Here are the details of above response.
twitterLinksSearch MethodThe TwitterLinksSearch method searches for relevant links from X (Twitter) based on AI-enhanced queries, leveraging AI-powered models.
| Parameter | Type | Description | Default |
|---|---|---|---|
| prompt | string | Search query prompt | Bittensor |
| count | int | The number of results to return per source. Min 10. Max 200. | 10 |
basicWebSearch MethodThis API allows users to search for any information over the web. This replicates a typical search engine experience, where users can search for any information they need.
| Parameter | Type | Description | Default |
|---|---|---|---|
| query | string | The search query for retrieving relevant web result | latest news on AI |
| num | number | The number of search results to return | 10 |
| start | number | The starting index for search results pagination | 0 |
basicTwitterSearch MethodThe Basic X (Twitter) Search API allows users to search for relevant links or tweets based on X (Twitter) search queries without leveraging AI-powered models.
| Parameter | Type | Description | Default |
|---|---|---|---|
| query | string | Search query prompt | Whats going on with Bittensor |
| sort | string | Sort order of the search results | Top |
| user | string | User to search for tweets | elonmusk |
| start_date | string | Start date for the search | 2024-12-01 |
| end_date | string | End date for the search | 2025-02-25 |
| lang | string | Language of the tweets | en |
| verified | bool | Filter for verified users | true |
| blue_verified | bool | Filter for blue verified users | true |
| is_quote | bool | Filter for quoted tweets | true |
| is_video | bool | Filter for video tweets | true |
| is_image | bool | Filter for image tweets | true |
| min_retweets | int | Minimum number of retweets | 1 |
| min_replies | int | Minimum number of replies | 1 |
| min_likes | int | Minimum number of likes | 1 |
| count | int | Number of tweets to retrieve | 10 |
webLinksSearch MethodThis API allows users to search for links related to a given query using multiple tools, excluding X (Twitter) Search.
| Parameter | Type | Description | Default |
|---|---|---|---|
| prompt | string | Search query prompt | Bittensor |
| tools | List[string] | List of tools to search with An enumeration. | [ "Web Search", "Hacker News Search","Reddit Search","Wikipedia Search","Youtube Search","Twitter Search", "ArXiv Search"] |
| count | int | The number of results to return per source. Min 10. Max 200. | 10 |