From ac649800df70dc9d882fc212579fe46ca03d0613 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Tue, 30 Jul 2024 10:07:57 -0700 Subject: [PATCH] docs[patch]: Adds kv store integration docs template (#24804) --- .../integration_template/docs/kv_store.ipynb | 185 ++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 libs/cli/langchain_cli/integration_template/docs/kv_store.ipynb diff --git a/libs/cli/langchain_cli/integration_template/docs/kv_store.ipynb b/libs/cli/langchain_cli/integration_template/docs/kv_store.ipynb new file mode 100644 index 00000000000..f346a17d780 --- /dev/null +++ b/libs/cli/langchain_cli/integration_template/docs/kv_store.ipynb @@ -0,0 +1,185 @@ +{ + "cells": [ + { + "cell_type": "raw", + "metadata": { + "vscode": { + "languageId": "raw" + } + }, + "source": [ + "---\n", + "sidebar_label: __ModuleName__ByteStore\n", + "---" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# __ModuleName__ByteStore\n", + "\n", + "- TODO: Make sure API reference link is correct.\n", + "\n", + "This will help you getting started with __ModuleName__ [key-value stores](/docs/concepts/#key-value-stores). For detailed documentation of all __ModuleName__ByteStore features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/stores/langchain_core.stores.__module_name__ByteStore.html).\n", + "\n", + "- TODO: Add any other relevant links, like information about models, prices, context windows, etc. See https://python.langchain.com/v0.2/docs/integrations/stores/in_memory/ for an example.\n", + "\n", + "## Overview\n", + "\n", + "- TODO: (Optional) A short introduciton to the underlying technology/API.\n", + "\n", + "### Integration details\n", + "\n", + "- TODO: Fill in table features.\n", + "- TODO: Remove JS support link if not relevant, otherwise ensure link is correct.\n", + "- TODO: Make sure API reference links are correct.\n", + "\n", + "| Class | Package | Local | [JS support](https://js.langchain.com/v0.2/docs/integrations/stores/_package_name_) | Package downloads | Package latest |\n", + "| :--- | :--- | :---: | :---: | :---: | :---: | :---: |\n", + "| [__ModuleName__ByteStore](https://api.python.langchain.com/en/latest/stores/__module_name__.stores.__ModuleName__ByteStore.html) | [__package_name__](https://api.python.langchain.com/en/latest/__package_name_short_snake___api_reference.html) | ✅/❌ | ✅/❌ | ![PyPI - Downloads](https://img.shields.io/pypi/dm/__package_name__?style=flat-square&label=%20) | ![PyPI - Version](https://img.shields.io/pypi/v/__package_name__?style=flat-square&label=%20) |\n", + "\n", + "## Setup\n", + "\n", + "- TODO: Update with relevant info.\n", + "\n", + "To create a __ModuleName__ byte store, you'll need to create a/an __ModuleName__ account, get an API key, and install the `__package_name__` integration package.\n", + "\n", + "### Credentials\n", + "\n", + "- TODO: Update with relevant info, or omit if the service does not require any credentials.\n", + "\n", + "Head to (TODO: link) to sign up to __ModuleName__ and generate an API key. Once you've done this set the __MODULE_NAME___API_KEY environment variable:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import getpass\n", + "import os\n", + "\n", + "if not os.getenv(\"__MODULE_NAME___API_KEY\"):\n", + " os.environ[\"__MODULE_NAME___API_KEY\"] = getpass.getpass(\"Enter your __ModuleName__ API key: \")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Installation\n", + "\n", + "The LangChain __ModuleName__ integration lives in the `__package_name__` package:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%pip install -qU __package_name__" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Instantiation\n", + "\n", + "Now we can instantiate our byte store:\n", + "\n", + "- TODO: Update model instantiation with relevant params." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from __module_name__ import __ModuleName__ByteStore\n", + "\n", + "kv_store = __ModuleName__ByteStore(\n", + " # params...\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Usage\n", + "\n", + "- TODO: Run cells so output can be seen." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "kv_store.mset([\n", + " [\"key1\", b\"value1\"],\n", + " [\"key2\", b\"value2\"],\n", + "])\n", + "\n", + "kv_store.mget([\n", + " \"key1\",\n", + " \"key2\",\n", + "])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "kv_store.mdelete([\n", + " \"key1\",\n", + " \"key2\",\n", + "])\n", + "\n", + "kv_store.mget([\n", + " \"key1\",\n", + " \"key2\",\n", + "])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## TODO: Any functionality specific to this key-value store provider\n", + "\n", + "E.g. extra initialization. Delete if not relevant." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## API reference\n", + "\n", + "For detailed documentation of all __ModuleName__ByteStore features and configurations head to the API reference: https://api.python.langchain.com/en/latest/stores/__module_name__.stores.__ModuleName__ByteStore.html" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python", + "version": "3.10.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}