Skip to main content
Open In ColabOpen on GitHub

Trello

Trello 是一个基于网络的项目管理和协作工具,允许个人和团队组织和跟踪他们的任务和项目。它提供了一个称为“看板”的可视化界面,在这里用户可以创建列表和卡片来表示他们的任务和活动。

The TrelloLoader 允许您从 Trello 板中加载卡片,并基于 py-trello 实现

这目前只支持api_key/token

  1. Credentials generation: https://trello.com/power-ups/admin/

  2. 点击手动令牌生成链接以获取令牌。

要指定API密钥和令牌,您可以通过设置环境变量TRELLO_API_KEYTRELLO_TOKEN来完成,或者直接将api_keytoken传递给from_credentials方便构造方法。

此加载器允许您提供板名,以便拉取相应的卡片并将其转换为Document对象。

注意,在官方文档中,板的“名称”也被称为“标题”:

https://support.atlassian.com/trello/docs/changing-a-boards-title-and-description/

您也可以指定多个加载参数,以包括/移除不同的字段,这些字段既可以从文档的 page_content 属性中选择,也可以从元数据中选择。

特性

  • 从Trello板加载卡片。
  • 根据状态(打开或关闭)筛选卡片。
  • 在加载的文档中包含卡片名称、评论和待办事项清单。
  • 自定义要包含在文档中的附加元数据字段。

默认情况下,所有卡片字段都会包含在全文page_content和相应的元数据中。

%pip install --upgrade --quiet  py-trello beautifulsoup4 lxml
# If you have already set the API key and token using environment variables,
# you can skip this cell and comment out the `api_key` and `token` named arguments
# in the initialization steps below.
from getpass import getpass

API_KEY = getpass()
TOKEN = getpass()
········
········
from langchain_community.document_loaders import TrelloLoader

# Get the open cards from "Awesome Board"
loader = TrelloLoader.from_credentials(
"Awesome Board",
api_key=API_KEY,
token=TOKEN,
card_filter="open",
)
documents = loader.load()

print(documents[0].page_content)
print(documents[0].metadata)
API 参考:TrelloLoader
Review Tech partner pages
Comments:
{'title': 'Review Tech partner pages', 'id': '6475357890dc8d17f73f2dcc', 'url': 'https://trello.com/c/b0OTZwkZ/1-review-tech-partner-pages', 'labels': ['Demand Marketing'], 'list': 'Done', 'closed': False, 'due_date': ''}
# Get all the cards from "Awesome Board" but only include the
# card list(column) as extra metadata.
loader = TrelloLoader.from_credentials(
"Awesome Board",
api_key=API_KEY,
token=TOKEN,
extra_metadata=("list"),
)
documents = loader.load()

print(documents[0].page_content)
print(documents[0].metadata)
Review Tech partner pages
Comments:
{'title': 'Review Tech partner pages', 'id': '6475357890dc8d17f73f2dcc', 'url': 'https://trello.com/c/b0OTZwkZ/1-review-tech-partner-pages', 'list': 'Done'}
# Get the cards from "Another Board" and exclude the card name,
# checklist and comments from the Document page_content text.
loader = TrelloLoader.from_credentials(
"test",
api_key=API_KEY,
token=TOKEN,
include_card_name=False,
include_checklist=False,
include_comments=False,
)
documents = loader.load()

print("Document: " + documents[0].page_content)
print(documents[0].metadata)