AskNews Logo Dark

🔍 Auto Filter

Auto Filter helps optimize your use of AskNews endpoints by taking a natural language description of what you need, and converting it to a targeted AskNews filter. This endpoint is not necessary in all cases, as typically a standard natural language query with good keywords is sufficient for our endpoints. However, there are many cases that require more complex and targeted news feeds/filters, such as talking directly to a specific type of news, a specific domain, and more. This endpoint helps automate this process.

This filter can be re-used in many of our endpoints, including /news, /chat, /graph, and /forecast. This enables easy portability throughout the ecosystem, for example, you may need to call the /graph endpoint to build a graph for your user, but then you want to chat with the same subset of information that was used to build the graph. Instead of trying to carry thousands of sources around in complex pipelines, you can simply use the same filter_params for /graph as you do in /chat and then your user is chatting with the graph effortlessly.

Here is an example:

"Get me all the news from the last 7 days related to European Banking and Finance, but exclude any news about Brexit."

The Auto Filter endpoint will automatically build the best filter for you that you can then pass to our other endpoints for highly optimized news research.

{
    "filter": {
        "query": "European Banking and Finance",
        "hours_back": 168,
        "categories": [
            "Finance", "Business"
        ],
        "reverse_string_guarantee": [
            "Brexit"
        ]
    }
}

This can now be passed to /graph endpoint to build a graph, then passed to /chat to chat with that graph.

The API reference provides the most detailed information

Getting for your filter

The Auto Filter endpoint is designed to automate and optimize the construction of complex targeted search queries in the AskNews ecosystem.

Your response object is a dictionary of parameters that match those available in the /news endpoint, and can be passed directly to the /news endpoint, as well as anywhere that filter_params are accepted, such as /graph, /chat, and /forecast endpoints.

{
    "filter": {
        "query": "European Banking and Finance",
        "hours_back": 168,
        "categories": [
            "Finance", "Business"
        ],
        "reverse_string_guarantee": [
            "Brexit"
        ]
    }
}


Which can be passed directly to the /news endpoint:

```py tab={"label":"Python (sync)"}
response = ask.news.search_news(
  n_articles=10,
  **autofilter.model_json(mode="json")
)

Availability

The AutoFilter endpoint costs 5 fast API calls. For updated pricing information, please check out the pricing page.

    We use cookies

    We use cookies to ensure you get the best experience on our website. Some of these cookies are provided by third parties. You are free to decide which categories you would like to permit and can withdraw this consent at any time (via cookie preferences link on the footer).

    By accepting the necessary cookies, you agree to our privacy policy and terms of service, both located in the footer of the website.
    Learn more on our terms of service and privacy policy.