The Reddit endpoint allows you to search and summarize live Reddit threads. The return object contains the top n_threads
associated to your query, where each thread is fully structured and summarized by an LLM.
The API reference provides the most detailed information
Building your query
Your query can be any phrase, keyword, question, or paragraph. If method='nl'
, then this will be used as a natural language query, but if you set method='kw'
, then this will be used as a direct keyword query. The advantage of using method='nl'
is that it allows you to match semantic information from your query. Meanwhile, with method='kw'
, is a direct search on keywords in the database. In both cases, your query can be as long as a paragraph of text.
Your search on Reddit is as simple as:
Response
The response object is a rich structure of the most relevant Reddit threads related to your query. This includes the GPT summary, extracted entities, sentiment analysis, threads, comments, upvotes, and much much more. For full details regarding the response object, please see the API reference.
If you want the full structure, you can take response.as_dicts
and it will contain this structure:
class RedditThread(BaseModel):
author: str
author_comment_karma: int
author_link_karma: int
body: str
classification: list[str] | str
comments: list[RedditComment]
comments_count: int
date: datetime
entities: RedditEntities
id: UUID
key_takeaways: list[str] = []
keywords: list[str]
sentiment: int | float
subreddit_name: str
subreddit_url: str
summary: str
title: str
topic: str
upvotes: int
url: str
class RedditComment(BaseModel):
author: str
body: str
date: datetime
upvotes: int
If you want a prompt-optimized string, ready to go directly into your LLM context window, you can take response.as_string
and it will contain this structure:
<doc>
Thread 1:
Title: <title1>
Summary: <summary1>
Published: <date1>
Sentiment: <sentiment1>
Upvotes: <upvtoes1>
Comments: <comment count1>
</doc>
<doc>
Thread2
Title: <title2>
Summary: <summary2>
Published: <date2>
Sentiment: <sentiment2>
Upvotes: <upvtoes2>
Comments: <comment count2>
</doc>
Parameters may evolve, the most updated reference is always the API reference.
Availability
The Reddit endpoint is classified as a deep
API call, which falls into a different category of pricing compared to the fast
api calls (such as the /news and /stories endpoints). All enterprise plans have full access to the Reddit endpoint. We are taking a small group of Analysts who are interested in this endpoint. If you are on the Analyst plan, and you would like access to this endpoint, please contact us by joining our Discord server or emailing us at contact@asknews.app. For other details, please check out the pricing page.