模块
文档加载器(Document Loaders)
示例
Stripe

Stripe #

This notebook covers how to load data from the Stripe REST API into a format that can be ingested into LangChain, along with example usage for vectorization.

import os


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

The Stripe API requires an access token, which can be found inside of the Stripe dashboard.

This document loader also requires a resource option which defines what data you want to load.

Following resources are available:

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()