Python SDK Specification
Enumeration of methods and types in the Desearch Python SDK (desearch_py).
The Desearch Python 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-py
SDK, use the following command:
Once installed, you can instantiate 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 Python SDK provides the following methods for AI-powered search:
ai_search
Method
This endpoint provides user a feature to search for both links and summary over different tools.
Example Usage
Input Parameters
Parameter | Type | Description | Default |
---|---|---|---|
prompt | string | Search query promp | 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. The return type depends on the combination of text and highlights parameters:
- A JSON object mapping tool names to their search results: When only streaming is False
- StreamingResponse(text_chunks): When only streaming is True
twitter_links_search
Method
The X (Twitter) Posts Search API allows users to search for relevant links based on X (Twitter) search queries with leveraging AI-powered models. This API analyze links from X (Twitter) posts that match the given prompt. This API is useful for tracking trends, gathering insights, and retrieving real-time information from X (Twitter).
Example Usage
Input Parameters
Parameter | Type | Description | Default |
---|---|---|---|
prompt | str | Search query promp | Bittensor |
model | str | The model to be used for the search | NOVA |
Sample Response
BasicWebSearch
Method
This API allows users to search for links related to a given query (prompt) using multiple tools, excluding X (Twitter) Search. The API returns a list of relevant sources from selected platforms such as web pages, YouTube, Wikipedia, and ArXiv.
Example Usage
Input Parameters
Parameter | Type | Description | Default |
---|---|---|---|
prompt | string | Search query promp | 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”] |
Sample Response
basic_twitter_search
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. This API analyze links from X (Twitter) posts that match the given prompt.
Input Example:
Input Parameters
Parameter | Type | Description | Default |
---|---|---|---|
query | string | Search query. For syntax, check https://docs.desearch.ai/guides/capabilities/twitter-queries | 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 (YYYY-MM-DD format) | 2024-12-01 |
end_date | string | End date for the search (YYYY-MM-DD format) | 2025-02-25 |
lang | string | Language of the tweets (e.g., en, es, fr) | 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 | 0 |
min_replies | int | Minimum number of replies | 0 |
min_likes | int | Minimum number of likes | 0 |
count | int | Number of tweets to retrieve | 10 |
Sample Response
basic_web_search
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 | str | The search query string, e.g., ‘latest news on AI’ | latest news on AI |
num | int | Count of results to get | 10 |
start | int | How many results to skip (used for pagination with num) | 0 |