Skip to content
Snippets Groups Projects
Unverified Commit 55d48905 authored by Luca's avatar Luca Committed by GitHub
Browse files

Update README.md

Examples in the Readme updated
parent d9a3f348
No related branches found
No related tags found
No related merge requests found
...@@ -24,10 +24,10 @@ pip install -qU semantic-router ...@@ -24,10 +24,10 @@ pip install -qU semantic-router
We begin by defining a set of `Decision` objects. These are the decision paths that the semantic router can decide to use, let's try two simple decisions for now — one for talk on _politics_ and another for _chitchat_: We begin by defining a set of `Decision` objects. These are the decision paths that the semantic router can decide to use, let's try two simple decisions for now — one for talk on _politics_ and another for _chitchat_:
```python ```python
from semantic_router.schema import Decision from semantic_router.schema import Route
# we could use this as a guide for our chatbot to avoid political conversations # we could use this as a guide for our chatbot to avoid political conversations
politics = Decision( politics = Route(
name="politics", name="politics",
utterances=[ utterances=[
"isn't politics the best thing ever", "isn't politics the best thing ever",
...@@ -40,7 +40,7 @@ politics = Decision( ...@@ -40,7 +40,7 @@ politics = Decision(
# this could be used as an indicator to our chatbot to switch to a more # this could be used as an indicator to our chatbot to switch to a more
# conversational prompt # conversational prompt
chitchat = Decision( chitchat = Route(
name="chitchat", name="chitchat",
utterances=[ utterances=[
"how's the weather today?", "how's the weather today?",
...@@ -73,9 +73,9 @@ encoder = OpenAIEncoder() ...@@ -73,9 +73,9 @@ encoder = OpenAIEncoder()
With our `decisions` and `encoder` defined we now create a `DecisionLayer`. The decision layer handles our semantic decision making. With our `decisions` and `encoder` defined we now create a `DecisionLayer`. The decision layer handles our semantic decision making.
```python ```python
from semantic_router.layer import DecisionLayer from semantic_router.layer import RouteLayer
dl = DecisionLayer(encoder=encoder, decisions=decisions) dl = RouteLayer(encoder=encoder, decisions=decisions)
``` ```
We can now use our decision layer to make super fast decisions based on user queries. Let's try with two queries that should trigger our decisions: We can now use our decision layer to make super fast decisions based on user queries. Let's try with two queries that should trigger our decisions:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment