Skip to content

Commit

Permalink
docs: refine documentation in notebook and mdx page
Browse files Browse the repository at this point in the history
  • Loading branch information
malandis committed Oct 9, 2023
1 parent 3133ea9 commit b5b0847
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
23 changes: 9 additions & 14 deletions docs/extras/integrations/providers/momento.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Momento

> [Momento Cache](https://docs.momentohq.com/) is the world's first truly serverless caching service. It provides instant elasticity, scale-to-zero
> capability, and blazing-fast performance.
> With Momento Cache, you grab the SDK, you get an end point, input a few lines into your code, and you're off and running.
> [Momento Cache](https://docs.momentohq.com/) is the world's first truly serverless caching service, offering instant elasticity, scale-to-zero
> capability, and blazing-fast performance.
>
> [Momento Vector Index](https://docs.momentohq.com) is the most productive, easiest to use, fully serverless vector index.
> [Momento Vector Index](https://docs.momentohq.com/vector-index) stands out as the most productive, easiest-to-use, fully serverless vector index.
>
> With both of these capabilities, you have an all around solution for your LLM data needs.
> For both services, simply grab the SDK, obtain an API key, input a few lines into your code, and you're set to go. Together, they provide a comprehensive solution for your LLM data needs.
This page covers how to use the [Momento](https://gomomento.com) ecosystem within LangChain.

Expand All @@ -15,21 +14,17 @@ This page covers how to use the [Momento](https://gomomento.com) ecosystem withi
- Sign up for a free account [here](https://console.momentohq.com) to get an API key
- Install the Momento Python SDK with `pip install momento`


## Cache

The Cache wrapper allows for [Momento](https://gomomento.com) to be used as a serverless, distributed, low-latency cache for LLM prompts and responses.


The standard cache is the go-to use case for [Momento](https://gomomento.com) users in any environment.
Use Momento as a serverless, distributed, low-latency cache for LLM prompts and responses. The standard cache is the primary use case for Momento users in any environment.

Import the cache as follows:
To integrate Momento Cache into your application:

```python
from langchain.cache import MomentoCache
```

And set up like so:
Then, set it up with the following code:

```python
from datetime import timedelta
Expand Down Expand Up @@ -59,6 +54,6 @@ See [this notebook](/docs/integrations/memory/momento_chat_message_history.html)

## Vector Store

Momento Vector Index can be used as a vector store.
Momento Vector Index (MVI) can be used as a vector store.

See [this notebook](/docs/integrations/vectorstores/momento_vector_index.html) for a walkthrough of how to use Momento as a vector store.
See [this notebook](/docs/integrations/vectorstores/momento_vector_index.html) for a walkthrough of how to use MVI as a vector store.
24 changes: 12 additions & 12 deletions docs/extras/integrations/vectorstores/momento_vector_index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"source": [
"# Momento Vector Index (MVI)\n",
"\n",
">[MVI](https://gomomento.com): the most productive, easiest to use, serverless vector index for your data. To use MVI you only need to sign up for an account and you can start indexing your data. No need to provision infrastructure, no need to manage servers, no need to worry about scaling. MVI is a fully managed service that scales automatically to meet your needs.\n",
">[MVI](https://gomomento.com): the most productive, easiest to use, serverless vector index for your data. To get started with MVI, simply sign up for an account. There's no need to handle infrastructure, manage servers, or be concerned about scaling. MVI is a service that scales automatically to meet your needs.\n",
"\n",
"To sign up for access, visit the [Momento Console](https://console.gomomento.com)."
"To sign up and access MVI, visit the [Momento Console](https://console.gomomento.com)."
]
},
{
Expand Down Expand Up @@ -48,7 +48,7 @@
},
"outputs": [],
"source": [
"!pip install momento openai tiktoken"
"!pip install momento openai tiktoken\n"
]
},
{
Expand Down Expand Up @@ -93,7 +93,7 @@
"metadata": {},
"outputs": [],
"source": [
"os.environ[\"MOMENTO_API_KEY\"] = getpass.getpass(\"Momento API Key:\")"
"os.environ[\"MOMENTO_API_KEY\"] = getpass.getpass(\"Momento API Key:\")\n"
]
},
{
Expand All @@ -113,7 +113,7 @@
},
"outputs": [],
"source": [
"os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key:\")"
"os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key:\")\n"
]
},
{
Expand Down Expand Up @@ -208,7 +208,7 @@
}
],
"source": [
"len(documents[0].page_content)"
"len(documents[0].page_content)\n"
]
},
{
Expand Down Expand Up @@ -239,7 +239,7 @@
"source": [
"text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)\n",
"docs = text_splitter.split_documents(documents)\n",
"len(docs)"
"len(docs)\n"
]
},
{
Expand Down Expand Up @@ -314,7 +314,7 @@
"outputs": [],
"source": [
"query = \"What did the president say about Ketanji Brown Jackson\"\n",
"docs = vector_db.similarity_search(query)"
"docs = vector_db.similarity_search(query)\n"
]
},
{
Expand All @@ -335,7 +335,7 @@
}
],
"source": [
"docs[0].page_content"
"docs[0].page_content\n"
]
},
{
Expand Down Expand Up @@ -378,7 +378,7 @@
"outputs": [],
"source": [
"from langchain.chat_models import ChatOpenAI\n",
"from langchain.chains import RetrievalQA"
"from langchain.chains import RetrievalQA\n"
]
},
{
Expand All @@ -397,7 +397,7 @@
"outputs": [],
"source": [
"llm = ChatOpenAI(model_name=\"gpt-3.5-turbo\", temperature=0)\n",
"qa_chain = RetrievalQA.from_chain_type(llm, retriever=vector_db.as_retriever())"
"qa_chain = RetrievalQA.from_chain_type(llm, retriever=vector_db.as_retriever())\n"
]
},
{
Expand All @@ -419,7 +419,7 @@
}
],
"source": [
"qa_chain({\"query\": \"What did the president say about Ketanji Brown Jackson?\"})"
"qa_chain({\"query\": \"What did the president say about Ketanji Brown Jackson?\"})\n"
]
},
{
Expand Down

0 comments on commit b5b0847

Please sign in to comment.