Skip to content

Commit

Permalink
hybrid-search db syntax and notes updated
Browse files Browse the repository at this point in the history
  • Loading branch information
demenskyi committed Jan 26, 2024
1 parent cd1cc24 commit 4964149
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 10 deletions.
2 changes: 1 addition & 1 deletion notebooks/hybrid-search/meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
61 changes: 52 additions & 9 deletions notebooks/hybrid-search/notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@
"</div>"
]
},
{
"cell_type": "markdown",
"id": "4c528069",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
" <b class=\"fa fa-solid fa-exclamation-circle\"></b>\n",
" <div>\n",
" <p><b>Note</b></p>\n",
" <p> This notebook can be run on a Free Starter Workspace. To create a Free Starter Workspace navigate to <tt>Start</tt> using the left nav. You can also use your existing Standard or Premium workspace with this Notebook. </p>\n",
" </div>\n",
"</div>"
]
},
{
"cell_type": "markdown",
"id": "d9f9e629-6eb9-4ca5-bcf2-1b8672b86725",
Expand Down Expand Up @@ -123,6 +137,20 @@
"data[0]"
]
},
{
"cell_type": "markdown",
"id": "f68e9407",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
" <b class=\"fa fa-solid fa-exclamation-circle\"></b>\n",
" <div>\n",
" <p><b>Action Required</b></p>\n",
" <p> 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 <tt>connection_url</tt> to connect to that database.</p>\n",
" </div>\n",
"</div>"
]
},
{
"cell_type": "markdown",
"id": "0b6c6560-bc60-43ba-93a4-1b4aee933d5b",
Expand All @@ -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": [
"<div class=\"alert alert-block alert-warning\" style=\"display: flex; background-color: rgba(255, 224, 177, 0.85); padding: 15px;\">\n",
"<div class=\"alert alert-block alert-warning\">\n",
" <b class=\"fa fa-solid fa-exclamation-circle\"></b>\n",
" <div>\n",
" <p><b>Action Required</b></p>\n",
" <p>Make sure to select the <tt>news</tt> database from the drop-down menu at the top of this notebook. It updates the <tt>connection_url</tt> which is used by the <tt>%%sql</tt> magic command and SQLAlchemy to make connections to the selected database.\n",
" </p>\n",
" <p> Make sure to select a database from the drop-down menu at the top of this notebook. It updates the <tt>connection_url</tt> to connect to that database.</p>\n",
" </div>\n",
"</div>"
]
Expand Down Expand Up @@ -413,15 +441,30 @@
"## Clean up"
]
},
{
"cell_type": "markdown",
"id": "0745143b",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
" <b class=\"fa fa-solid fa-exclamation-circle\"></b>\n",
" <div>\n",
" <p><b>Action Required</b></p>\n",
" <p> 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. </p>\n",
" </div>\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "3d4ce5d5-b550-4ee0-9fef-0a1c45e63bb3",
"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;"
]
},
{
Expand Down

0 comments on commit 4964149

Please sign in to comment.