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
fromsemantic_router.schemaimportDecision
fromsemantic_router.schemaimportRoute
# 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.