mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-18 05:21:21 +00:00
ran ```bash g grep -l "langchain.vectorstores" | xargs -L 1 sed -i '' "s/langchain\.vectorstores/langchain_community.vectorstores/g" g grep -l "langchain.document_loaders" | xargs -L 1 sed -i '' "s/langchain\.document_loaders/langchain_community.document_loaders/g" g grep -l "langchain.chat_loaders" | xargs -L 1 sed -i '' "s/langchain\.chat_loaders/langchain_community.chat_loaders/g" g grep -l "langchain.document_transformers" | xargs -L 1 sed -i '' "s/langchain\.document_transformers/langchain_community.document_transformers/g" g grep -l "langchain\.graphs" | xargs -L 1 sed -i '' "s/langchain\.graphs/langchain_community.graphs/g" g grep -l "langchain\.memory\.chat_message_histories" | xargs -L 1 sed -i '' "s/langchain\.memory\.chat_message_histories/langchain_community.chat_message_histories/g" gco master libs/langchain/tests/unit_tests/*/test_imports.py gco master libs/langchain/tests/unit_tests/**/test_public_api.py ```
94 lines
2.7 KiB
Plaintext
94 lines
2.7 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"attachments": {},
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Stripe\n",
|
|
"\n",
|
|
">[Stripe](https://stripe.com/en-ca) 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.\n",
|
|
"\n",
|
|
"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."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from langchain.indexes import VectorstoreIndexCreator\n",
|
|
"from langchain_community.document_loaders import StripeLoader"
|
|
]
|
|
},
|
|
{
|
|
"attachments": {},
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"The Stripe API requires an access token, which can be found inside of the Stripe dashboard.\n",
|
|
"\n",
|
|
"This document loader also requires a `resource` option which defines what data you want to load.\n",
|
|
"\n",
|
|
"Following resources are available:\n",
|
|
"\n",
|
|
"`balance_transations` [Documentation](https://stripe.com/docs/api/balance_transactions/list)\n",
|
|
"\n",
|
|
"`charges` [Documentation](https://stripe.com/docs/api/charges/list)\n",
|
|
"\n",
|
|
"`customers` [Documentation](https://stripe.com/docs/api/customers/list)\n",
|
|
"\n",
|
|
"`events` [Documentation](https://stripe.com/docs/api/events/list)\n",
|
|
"\n",
|
|
"`refunds` [Documentation](https://stripe.com/docs/api/refunds/list)\n",
|
|
"\n",
|
|
"`disputes` [Documentation](https://stripe.com/docs/api/disputes/list)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"stripe_loader = StripeLoader(\"charges\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Create a vectorstore retriever from the loader\n",
|
|
"# see https://python.langchain.com/en/latest/modules/data_connection/getting_started.html for more details\n",
|
|
"\n",
|
|
"index = VectorstoreIndexCreator().from_loaders([stripe_loader])\n",
|
|
"stripe_doc_retriever = index.vectorstore.as_retriever()"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.10.6"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
}
|