Skip to main content
Open In ColabOpen on GitHub

Stripe

Stripe is an Irish-American financial services and software as a service (SaaS) company. It offers payment-processing software and application programming interfaces for e-commerce websites and mobile applications.

本笔记本介绍了如何将数据从 Stripe REST API 加载为可被 LangChain 摄入的格式,并提供了向量化用法的示例。

from langchain.indexes import VectorstoreIndexCreator
from langchain_community.document_loaders import StripeLoader

Stripe API 需要一个访问令牌,该令牌可在 Stripe 仪表板中找到。

此文档加载器还需要一个 resource 选项,用于定义您要加载的数据。

以下资源可用:

balance_transations 文档

charges 文档

customers 文档

events 文档

refunds 文档

disputes 文档

stripe_loader = StripeLoader("charges")
# Create a vectorstore retriever from the loader
# see https://python.langchain.com/en/latest/modules/data_connection/getting_started.html for more details

index = VectorstoreIndexCreator().from_loaders([stripe_loader])
stripe_doc_retriever = index.vectorstore.as_retriever()