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.
To install the desearch-py SDK, use the following command.
Once installed, you can instantiate 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 Python SDK provides the following methods for AI-powered search:
ai_search MethodThis endpoint provides users a feature to search for both links and summaries over different tools.
| 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 the above response. The return type depends on the combination of text and highlights parameters:
twitter_links_search MethodThe X (Twitter) Posts Search API allows users to search for relevant links based on X (Twitter) search queries by leveraging AI-powered models. This API analyzes 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).
| Parameter | Type | Description | Default |
|---|---|---|---|
| prompt | str | 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 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.
| 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 |
basic_twitter_search 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. This API analyzes links from X (Twitter) posts that match the given prompt.
| 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 |
basic_web_search MethodThis API allows users to search for any information on the web. This replicates a typical search engine experience, where users can search for any information they need.
| 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 |