From 4964149d81e03319a82f2d3ad0cb4656e8db6071 Mon Sep 17 00:00:00 2001 From: Yaroslav Demenskyi Date: Fri, 26 Jan 2024 13:40:32 -0800 Subject: [PATCH] hybrid-search db syntax and notes updated --- notebooks/hybrid-search/meta.toml | 2 +- notebooks/hybrid-search/notebook.ipynb | 61 ++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/notebooks/hybrid-search/meta.toml b/notebooks/hybrid-search/meta.toml index 2150391..b1091b9 100644 --- a/notebooks/hybrid-search/meta.toml +++ b/notebooks/hybrid-search/meta.toml @@ -4,6 +4,6 @@ description="""\ Hybrid search combines keyword search with semantic search, aiming to provide more accurate results. """ -tags=["openai"] +tags=["starter", "openai", "genai", "vectordb"] icon="vector-circle" destinations=["spaces"] diff --git a/notebooks/hybrid-search/notebook.ipynb b/notebooks/hybrid-search/notebook.ipynb index 74fbaae..5dbd0dd 100644 --- a/notebooks/hybrid-search/notebook.ipynb +++ b/notebooks/hybrid-search/notebook.ipynb @@ -16,6 +16,20 @@ "" ] }, + { + "cell_type": "markdown", + "id": "4c528069", + "metadata": {}, + "source": [ + "
\n", + " \n", + "
\n", + "

Note

\n", + "

This notebook can be run on a Free Starter Workspace. To create a Free Starter Workspace navigate to Start using the left nav. You can also use your existing Standard or Premium workspace with this Notebook.

\n", + "
\n", + "
" + ] + }, { "cell_type": "markdown", "id": "d9f9e629-6eb9-4ca5-bcf2-1b8672b86725", @@ -123,6 +137,20 @@ "data[0]" ] }, + { + "cell_type": "markdown", + "id": "f68e9407", + "metadata": {}, + "source": [ + "
\n", + " \n", + "
\n", + "

Action Required

\n", + "

If you have a Free Starter Workspace deployed already, select the database from drop-down menu at the top of this notebook. It updates the connection_url to connect to that database.

\n", + "
\n", + "
" + ] + }, { "cell_type": "markdown", "id": "0b6c6560-bc60-43ba-93a4-1b4aee933d5b", @@ -146,22 +174,22 @@ "metadata": {}, "outputs": [], "source": [ - "%%sql\n", - "DROP DATABASE IF EXISTS news;\n", - "CREATE DATABASE IF NOT EXISTS news;" + "shared_tier_check = %sql show variables like 'is_shared_tier'\n", + "if not shared_tier_check or shared_tier_check[0][1] == 'OFF':\n", + " %sql DROP DATABASE IF EXISTS news;\n", + " %sql CREATE DATABASE news;" ] }, { "cell_type": "markdown", - "id": "553f42af-0b29-4e11-a54b-9879447b2a27", + "id": "fa49cc11", "metadata": {}, "source": [ - "
\n", + "
\n", " \n", "
\n", "

Action Required

\n", - "

Make sure to select the news database from the drop-down menu at the top of this notebook. It updates the connection_url which is used by the %%sql magic command and SQLAlchemy to make connections to the selected database.\n", - "

\n", + "

Make sure to select a database from the drop-down menu at the top of this notebook. It updates the connection_url to connect to that database.

\n", "
\n", "
" ] @@ -413,6 +441,20 @@ "## Clean up" ] }, + { + "cell_type": "markdown", + "id": "0745143b", + "metadata": {}, + "source": [ + "
\n", + " \n", + "
\n", + "

Action Required

\n", + "

If you created a new database in your Standard or Premium Workspace, you can drop the database by running the cell below. Note: this will not drop your database for Free Starter Workspaces. To drop a Free Starter Workspace, terminate the Workspace using the UI.

\n", + "
\n", + "
" + ] + }, { "cell_type": "code", "execution_count": 17, @@ -420,8 +462,9 @@ "metadata": {}, "outputs": [], "source": [ - "%%sql\n", - "DROP DATABASE IF EXISTS news;" + "shared_tier_check = %sql show variables like 'is_shared_tier'\n", + "if not shared_tier_check or shared_tier_check[0][1] == 'OFF':\n", + " %sql DROP DATABASE IF EXISTS news;" ] }, {