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: created fastembed and hybrid dependency groups #81

Merged
merged 3 commits into from
Jan 6, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
cache: poetry
- name: Install dependencies
run: |
poetry install
poetry install --all-extras
- name: Install nltk
run: |
pip install nltk
Expand Down
8 changes: 4 additions & 4 deletions docs/00-introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
"source": [
"from semantic_router.layer import RouteLayer\n",
"\n",
"dl = RouteLayer(encoder=encoder, routes=routes)"
"rl = RouteLayer(encoder=encoder, routes=routes)"
]
},
{
Expand All @@ -184,7 +184,7 @@
}
],
"source": [
"dl(\"don't you love politics?\")"
"rl(\"don't you love politics?\")"
]
},
{
Expand All @@ -204,7 +204,7 @@
}
],
"source": [
"dl(\"how's the weather today?\")"
"rl(\"how's the weather today?\")"
]
},
{
Expand All @@ -231,7 +231,7 @@
}
],
"source": [
"dl(\"I'm interested in learning about llama 2\")"
"rl(\"I'm interested in learning about llama 2\")"
]
},
{
Expand Down
16 changes: 8 additions & 8 deletions docs/01-save-load-from-file.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
" \"Enter Cohere API Key: \"\n",
")\n",
"\n",
"layer = RouteLayer(routes=routes)"
"rl = RouteLayer(routes=routes)"
]
},
{
Expand All @@ -156,7 +156,7 @@
}
],
"source": [
"layer.to_json(\"layer.json\")"
"rl.to_json(\"layer.json\")"
]
},
{
Expand Down Expand Up @@ -190,9 +190,9 @@
"import json\n",
"\n",
"with open(\"layer.json\", \"r\") as f:\n",
" router_json = json.load(f)\n",
" layer_json = json.load(f)\n",
"\n",
"print(router_json)"
"print(layer_json)"
]
},
{
Expand All @@ -217,7 +217,7 @@
}
],
"source": [
"layer = RouteLayer.from_json(\"layer.json\")"
"rl = RouteLayer.from_json(\"layer.json\")"
]
},
{
Expand All @@ -244,9 +244,9 @@
],
"source": [
"print(\n",
" f\"\"\"{layer.encoder.type=}\n",
"{layer.encoder.name=}\n",
"{layer.routes=}\"\"\"\n",
" f\"\"\"{rl.encoder.type=}\n",
"{rl.encoder.name=}\n",
"{rl.routes=}\"\"\"\n",
")"
]
},
Expand Down
8 changes: 4 additions & 4 deletions docs/02-dynamic-routes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
" \"Enter Cohere API Key: \"\n",
")\n",
"\n",
"layer = RouteLayer(routes=routes)"
"rl = RouteLayer(routes=routes)"
]
},
{
Expand All @@ -152,7 +152,7 @@
}
],
"source": [
"layer(\"how's the weather today?\")"
"rl(\"how's the weather today?\")"
]
},
{
Expand Down Expand Up @@ -291,7 +291,7 @@
}
],
"source": [
"layer.add(time_route)"
"rl.add(time_route)"
]
},
{
Expand Down Expand Up @@ -330,7 +330,7 @@
" \"Enter OpenRouter API Key: \"\n",
")\n",
"\n",
"layer(\"what is the time in new york city?\")"
"rl(\"what is the time in new york city?\")"
]
},
{
Expand Down
10 changes: 5 additions & 5 deletions docs/03-basic-langchain-agent.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
"from semantic_router import RouteLayer\n",
"from semantic_router.encoders import OpenAIEncoder\n",
"\n",
"layer = RouteLayer(encoder=OpenAIEncoder(), routes=routes)"
"rl = RouteLayer(encoder=OpenAIEncoder(), routes=routes)"
]
},
{
Expand Down Expand Up @@ -258,7 +258,7 @@
}
],
"source": [
"layer(\"should I buy ON whey or MP?\")"
"rl(\"should I buy ON whey or MP?\")"
]
},
{
Expand All @@ -284,7 +284,7 @@
}
],
"source": [
"layer(\"how's the weather today?\")"
"rl(\"how's the weather today?\")"
]
},
{
Expand All @@ -310,7 +310,7 @@
}
],
"source": [
"layer(\"how do I get big arms?\")"
"rl(\"how do I get big arms?\")"
]
},
{
Expand Down Expand Up @@ -382,7 +382,7 @@
"outputs": [],
"source": [
"def semantic_layer(query: str):\n",
" route = layer(query)\n",
" route = rl(query)\n",
" if route.name == \"get_time\":\n",
" query += f\" (SYSTEM NOTE: {get_time()})\"\n",
" elif route.name == \"supplement_brand\":\n",
Expand Down
Loading
Loading