JavaScript SDK Specification
Enumeration of methods and types in the Desearch JavaScript SDK (desearch-js).
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.
Installation
To install the desearch-js
SDK, use the following command:
Once installed, you can initialize the Desearch client as follows:
API Key: Get API Key (Follow link to get your API key) https://console.desearch.ai/api-keys.
Methods and Usage
The Desearch SDK provides the following methods for AI-powered search:
AISearch
Method
The AISearch method allows users to perform AI-powered searches across multiple tools, retrieving links and summaries.
Example Usage
Input Parameters
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”] |
model | string | The model to be used for the search | NOVA |
date_filter | Optional[string] | The date filter to be used for the search | LINKS_FIRST |
streaming | Optional[bool] | Whether to stream results | True |
Sample Response
Here are the details of above response.
- A JSON object mapping tool names to their search results: When only streaming is False
- StreamingResponse(text_chunks): When only streaming is True
twitterLinksSearch
Method
The twitterLinksSearch method searches for relevant links from X (Twitter) based on AI-enhanced queries with leveraging AI-powered models.
Example Usage
Input Parameters
Parameter | Type | Description | Default |
---|---|---|---|
prompt | string | Search query prompt | Bittensor |
model | string | The model to be used for the search | NOVA |
Sample Response
basicWebSearch
Method
This 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.
Example Usage
Input Parameters
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 |
Sample Response
basicTwitterSearch
Method
The 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.
Example Usage
Input Parameters
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 |
Sample Response
webLinksSearch
Method
This API allows users to search for links related to a given query using multiple tools, excluding X (Twitter) Search.
Example Usage
Input Parameters
Parameter | Type | Description | Default |
---|---|---|---|
prompt | string | Search query prompt | Bittensor |
model | string | The model to be used for the search | NOVA |
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”] |