TwitterTweetReader#

pydantic model llama_index.readers.TwitterTweetReader#

Twitter tweets reader.

Read tweets of user twitter handle.

Check ‘https://developer.twitter.com/en/docs/twitter-api/ getting-started/getting-access-to-the-twitter-api’ on how to get access to twitter API.

Parameters
  • bearer_token (str) – bearer_token that you get from twitter API.

  • num_tweets (Optional[int]) – Number of tweets for each user twitter handle. Default is 100 tweets.

Show JSON schema
{
   "title": "TwitterTweetReader",
   "description": "Twitter tweets reader.\n\nRead tweets of user twitter handle.\n\nCheck 'https://developer.twitter.com/en/docs/twitter-api/        getting-started/getting-access-to-the-twitter-api'         on how to get access to twitter API.\n\nArgs:\n    bearer_token (str): bearer_token that you get from twitter API.\n    num_tweets (Optional[int]): Number of tweets for each user twitter handle.            Default is 100 tweets.",
   "type": "object",
   "properties": {
      "is_remote": {
         "title": "Is Remote",
         "default": true,
         "type": "boolean"
      },
      "bearer_token": {
         "title": "Bearer Token",
         "type": "string"
      },
      "num_tweets": {
         "title": "Num Tweets",
         "type": "integer"
      },
      "class_name": {
         "title": "Class Name",
         "type": "string",
         "default": "TwitterTweetReader"
      }
   },
   "required": [
      "bearer_token"
   ]
}

Config
  • arbitrary_types_allowed: bool = True

Fields
  • bearer_token (str)

  • is_remote (bool)

  • num_tweets (Optional[int])

field bearer_token: str [Required]#
field is_remote: bool = True#
field num_tweets: Optional[int] = None#
classmethod class_name() str#

Get the class name, used as a unique ID in serialization.

This provides a key that makes serialization robust against actual class name changes.

load_data(twitterhandles: List[str], num_tweets: Optional[int] = None, **load_kwargs: Any) List[Document]#

Load tweets of twitter handles.

Parameters

twitterhandles (List[str]) – List of user twitter handles to read tweets.