diff --git a/notebooks/atlas-and-kai/notebook.ipynb b/notebooks/atlas-and-kai/notebook.ipynb
index 125a7e5..6114c54 100644
--- a/notebooks/atlas-and-kai/notebook.ipynb
+++ b/notebooks/atlas-and-kai/notebook.ipynb
@@ -11,7 +11,7 @@
" \n",
"
\n",
- "
\n",
- "
\n",
+ ""
]
},
@@ -224,6 +229,15 @@
"\n",
"print(response['choices'][0]['message']['content'])"
]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f1ce8da7-0868-47fd-8585-4777d26f3adc",
+ "metadata": {},
+ "source": [
+ "\n",
+ "
"
+ ]
}
],
"metadata": {
diff --git a/notebooks/launch-open-source-apps-with-langchain/notebook2.ipynb b/notebooks/launch-open-source-apps-with-langchain/notebook2.ipynb
deleted file mode 100644
index a6353c3..0000000
--- a/notebooks/launch-open-source-apps-with-langchain/notebook2.ipynb
+++ /dev/null
@@ -1,191 +0,0 @@
-{
- "cells": [
- {
- "attachments": {},
- "cell_type": "markdown",
- "id": "80fa344f",
- "metadata": {},
- "source": [
- "
\n",
- "
\n",
- "
\n",
- "
"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "7d222bd8-c86f-4887-ba76-82f0c8a8c110",
- "metadata": {},
- "outputs": [],
- "source": [
- "!pip install langchain --quiet\n",
- "!pip install openai --quiet\n",
- "!pip install singlestoredb --quiet\n",
- "!pip install tiktoken --quiet\n",
- "!pip install unstructured --quiet"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "fafaecac-a478-48bf-845f-fc0d0a4f93fb",
- "metadata": {},
- "outputs": [],
- "source": [
- "from langchain.document_loaders import OnlinePDFLoader\n",
- "\n",
- "loader = OnlinePDFLoader(\"http://leavcom.com/pdf/DBpdf.pdf\")\n",
- "\n",
- "data = loader.load()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "9b1d3e25-129f-4e4e-ad64-db3c4ba2d507",
- "metadata": {},
- "outputs": [],
- "source": [
- "from langchain.text_splitter import RecursiveCharacterTextSplitter\n",
- "\n",
- "print (f\"You have {len(data)} document(s) in your data\")\n",
- "print (f\"There are {len(data[0].page_content)} characters in your document\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "445c4227-8f82-4a8e-b1d7-ed040a0a4ed2",
- "metadata": {},
- "outputs": [],
- "source": [
- "text_splitter = RecursiveCharacterTextSplitter(chunk_size = 2000, chunk_overlap = 0)\n",
- "texts = text_splitter.split_documents(data)\n",
- "\n",
- "print (f\"You have {len(texts)} pages\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "4f4d66a0-ed8c-4c3f-8116-9d7ea8526f24",
- "metadata": {},
- "outputs": [],
- "source": [
- "import os\n",
- "import getpass\n",
- "\n",
- "os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key:\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "24649cac-6455-45fb-8021-049da13918e4",
- "metadata": {},
- "outputs": [],
- "source": [
- "from langchain.embeddings import OpenAIEmbeddings\n",
- "\n",
- "embedder = OpenAIEmbeddings()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "9b0af2c5-37c9-4822-856b-f057d2acbad8",
- "metadata": {},
- "outputs": [],
- "source": [
- "from langchain.vectorstores import SingleStoreDB\n",
- "\n",
- "os.environ[\"SINGLESTOREDB_URL\"] = \"admin:
@:3306/pdf_db\"\n",
- "\n",
- "docsearch = SingleStoreDB.from_documents(\n",
- " texts,\n",
- " embedder,\n",
- " table_name = \"pdf_docs2\",\n",
- ")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "d4e4b856-69a2-4210-9f89-95ae6e25540c",
- "metadata": {},
- "outputs": [],
- "source": [
- "%%sql\n",
- "\n",
- "USE pdf_db;\n",
- "SELECT JSON_ARRAY_UNPACK_F32(vector)\n",
- "FROM pdf_docs2\n",
- "LIMIT 1;"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "4041b9c9-2540-4324-9840-d19ff15d40fd",
- "metadata": {},
- "outputs": [],
- "source": [
- "query_text = \"Will object-oriented databases be commercially successful?\"\n",
- "\n",
- "docs = docsearch.similarity_search(query_text)\n",
- "\n",
- "print(docs[0].page_content)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "50d01b42-650e-4e1f-81fe-a151d6688013",
- "metadata": {},
- "outputs": [],
- "source": [
- "import openai\n",
- "\n",
- "prompt = f\"The user asked: {query_text}. The most similar text from the document is: {docs[0].page_content}\"\n",
- "\n",
- "response = openai.ChatCompletion.create(\n",
- " model=\"gpt-3.5-turbo\",\n",
- " messages=[\n",
- " {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n",
- " {\"role\": \"user\", \"content\": prompt}\n",
- " ]\n",
- ")\n",
- "\n",
- "print(response['choices'][0]['message']['content'])"
- ]
- }
- ],
- "metadata": {
- "jupyterlab": {
- "notebooks": {
- "version_major": 6,
- "version_minor": 4
- }
- },
- "kernelspec": {
- "display_name": "Python 3 (ipykernel)",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.10.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}
diff --git a/notebooks/movie-recommendation/notebook.ipynb b/notebooks/movie-recommendation/notebook.ipynb
index df4aab1..e53e814 100644
--- a/notebooks/movie-recommendation/notebook.ipynb
+++ b/notebooks/movie-recommendation/notebook.ipynb
@@ -726,8 +726,7 @@
"metadata": {},
"source": [
"\n",
- "\n",
- " "
+ "