Skip to content

Commit

Permalink
Add additional test for multi-turn flows (#13).
Browse files Browse the repository at this point in the history
  • Loading branch information
drazvan committed May 4, 2023
1 parent b97c12d commit 97abdd9
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions tests/test_bug_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from nemoguardrails import RailsConfig
from tests.utils import TestChat

config = RailsConfig.from_content(
"""
define user ask general question
"What is the capital of France?"
"Who invented the game of chess?"
define user ask capabilities
"What can you do?"
"Tell me what you can do"
define user bey
"bey"
define flow
user ask general question
bot respond to general question
define flow
user ask capabilities
bot inform capabilities
define flow
user ask general question
bot respond to general question
user ask general question
bot respond to general question
user ask general question
bot respond to general question
user bey
bot respond bey back
define bot respond bey back
"Bey back!"
define bot inform capabilities
"I am an AI assistant built to showcase Security features of NeMo Guardrails!"
"""
)


def test_1():
chat = TestChat(
config,
llm_completions=[
" ask general question",
' "The capital of France is Paris."',
" ask general question",
' "The capital of Germany is Berlin."',
" ask general question",
' "The capital of Romania is Bucharest."',
" bey",
],
)

chat >> "What is the capital of France?"
chat << "The capital of France is Paris."
chat >> "and Germany?"
chat << "The capital of Germany is Berlin."
chat >> "and Romania?"
chat << "The capital of Romania is Bucharest."
chat >> "bey"
chat << "Bey back!"

0 comments on commit 97abdd9

Please sign in to comment.