SlackReader#

pydantic model llama_index.readers.SlackReader#

Slack reader.

Reads conversations from channels. If an earliest_date is provided, an optional latest_date can also be provided. If no latest_date is provided, we assume the latest date is the current timestamp.

Parameters
  • slack_token (Optional[str]) – Slack token. If not provided, we assume the environment variable SLACK_BOT_TOKEN is set.

  • ssl (Optional[str]) – Custom SSL context. If not provided, it is assumed there is already an SSL context available.

  • earliest_date (Optional[datetime]) – Earliest date from which to read conversations. If not provided, we read all messages.

  • latest_date (Optional[datetime]) – Latest date from which to read conversations. If not provided, defaults to current timestamp in combination with earliest_date.

Show JSON schema
{
   "title": "SlackReader",
   "description": "Slack reader.\n\nReads conversations from channels. If an earliest_date is provided, an\noptional latest_date can also be provided. If no latest_date is provided,\nwe assume the latest date is the current timestamp.\n\nArgs:\n    slack_token (Optional[str]): Slack token. If not provided, we\n        assume the environment variable `SLACK_BOT_TOKEN` is set.\n    ssl (Optional[str]): Custom SSL context. If not provided, it is assumed\n        there is already an SSL context available.\n    earliest_date (Optional[datetime]): Earliest date from which\n        to read conversations. If not provided, we read all messages.\n    latest_date (Optional[datetime]): Latest date from which to\n        read conversations. If not provided, defaults to current timestamp\n        in combination with earliest_date.",
   "type": "object",
   "properties": {
      "is_remote": {
         "title": "Is Remote",
         "default": true,
         "type": "boolean"
      },
      "slack_token": {
         "title": "Slack Token",
         "type": "string"
      },
      "earliest_date_timestamp": {
         "title": "Earliest Date Timestamp",
         "type": "number"
      },
      "latest_date_timestamp": {
         "title": "Latest Date Timestamp",
         "type": "number"
      },
      "class_name": {
         "title": "Class Name",
         "type": "string",
         "default": "SlackReader"
      }
   },
   "required": [
      "slack_token",
      "latest_date_timestamp"
   ]
}

Config
  • arbitrary_types_allowed: bool = True

Fields
  • earliest_date_timestamp (Optional[float])

  • is_remote (bool)

  • latest_date_timestamp (float)

  • slack_token (str)

field earliest_date_timestamp: Optional[float] = None#
field is_remote: bool = True#
field latest_date_timestamp: float [Required]#
field slack_token: str [Required]#
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(channel_ids: List[str], reverse_chronological: bool = True) List[Document]#

Load data from the input directory.

Parameters

channel_ids (List[str]) – List of channel ids to read.

Returns

List of documents.

Return type

List[Document]