Stripe
本教程介绍了如何从Stripe REST API中加载数据到可以摄取到LangChain的格式,以及矢量化的示例用法。
import os
from langchain.document_loaders import StripeLoader
from langchain.indexes import VectorstoreIndexCreator
Stripe API需要访问令牌,该令牌可以在Stripe控制面板中找到。
此文档加载器还需要一个resource
选项,该选项定义要加载的数据。
以下资源可用:
balance_transations
Documentation (opens in a new tab)
charges
Documentation (opens in a new tab)
customers
Documentation (opens in a new tab)
events
Documentation (opens in a new tab)
refunds
Documentation (opens in a new tab)
disputes
Documentation (opens in a new tab)
stripe_loader = StripeLoader(os.environ["STRIPE_ACCESS_TOKEN"], "charges")
# Create a vectorstore retriver from the loader
# see https://python.langchain.com/en/latest/modules/indexes/getting_started for more details
index = VectorstoreIndexCreator().from_loaders([stripe_loader])
stripe_doc_retriever = index.vectorstore.as_retriever()