Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fixed encoders docs to use semantic router v 0.1.0 #504

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 32 additions & 20 deletions docs/encoders/fastembed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install -qU \"semantic-router[fastembed]==0.0.20\""
"!pip install -qU \"semantic-router[fastembed]==0.1.0\""
]
},
{
Expand All @@ -59,7 +59,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -87,7 +87,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -114,9 +114,20 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Fetching 5 files: 0%| | 0/5 [00:00<?, ?it/s]c:\\Users\\Joshu\\OneDrive\\Documents\\Aurelio\\agents-course\\07-pratical-ai\\.venv\\Lib\\site-packages\\huggingface_hub\\file_download.py:140: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\\Users\\Joshu\\AppData\\Local\\Temp\\fastembed_cache\\models--qdrant--bge-small-en-v1.5-onnx-q. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.\n",
"To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development\n",
" warnings.warn(message)\n",
"Fetching 5 files: 100%|██████████| 5/5 [00:06<00:00, 1.33s/it]\n"
]
}
],
"source": [
"from semantic_router.encoders import FastEmbedEncoder\n",
"\n",
Expand All @@ -139,21 +150,22 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[32m2024-01-06 16:53:16 INFO semantic_router.utils.logger Initializing RouteLayer\u001b[0m\n"
"2025-01-07 15:40:59 - semantic_router.utils.logger - WARNING - base.py:356 - _get_index() - No index provided. Using default LocalIndex.\n",
"2025-01-07 15:41:00 - semantic_router.utils.logger - WARNING - local.py:148 - _write_config() - No config is written for LocalIndex.\n"
]
}
],
"source": [
"from semantic_router.layer import RouteLayer\n",
"from semantic_router.routers import SemanticRouter\n",
"\n",
"rl = RouteLayer(encoder=encoder, routes=routes)"
"rl = SemanticRouter(encoder=encoder, routes=routes, auto_sync=\"local\")"
]
},
{
Expand All @@ -165,16 +177,16 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"RouteChoice(name='politics', function_call=None)"
"RouteChoice(name='politics', function_call=None, similarity_score=None)"
]
},
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -185,16 +197,16 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"RouteChoice(name='chitchat', function_call=None)"
"RouteChoice(name='chitchat', function_call=None, similarity_score=None)"
]
},
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -212,22 +224,22 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"RouteChoice(name=None, function_call=None)"
"RouteChoice(name=None, function_call=None, similarity_score=None)"
]
},
"execution_count": 7,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rl(\"I'm interested in learning about llama 2\")"
"rl(\"I'm interested in learning about llama 2 mechanics\")"
]
},
{
Expand All @@ -254,7 +266,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down
10 changes: 5 additions & 5 deletions docs/encoders/google.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -81,7 +81,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -133,9 +133,9 @@
"metadata": {},
"outputs": [],
"source": [
"from semantic_router.layer import RouteLayer\n",
"from semantic_router.routers import SemanticRouter\n",
"\n",
"rl = RouteLayer(encoder=encoder, routes=routes)"
"rl = SemanticRouter(encoder=encoder, routes=routes, auto_sync=\"local\")"
]
},
{
Expand Down Expand Up @@ -203,7 +203,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down
19 changes: 5 additions & 14 deletions docs/encoders/huggingface-endpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"metadata": {},
"outputs": [],
"source": [
"# !pip install -qU semantic-router==0.0.20"
"!pip install -qU \"semantic-router==0.1.0\""
]
},
{
Expand All @@ -55,16 +55,7 @@
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"d:\\Program_Installation\\anaconda\\envs\\testenv\\Lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"outputs": [],
"source": [
"from semantic_router import Route\n",
"\n",
Expand Down Expand Up @@ -3187,9 +3178,9 @@
}
],
"source": [
"from semantic_router.layer import RouteLayer\n",
"from semantic_router.routers import SemanticRouter\n",
"\n",
"rl = RouteLayer(encoder=encoder, routes=routes)"
"rl = SemanticRouter(encoder=encoder, routes=routes, auto_sync=\"local\")"
]
},
{
Expand Down Expand Up @@ -3346,7 +3337,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down
8 changes: 4 additions & 4 deletions docs/encoders/huggingface.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install -qU \"semantic-router[local]==0.0.20\""
"!pip install -qU \"semantic-router[local]==0.1.0\""
]
},
{
Expand Down Expand Up @@ -570,9 +570,9 @@
}
],
"source": [
"from semantic_router.layer import RouteLayer\n",
"from semantic_router.routers import SemanticRouter\n",
"\n",
"rl = RouteLayer(encoder=encoder, routes=routes)"
"rl = SemanticRouter(encoder=encoder, routes=routes, auto_sync=\"local\")"
]
},
{
Expand Down Expand Up @@ -817,7 +817,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down
Loading
Loading