Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Add docs for slack and add missing datatype (#1023)

Sidharth Mohantybee4e834b16b
diff --git a/docs/components/data-sources/slack.mdx b/docs/components/data-sources/slack.mdx
index 1285f5335..f899fdd20 100644
--- a/docs/components/data-sources/slack.mdx
+++ b/docs/components/data-sources/slack.mdx
@@ -9,15 +9,33 @@ title: '🤖 Slack'
- Make sure your slack user token includes [search](https://api.slack.com/scopes/search:read) scope.
## Example
+
+### Get Started
+
+This will automatically retrieve data from the workspace associated with the user's token.
+
+```python
+import os
+from embedchain import Pipeline as App
+
+os.environ["SLACK_USER_TOKEN"] = "xoxp-xxx"
+app = App()
+
+app.add("in:general", data_type="slack")
+
+result = app.query("what are the messages in general channel?")
+
+print(result)
+```
+
+
+### Customize your SlackLoader
1. Setup the Slack loader by configuring the Slack Webclient.
```Python
from embedchain.loaders.slack import SlackLoader
os.environ["SLACK_USER_TOKEN"] = "xoxp-*"
-loader = SlackLoader()
-
-"""
config = {
'base_url': slack_app_url,
'headers': web_headers,
@@ -25,7 +43,6 @@ config = {
}
loader = SlackLoader(config)
-"""
```
NOTE: you can also pass the `config` with `base_url`, `headers`, `team_id` to setup your SlackLoader.
diff --git a/embedchain/data_formatter/data_formatter.py b/embedchain/data_formatter/data_formatter.py
index 0187bc409..6d3ce57eb 100644
--- a/embedchain/data_formatter/data_formatter.py
+++ b/embedchain/data_formatter/data_formatter.py
@@ -75,6 +75,7 @@ class DataFormatter(JSONSerializable):
DataType.RSSFEED: "embedchain.loaders.rss_feed.RSSFeedLoader",
DataType.BEEHIIV: "embedchain.loaders.beehiiv.BeehiivLoader",
DataType.DIRECTORY: "embedchain.loaders.directory_loader.DirectoryLoader",
+ DataType.SLACK: "embedchain.loaders.slack.SlackLoader",
}
if data_type == DataType.CUSTOM or loader is not None:
@@ -118,6 +119,7 @@ class DataFormatter(JSONSerializable):
DataType.RSSFEED: "embedchain.chunkers.rss_feed.RSSFeedChunker",
DataType.BEEHIIV: "embedchain.chunkers.beehiiv.BeehiivChunker",
DataType.DIRECTORY: "embedchain.chunkers.common_chunker.CommonChunker",
+ DataType.SLACK: "embedchain.chunkers.common_chunker.CommonChunker",
}
if chunker is not None:
diff --git a/embedchain/models/data_type.py b/embedchain/models/data_type.py
index 3b4ce6a09..93ed71f46 100644
--- a/embedchain/models/data_type.py
+++ b/embedchain/models/data_type.py
@@ -36,6 +36,7 @@ class IndirectDataType(Enum):
RSSFEED = "rss_feed"
BEEHIIV = "beehiiv"
DIRECTORY = "directory"
+ SLACK = "slack"
class SpecialDataType(Enum):
@@ -71,3 +72,4 @@ class DataType(Enum):
RSSFEED = IndirectDataType.RSSFEED.value
BEEHIIV = IndirectDataType.BEEHIIV.value
DIRECTORY = IndirectDataType.DIRECTORY.value
+ SLACK = IndirectDataType.SLACK.value