Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
Xuebin Su committed Dec 22, 2023
1 parent 7de9848 commit ddb94cc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions doc/source/notebooks/embedding.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Generating without Indexing Embeddings\n",
"## Generating Embeddings without Indexing \n",
"\n",
"Now, if we just want to generate the embeddings without creating a vector index, we can use the function `create_embedding` from the `embedding` module:"
"If we just want to generate the embeddings without creating a vector index, we can use the function `create_embedding()` from the `embedding` module:"
]
},
{
Expand All @@ -168,9 +168,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Since we're not indexing vectors, the dataframe doesn't need to be stored as a table in the database. And we do not need to check the unique index of our columns.\n",
"Since we're not indexing vectors, the dataframe doesn't need to be stored as a table in the database. And we do not need to specify the unique key if the embeddings are in the same dataframe.\n",
"\n",
"Furthermore, if we want to save the embeddings as vector type with embedding dimension, so that we can index them later, we need to cast the result with `gp.type_(\"vector\", modifier=embedding_dimension)`."
"Furthermore, if we want to save the embeddings as vector type with embedding dimension, so that we can index them later, we need to cast the result to type `gp.type_(\"vector\", modifier=<embedding_dimension>)`."
]
},
{
Expand Down Expand Up @@ -217,8 +217,7 @@
"source": [
"db.create_dataframe(columns={\"id\": range(len(content)), \"content\": content}).assign(\n",
" embedding_col=lambda t: (\n",
" gp.type_(\"vector\", modifier=384)\n",
" (create_embedding(t[\"content\"], \"all-MiniLM-L6-v2\"))\n",
" gp.type_(\"vector\", modifier=384)(create_embedding(t[\"content\"], \"all-MiniLM-L6-v2\"))\n",
" ),\n",
")"
]
Expand Down

0 comments on commit ddb94cc

Please sign in to comment.