From 9ff8f69e7579434f09c654fa55272e74db77fe2c Mon Sep 17 00:00:00 2001 From: Leonid Ganeline Date: Thu, 16 Nov 2023 13:24:05 -0800 Subject: [PATCH] DOCS updated `memory` Titles (#13435) - Fixed titles for two notebooks. They were inconsistent with other titles and clogged ToC. - Added `Upstash` description and link - Moved the authentication text up in the `Elasticsearch` nb, right after package installation. It was on the end of the page which was a wrong place. --- .../elasticsearch_chat_message_history.ipynb | 111 +++++++++--------- .../upstash_redis_chat_message_history.ipynb | 15 +-- 2 files changed, 64 insertions(+), 62 deletions(-) diff --git a/docs/docs/integrations/memory/elasticsearch_chat_message_history.ipynb b/docs/docs/integrations/memory/elasticsearch_chat_message_history.ipynb index 00e8cb18dc..36dcecb62a 100644 --- a/docs/docs/integrations/memory/elasticsearch_chat_message_history.ipynb +++ b/docs/docs/integrations/memory/elasticsearch_chat_message_history.ipynb @@ -7,11 +7,11 @@ "id": "683953b3" }, "source": [ - "# Elasticsearch Chat Message History\n", + "# Elasticsearch\n", "\n", ">[Elasticsearch](https://www.elastic.co/elasticsearch/) is a distributed, RESTful search and analytics engine, capable of performing both vector and lexical search. It is built on top of the Apache Lucene library.\n", "\n", - "This notebook shows how to use chat message history functionality with Elasticsearch." + "This notebook shows how to use chat message history functionality with `Elasticsearch`." ] }, { @@ -46,6 +46,59 @@ "%pip install elasticsearch langchain" ] }, + { + "cell_type": "markdown", + "id": "c46c216c", + "metadata": {}, + "source": [ + "## Authentication\n", + "\n", + "### How to obtain a password for the default \"elastic\" user\n", + "\n", + "To obtain your Elastic Cloud password for the default \"elastic\" user:\n", + "1. Log in to the [Elastic Cloud console](https://cloud.elastic.co)\n", + "2. Go to \"Security\" > \"Users\"\n", + "3. Locate the \"elastic\" user and click \"Edit\"\n", + "4. Click \"Reset password\"\n", + "5. Follow the prompts to reset the password\n", + "\n", + "\n", + "### Use the Username/password\n", + "\n", + "```python\n", + "es_username = os.environ.get(\"ES_USERNAME\", \"elastic\")\n", + "es_password = os.environ.get(\"ES_PASSWORD\", \"change me...\")\n", + "\n", + "history = ElasticsearchChatMessageHistory(\n", + " es_url=es_url,\n", + " es_user=es_username,\n", + " es_password=es_password,\n", + " index=\"test-history\",\n", + " session_id=\"test-session\"\n", + ")\n", + "```\n", + "\n", + "### How to obtain an API key\n", + "\n", + "To obtain an API key:\n", + "1. Log in to the [Elastic Cloud console](https://cloud.elastic.co)\n", + "2. Open `Kibana` and go to Stack Management > API Keys\n", + "3. Click \"Create API key\"\n", + "4. Enter a name for the API key and click \"Create\"\n", + "\n", + "### Use the API key\n", + "\n", + "```python\n", + "es_api_key = os.environ.get(\"ES_API_KEY\")\n", + "\n", + "history = ElasticsearchChatMessageHistory(\n", + " es_api_key=es_api_key,\n", + " index=\"test-history\",\n", + " session_id=\"test-session\"\n", + ")\n", + "```\n" + ] + }, { "cell_type": "markdown", "id": "8be8fcc3", @@ -104,58 +157,6 @@ "history.add_user_message(\"hi!\")\n", "history.add_ai_message(\"whats up?\")" ] - }, - { - "cell_type": "markdown", - "id": "c46c216c", - "metadata": {}, - "source": [ - "# Authentication\n", - "\n", - "## Username/password\n", - "\n", - "```python\n", - "es_username = os.environ.get(\"ES_USERNAME\", \"elastic\")\n", - "es_password = os.environ.get(\"ES_PASSWORD\", \"changeme\")\n", - "\n", - "history = ElasticsearchChatMessageHistory(\n", - " es_url=es_url,\n", - " es_user=es_username,\n", - " es_password=es_password,\n", - " index=\"test-history\",\n", - " session_id=\"test-session\"\n", - ")\n", - "```\n", - "\n", - "### How to obtain a password for the default \"elastic\" user\n", - "\n", - "To obtain your Elastic Cloud password for the default \"elastic\" user:\n", - "1. Log in to the Elastic Cloud console at https://cloud.elastic.co\n", - "2. Go to \"Security\" > \"Users\"\n", - "3. Locate the \"elastic\" user and click \"Edit\"\n", - "4. Click \"Reset password\"\n", - "5. Follow the prompts to reset the password\n", - "\n", - "## API key\n", - "\n", - "```python\n", - "es_api_key = os.environ.get(\"ES_API_KEY\")\n", - "\n", - "history = ElasticsearchChatMessageHistory(\n", - " es_api_key=es_api_key,\n", - " index=\"test-history\",\n", - " session_id=\"test-session\"\n", - ")\n", - "```\n", - "\n", - "### How to obtain an API key\n", - "\n", - "To obtain an API key:\n", - "1. Log in to the Elastic Cloud console at https://cloud.elastic.co\n", - "2. Open Kibana and go to Stack Management > API Keys\n", - "3. Click \"Create API key\"\n", - "4. Enter a name for the API key and click \"Create\"" - ] } ], "metadata": { @@ -177,7 +178,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.9" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/docs/docs/integrations/memory/upstash_redis_chat_message_history.ipynb b/docs/docs/integrations/memory/upstash_redis_chat_message_history.ipynb index 4a44ebfeeb..0e7db59aad 100644 --- a/docs/docs/integrations/memory/upstash_redis_chat_message_history.ipynb +++ b/docs/docs/integrations/memory/upstash_redis_chat_message_history.ipynb @@ -4,9 +4,11 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Upstash Redis Chat Message History\n", + "# Upstash Redis\n", "\n", - "This notebook goes over how to use Upstash Redis to store chat message history." + ">[Upstash](https://upstash.com/docs/introduction) is a provider of the serverless `Redis`, `Kafka`, and `QStash` APIs.\n", + "\n", + "This notebook goes over how to use `Upstash Redis` to store chat message history." ] }, { @@ -42,7 +44,7 @@ ], "metadata": { "kernelspec": { - "display_name": ".venv", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -56,10 +58,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.3" - }, - "orig_nbformat": 4 + "version": "3.10.12" + } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 }