Update notebooks to work with the latest version (#870)

This commit is contained in:
Sidharth Mohanty
2023-10-30 11:36:43 +05:30
committed by GitHub
parent d3726134b2
commit 3b4409cfad
15 changed files with 374 additions and 256 deletions

View File

@@ -34,6 +34,15 @@
"!pip install embedchain" "!pip install embedchain"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@@ -54,7 +63,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import os\n", "import os\n",
"from embedchain import App\n", "from embedchain import Pipeline as App\n",
"\n", "\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"\n", "os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"\n",
"os.environ[\"ANTHROPIC_API_KEY\"] = \"xxx\"" "os.environ[\"ANTHROPIC_API_KEY\"] = \"xxx\""

View File

@@ -26,6 +26,16 @@
"!pip install embedchain" "!pip install embedchain"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "692ff37b",
"metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "ac982a56", "id": "ac982a56",
@@ -44,7 +54,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import os\n", "import os\n",
"from embedchain import App\n", "from embedchain import Pipeline as App\n",
"\n", "\n",
"os.environ[\"OPENAI_API_TYPE\"] = \"azure\"\n", "os.environ[\"OPENAI_API_TYPE\"] = \"azure\"\n",
"os.environ[\"OPENAI_API_BASE\"] = \"https://xxx.openai.azure.com/\"\n", "os.environ[\"OPENAI_API_BASE\"] = \"https://xxx.openai.azure.com/\"\n",

View File

@@ -1,84 +1,84 @@
{ {
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"## Cookbook for using ChromaDB with Embedchain"
],
"metadata": { "metadata": {
"id": "b02n_zJ_hl3d" "id": "b02n_zJ_hl3d"
} },
"source": [
"## Cookbook for using ChromaDB with Embedchain"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-1: Install embedchain package"
],
"metadata": { "metadata": {
"id": "gyJ6ui2vhtMY" "id": "gyJ6ui2vhtMY"
} },
"source": [
"### Step-1: Install embedchain package"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"!pip install embedchain"
],
"metadata": { "metadata": {
"id": "-NbXjAdlh0vJ" "id": "-NbXjAdlh0vJ"
}, },
"outputs": [],
"source": [
"!pip install embedchain"
]
},
{
"cell_type": "code",
"execution_count": null, "execution_count": null,
"outputs": [] "metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {
"id": "nGnpSYAAh2bQ"
},
"source": [ "source": [
"### Step-2: Set OpenAI environment variables\n", "### Step-2: Set OpenAI environment variables\n",
"\n", "\n",
"You can find this env variable on your [OpenAI dashboard](https://platform.openai.com/account/api-keys)." "You can find this env variable on your [OpenAI dashboard](https://platform.openai.com/account/api-keys)."
], ]
"metadata": {
"id": "nGnpSYAAh2bQ"
}
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"import os\n",
"from embedchain import App\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\""
],
"metadata": { "metadata": {
"id": "0fBdQ9GAiRvK" "id": "0fBdQ9GAiRvK"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"import os\n",
"from embedchain import Pipeline as App\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\""
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-3: Define your Vector Database config"
],
"metadata": { "metadata": {
"id": "Ns6RhPfbiitr" "id": "Ns6RhPfbiitr"
} },
"source": [
"### Step-3: Define your Vector Database config"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": {
"id": "S9CkxVjriotB"
},
"outputs": [],
"source": [ "source": [
"config = \"\"\"\n", "config = \"\"\"\n",
"vectordb:\n", "vectordb:\n",
@@ -95,64 +95,64 @@
"# Write the multi-line string to a YAML file\n", "# Write the multi-line string to a YAML file\n",
"with open('chromadb.yaml', 'w') as file:\n", "with open('chromadb.yaml', 'w') as file:\n",
" file.write(config)" " file.write(config)"
], ]
"metadata": {
"id": "S9CkxVjriotB"
},
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-4 Create embedchain app based on the config"
],
"metadata": { "metadata": {
"id": "PGt6uPLIi1CS" "id": "PGt6uPLIi1CS"
} },
"source": [
"### Step-4 Create embedchain app based on the config"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"app = App.from_config(yaml_path=\"chromadb.yaml\")"
],
"metadata": { "metadata": {
"id": "Amzxk3m-i3tD" "id": "Amzxk3m-i3tD"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"app = App.from_config(yaml_path=\"chromadb.yaml\")"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-5: Add data sources to your app"
],
"metadata": { "metadata": {
"id": "XNXv4yZwi7ef" "id": "XNXv4yZwi7ef"
} },
"source": [
"### Step-5: Add data sources to your app"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"app.add(\"https://www.forbes.com/profile/elon-musk\")"
],
"metadata": { "metadata": {
"id": "Sn_0rx9QjIY9" "id": "Sn_0rx9QjIY9"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"app.add(\"https://www.forbes.com/profile/elon-musk\")"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-6: All set. Now start asking questions related to your data"
],
"metadata": { "metadata": {
"id": "_7W6fDeAjMAP" "id": "_7W6fDeAjMAP"
} },
"source": [
"### Step-6: All set. Now start asking questions related to your data"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": {
"id": "cvIK7dWRjN_f"
},
"outputs": [],
"source": [ "source": [
"while(True):\n", "while(True):\n",
" question = input(\"Enter question: \")\n", " question = input(\"Enter question: \")\n",
@@ -160,12 +160,21 @@
" break\n", " break\n",
" answer = app.query(question)\n", " answer = app.query(question)\n",
" print(answer)" " print(answer)"
], ]
"metadata": {
"id": "cvIK7dWRjN_f"
},
"execution_count": null,
"outputs": []
} }
] ],
} "metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}

View File

@@ -33,6 +33,15 @@
"!pip install embedchain" "!pip install embedchain"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@@ -69,7 +78,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import os\n", "import os\n",
"from embedchain import App\n", "from embedchain import Pipeline as App\n",
"\n", "\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"\n", "os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"\n",
"os.environ[\"COHERE_API_KEY\"] = \"xxx\"" "os.environ[\"COHERE_API_KEY\"] = \"xxx\""

View File

@@ -1,95 +1,95 @@
{ {
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"## Cookbook for using ElasticSearchDB with Embedchain"
],
"metadata": { "metadata": {
"id": "b02n_zJ_hl3d" "id": "b02n_zJ_hl3d"
} },
"source": [
"## Cookbook for using ElasticSearchDB with Embedchain"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-1: Install embedchain package"
],
"metadata": { "metadata": {
"id": "gyJ6ui2vhtMY" "id": "gyJ6ui2vhtMY"
} },
"source": [
"### Step-1: Install embedchain package"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"!pip install embedchain"
],
"metadata": { "metadata": {
"id": "-NbXjAdlh0vJ" "id": "-NbXjAdlh0vJ"
}, },
"outputs": [],
"source": [
"!pip install embedchain"
]
},
{
"cell_type": "code",
"execution_count": null, "execution_count": null,
"outputs": [] "metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {
"id": "nGnpSYAAh2bQ"
},
"source": [ "source": [
"### Step-2: Set OpenAI environment variables and install the dependencies.\n", "### Step-2: Set OpenAI environment variables and install the dependencies.\n",
"\n", "\n",
"You can find this env variable on your [OpenAI dashboard](https://platform.openai.com/account/api-keys). Now lets install the dependencies needed for Elasticsearch." "You can find this env variable on your [OpenAI dashboard](https://platform.openai.com/account/api-keys). Now lets install the dependencies needed for Elasticsearch."
], ]
"metadata": {
"id": "nGnpSYAAh2bQ"
}
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"!pip install --upgrade 'embedchain[elasticsearch]'"
],
"metadata": { "metadata": {
"id": "-MUFRfxV7Jk7" "id": "-MUFRfxV7Jk7"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"!pip install --upgrade 'embedchain[elasticsearch]'"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"import os\n",
"from embedchain import App\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\""
],
"metadata": { "metadata": {
"id": "0fBdQ9GAiRvK" "id": "0fBdQ9GAiRvK"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"import os\n",
"from embedchain import Pipeline as App\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\""
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-3: Define your Vector Database config"
],
"metadata": { "metadata": {
"id": "Ns6RhPfbiitr" "id": "Ns6RhPfbiitr"
} },
"source": [
"### Step-3: Define your Vector Database config"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": {
"id": "S9CkxVjriotB"
},
"outputs": [],
"source": [ "source": [
"config = \"\"\"\n", "config = \"\"\"\n",
"vectordb:\n", "vectordb:\n",
@@ -104,64 +104,64 @@
"# Write the multi-line string to a YAML file\n", "# Write the multi-line string to a YAML file\n",
"with open('elasticsearch.yaml', 'w') as file:\n", "with open('elasticsearch.yaml', 'w') as file:\n",
" file.write(config)" " file.write(config)"
], ]
"metadata": {
"id": "S9CkxVjriotB"
},
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-4 Create embedchain app based on the config"
],
"metadata": { "metadata": {
"id": "PGt6uPLIi1CS" "id": "PGt6uPLIi1CS"
} },
"source": [
"### Step-4 Create embedchain app based on the config"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"app = App.from_config(yaml_path=\"elasticsearch.yaml\")"
],
"metadata": { "metadata": {
"id": "Amzxk3m-i3tD" "id": "Amzxk3m-i3tD"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"app = App.from_config(yaml_path=\"elasticsearch.yaml\")"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-5: Add data sources to your app"
],
"metadata": { "metadata": {
"id": "XNXv4yZwi7ef" "id": "XNXv4yZwi7ef"
} },
"source": [
"### Step-5: Add data sources to your app"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"app.add(\"https://www.forbes.com/profile/elon-musk\")"
],
"metadata": { "metadata": {
"id": "Sn_0rx9QjIY9" "id": "Sn_0rx9QjIY9"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"app.add(\"https://www.forbes.com/profile/elon-musk\")"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-6: All set. Now start asking questions related to your data"
],
"metadata": { "metadata": {
"id": "_7W6fDeAjMAP" "id": "_7W6fDeAjMAP"
} },
"source": [
"### Step-6: All set. Now start asking questions related to your data"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": {
"id": "cvIK7dWRjN_f"
},
"outputs": [],
"source": [ "source": [
"while(True):\n", "while(True):\n",
" question = input(\"Enter question: \")\n", " question = input(\"Enter question: \")\n",
@@ -169,12 +169,21 @@
" break\n", " break\n",
" answer = app.query(question)\n", " answer = app.query(question)\n",
" print(answer)" " print(answer)"
], ]
"metadata": {
"id": "cvIK7dWRjN_f"
},
"execution_count": null,
"outputs": []
} }
] ],
} "metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}

View File

@@ -33,7 +33,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import os\n", "import os\n",
"from embedchain import App\n", "from embedchain import Pipeline as App\n",
"from embedchain.config import AppConfig\n", "from embedchain.config import AppConfig\n",
"\n", "\n",
"\n", "\n",

View File

@@ -7,7 +7,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"from embedchain import App\n", "from embedchain import Pipeline as App\n",
"\n", "\n",
"embedchain_docs_bot = App()" "embedchain_docs_bot = App()"
] ]

View File

@@ -33,6 +33,15 @@
"!pip install embedchain" "!pip install embedchain"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@@ -67,7 +76,7 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"from embedchain import App" "from embedchain import Pipeline as App"
] ]
}, },
{ {

View File

@@ -34,6 +34,15 @@
"!pip install embedchain" "!pip install embedchain"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@@ -84,7 +93,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import os\n", "import os\n",
"from embedchain import App\n", "from embedchain import Pipeline as App\n",
"\n", "\n",
"os.environ[\"HUGGINGFACE_ACCESS_TOKEN\"] = \"hf_xxx\"" "os.environ[\"HUGGINGFACE_ACCESS_TOKEN\"] = \"hf_xxx\""
] ]

View File

@@ -34,6 +34,15 @@
"!pip install embedchain" "!pip install embedchain"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@@ -54,7 +63,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import os\n", "import os\n",
"from embedchain import App\n", "from embedchain import Pipeline as App\n",
"\n", "\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"\n", "os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"\n",
"os.environ[\"JINACHAT_API_KEY\"] = \"xxx\"" "os.environ[\"JINACHAT_API_KEY\"] = \"xxx\""

View File

@@ -33,6 +33,15 @@
"!pip install embedchain" "!pip install embedchain"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@@ -64,7 +73,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import os\n", "import os\n",
"from embedchain import App\n", "from embedchain import Pipeline as App\n",
"\n", "\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"\n", "os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"\n",
"os.environ[\"REPLICATE_API_TOKEN\"] = \"xxx\"" "os.environ[\"REPLICATE_API_TOKEN\"] = \"xxx\""

View File

@@ -34,6 +34,15 @@
"!pip install embedchain" "!pip install embedchain"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@@ -54,7 +63,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import os\n", "import os\n",
"from embedchain import App\n", "from embedchain import Pipeline as App\n",
"\n", "\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"" "os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\""
] ]

View File

@@ -1,95 +1,95 @@
{ {
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"## Cookbook for using OpenSearchDB with Embedchain"
],
"metadata": { "metadata": {
"id": "b02n_zJ_hl3d" "id": "b02n_zJ_hl3d"
} },
"source": [
"## Cookbook for using OpenSearchDB with Embedchain"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-1: Install embedchain package"
],
"metadata": { "metadata": {
"id": "gyJ6ui2vhtMY" "id": "gyJ6ui2vhtMY"
} },
"source": [
"### Step-1: Install embedchain package"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"!pip install embedchain"
],
"metadata": { "metadata": {
"id": "-NbXjAdlh0vJ" "id": "-NbXjAdlh0vJ"
}, },
"outputs": [],
"source": [
"!pip install embedchain"
]
},
{
"cell_type": "code",
"execution_count": null, "execution_count": null,
"outputs": [] "metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {
"id": "nGnpSYAAh2bQ"
},
"source": [ "source": [
"### Step-2: Set OpenAI environment variables and install the dependencies.\n", "### Step-2: Set OpenAI environment variables and install the dependencies.\n",
"\n", "\n",
"You can find this env variable on your [OpenAI dashboard](https://platform.openai.com/account/api-keys). Now lets install the dependencies needed for Opensearch." "You can find this env variable on your [OpenAI dashboard](https://platform.openai.com/account/api-keys). Now lets install the dependencies needed for Opensearch."
], ]
"metadata": {
"id": "nGnpSYAAh2bQ"
}
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"!pip install --upgrade 'embedchain[opensearch]'"
],
"metadata": { "metadata": {
"id": "-MUFRfxV7Jk7" "id": "-MUFRfxV7Jk7"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"!pip install --upgrade 'embedchain[opensearch]'"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"import os\n",
"from embedchain import App\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\""
],
"metadata": { "metadata": {
"id": "0fBdQ9GAiRvK" "id": "0fBdQ9GAiRvK"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"import os\n",
"from embedchain import Pipeline as App\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\""
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-3: Define your Vector Database config"
],
"metadata": { "metadata": {
"id": "Ns6RhPfbiitr" "id": "Ns6RhPfbiitr"
} },
"source": [
"### Step-3: Define your Vector Database config"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": {
"id": "S9CkxVjriotB"
},
"outputs": [],
"source": [ "source": [
"config = \"\"\"\n", "config = \"\"\"\n",
"vectordb:\n", "vectordb:\n",
@@ -108,64 +108,64 @@
"# Write the multi-line string to a YAML file\n", "# Write the multi-line string to a YAML file\n",
"with open('opensearch.yaml', 'w') as file:\n", "with open('opensearch.yaml', 'w') as file:\n",
" file.write(config)" " file.write(config)"
], ]
"metadata": {
"id": "S9CkxVjriotB"
},
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-4 Create embedchain app based on the config"
],
"metadata": { "metadata": {
"id": "PGt6uPLIi1CS" "id": "PGt6uPLIi1CS"
} },
"source": [
"### Step-4 Create embedchain app based on the config"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"app = App.from_config(yaml_path=\"opensearch.yaml\")"
],
"metadata": { "metadata": {
"id": "Amzxk3m-i3tD" "id": "Amzxk3m-i3tD"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"app = App.from_config(yaml_path=\"opensearch.yaml\")"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-5: Add data sources to your app"
],
"metadata": { "metadata": {
"id": "XNXv4yZwi7ef" "id": "XNXv4yZwi7ef"
} },
"source": [
"### Step-5: Add data sources to your app"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"app.add(\"https://www.forbes.com/profile/elon-musk\")"
],
"metadata": { "metadata": {
"id": "Sn_0rx9QjIY9" "id": "Sn_0rx9QjIY9"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"app.add(\"https://www.forbes.com/profile/elon-musk\")"
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"### Step-6: All set. Now start asking questions related to your data"
],
"metadata": { "metadata": {
"id": "_7W6fDeAjMAP" "id": "_7W6fDeAjMAP"
} },
"source": [
"### Step-6: All set. Now start asking questions related to your data"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": {
"id": "cvIK7dWRjN_f"
},
"outputs": [],
"source": [ "source": [
"while(True):\n", "while(True):\n",
" question = input(\"Enter question: \")\n", " question = input(\"Enter question: \")\n",
@@ -173,12 +173,21 @@
" break\n", " break\n",
" answer = app.query(question)\n", " answer = app.query(question)\n",
" print(answer)" " print(answer)"
], ]
"metadata": {
"id": "cvIK7dWRjN_f"
},
"execution_count": null,
"outputs": []
} }
] ],
} "metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}

View File

@@ -29,6 +29,15 @@
"!pip install embedchain" "!pip install embedchain"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@@ -60,7 +69,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import os\n", "import os\n",
"from embedchain import App\n", "from embedchain import Pipeline as App\n",
"\n", "\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"\n", "os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"\n",
"os.environ[\"PINECONE_API_KEY\"] = \"xxx\"\n", "os.environ[\"PINECONE_API_KEY\"] = \"xxx\"\n",

View File

@@ -33,6 +33,15 @@
"!pip install embedchain" "!pip install embedchain"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install embedchain[dataloaders]"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@@ -64,7 +73,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import os\n", "import os\n",
"from embedchain import App\n", "from embedchain import Pipeline as App\n",
"\n", "\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"" "os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\""
] ]