_process_response
- response: The response object returned by the API call.
- return_type (str): Specifies the format of the return value. It can be “string” to return the response as a string, “dicts” to return it as a dictionary, or “both” to return both formats as a tuple.
- ValueError: If the return_type provided is invalid.
AskNewsToolkit
init
get_news
- query (str): The search query for fetching relevant news.
- n_articles (int): Number of articles to include in the response. (default: :obj:
10
) - return_type (
Literal["string", "dicts", "both"]
): The format of the return value. (default: :obj:"string"
) - method (
Literal["nl", "kw"]
): The search method, either “nl” for natural language or “kw” for keyword search. (default: :obj:"kw"
)
get_stories
- query (str): The search query for fetching relevant stories.
- categories (list): The categories to filter stories by.
- reddit (int): Number of Reddit threads to include. (default: :obj:
3
) - expand_updates (bool): Whether to include detailed updates. (default: :obj:
True
) - max_updates (int): Maximum number of recent updates per story. (default: :obj:
2
) - max_articles (int): Maximum number of articles associated with each update. (default: :obj:
10
)
get_web_search
- queries (List[str]): A list of search queries.
- return_type (
Literal["string", "dicts", "both"]
): The format of the return value. (default: :obj:"string"
)
search_reddit
- keywords (List[str]): The keywords to search for on Reddit.
- n_threads (int): Number of Reddit threads to summarize and return. (default: :obj:
5
) - return_type (
Literal["string", "dicts", "both"]
): The format of the return value. (default: :obj:"string"
) - method (
Literal["nl", "kw"]
): The search method, either “nl” for natural language or “kw” for keyword search. (default: :obj:"kw"
)
query_finance
- asset (Literal): The asset for which to fetch sentiment data.
- metric (Literal): The sentiment metric to analyze.
- return_type (
Literal["list", "string"]
): The format of the return value. (default: :obj:"string"
) - date_from (datetime, optional): The start date and time for the data in ISO 8601 format.
- date_to (datetime, optional): The end date and time for the data in ISO 8601 format.