Bagatur/deeplake docs fixes (#9275)

Co-authored-by: adilkhan <adilkhan.sarsen@nu.edu.kz>
This commit is contained in:
Bagatur
2023-08-15 15:56:36 -07:00
committed by GitHub
parent 1b3942ba74
commit bfbb97b74c
8 changed files with 5475 additions and 878 deletions

View File

@@ -6,7 +6,7 @@
"id": "13afcae7",
"metadata": {},
"source": [
"# DeepLake self-querying \n",
"# Deep Lake self-querying \n",
"\n",
">[DeepLake](https://www.activeloop.ai) is a multimodal database for building AI applications.\n",
"\n",
@@ -19,7 +19,7 @@
"id": "68e75fb9",
"metadata": {},
"source": [
"## Creating a DeepLake vectorstore\n",
"## Creating a Deep Lake vectorstore\n",
"First we'll want to create a DeepLake VectorStore and seed it with some data. We've created a small demo set of documents that contain summaries of movies.\n",
"\n",
"NOTE: The self-query retriever requires you to have `lark` installed (`pip install lark`). We also need the `deeplake` package."
@@ -27,26 +27,23 @@
},
{
"cell_type": "code",
"execution_count": 1,
"id": "63a8af5b",
"metadata": {
"tags": []
},
"execution_count": null,
"id": "a798fe66",
"metadata": {},
"outputs": [],
"source": [
"#!pip install lark"
"# !pip install lark"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "22431060-52c4-48a7-a97b-9f542b8b0928",
"metadata": {
"tags": []
},
"id": "43821a8e",
"metadata": {},
"outputs": [],
"source": [
"#!pip install 'deeplake[enterprise]'"
"# in case if some queries fail consider installing libdeeplake manually\n",
"# !pip install libdeeplake"
]
},
{
@@ -60,7 +57,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "dd01b61b-7d32-4a55-85d6-b2d2d4f18840",
"metadata": {
"tags": []
@@ -70,12 +67,13 @@
"import os\n",
"import getpass\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key:\")"
"os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key:\")\n",
"os.environ[\"ACTIVELOOP_TOKEN\"] = getpass.getpass(\"Activeloop token:\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"id": "cb4a5787",
"metadata": {
"tags": []
@@ -108,7 +106,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"-"
"/"
]
},
{
@@ -166,9 +164,9 @@
" },\n",
" ),\n",
"]\n",
"username_or_org = \"<USER_NAME_OR_ORG>\"\n",
"username_or_org = \"<USERNAME_OR_ORG>\"\n",
"vectorstore = DeepLake.from_documents(\n",
" docs, embeddings, dataset_path=f\"hub://{username_or_org}/self_queery\"\n",
" docs, embeddings, dataset_path=f\"hub://{username_or_org}/self_queery\", overwrite=True,\n",
")"
]
},
@@ -185,10 +183,8 @@
{
"cell_type": "code",
"execution_count": 7,
"id": "86e34dbf",
"metadata": {
"tags": []
},
"id": "c90b0b40",
"metadata": {},
"outputs": [],
"source": [
"from langchain.llms import OpenAI\n",
@@ -242,7 +238,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/adilkhansarsen/Documents/work/LangChain/langchain/langchain/chains/llm.py:275: UserWarning: The predict_and_parse method is deprecated, instead pass an output parser directly to LLMChain.\n",
"/home/ubuntu/langchain_activeloop/langchain/libs/langchain/langchain/chains/llm.py:279: UserWarning: The predict_and_parse method is deprecated, instead pass an output parser directly to LLMChain.\n",
" warnings.warn(\n"
]
},
@@ -299,7 +295,9 @@
],
"source": [
"# This example only specifies a filter\n",
"retriever.get_relevant_documents(\"I want to watch a movie rated higher than 8.5\")"
"retriever.get_relevant_documents(\"I want to watch a movie rated higher than 8.5\")\n",
"\n",
"# in case if this example errored out, consider installing libdeeplake manually: `pip install libdeeplake`, and then restart notebook."
]
},
{
@@ -456,14 +454,6 @@
"# This example only specifies a relevant query\n",
"retriever.get_relevant_documents(\"what are two movies about dinosaurs\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c93f0847-cbd9-4c25-aed1-91588e856b5c",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
@@ -482,7 +472,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.10.12"
}
},
"nbformat": 4,