Skip to content

Commit

Permalink
AUTO docusaurus 20231023
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub CI committed Oct 23, 2023
1 parent 5db01cc commit 2c9ca58
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 8 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ jobs:
with:
poetry-version: ${{ env.POETRY_VERSION }}

- name: Inject setuptools into poetry's runtime environment
if: needs.changes.outputs.backend == 'true'
run: |
poetry self add setuptools
- name: Load Poetry Cached Libraries ⬇
id: cache-poetry
if: needs.changes.outputs.backend == 'true'
Expand Down Expand Up @@ -163,7 +168,7 @@ jobs:
# This is a workaround for that issue
run: |
sudo apt-get -y install libpq-dev
make install-full || make install-full || make install-full
make install-full
- name: Checkout target branch to be able to diff
if: needs.changes.outputs.backend == 'true' && github.event_name == 'pull_request'
Expand Down Expand Up @@ -277,6 +282,11 @@ jobs:
with:
poetry-version: ${{ env.POETRY_VERSION }}

- name: Inject setuptools into poetry's runtime environment
if: needs.changes.outputs.backend == 'true'
run: |
poetry self add setuptools
- name: Load Poetry Cached Libraries ⬇
id: cache-poetry
if: needs.changes.outputs.backend == 'true'
Expand Down Expand Up @@ -311,7 +321,7 @@ jobs:
# This is a workaround for that issue
run: |
sudo apt-get -y install libpq-dev
make install-full | tee .output || make install-full | tee .output || make install-full | tee .output
make install-full | tee .output
if grep 'The lock file is not up to date' .output; then exit 1; fi
make prepare-tests-ubuntu
Expand All @@ -330,7 +340,7 @@ jobs:
Remove-Item -Force -Recurse $spacy_data_dir
New-Item -Path $spacy_data_dir -Type Directory
}
make install-full || make install-full || make install-full
make install-full
make prepare-tests-windows-gha
- name: Add github workflow problem matchers
Expand Down Expand Up @@ -427,6 +437,11 @@ jobs:
with:
poetry-version: ${{ env.POETRY_VERSION }}

- name: Inject setuptools into poetry's runtime environment
if: needs.changes.outputs.backend == 'true'
run: |
poetry self add setuptools
- name: Load Poetry Cached Libraries ⬇
id: cache-poetry
if: needs.changes.outputs.backend == 'true'
Expand Down
1 change: 1 addition & 0 deletions changelog/12927.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix wrong conflicts that occur when rasa validate stories is run with slots that have active_loop set to null in mapping conditions.
7 changes: 7 additions & 0 deletions data/test/test_integration/data/nlu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,10 @@ nlu:
- are you a human?
- am I talking to a bot?
- am I talking to a human?
- intent: block
examples: |
- block my [checking](account_type) account
- i want to block my [savings](account_type) account
- i need to block an account
- i need to block my [credit](account_type) card
26 changes: 26 additions & 0 deletions data/test/test_integration/data/stories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,29 @@ stories:
- action: utter_did_that_help
- intent: deny
- action: utter_goodbye

- story: block savings
steps:
- intent: block
entities:
- account_type: savings
- action: utter_block_account

- story: block checking
steps:
- intent: block
entities:
- account_type: checking
- action: utter_checking

- story: block credit
steps:
- intent: block
entities:
- account_type: credit
- action: utter_credit

- story: block no entities
steps:
- intent: block
- action: utter_nothing
30 changes: 30 additions & 0 deletions data/test/test_integration/domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ intents:
- mood_great
- mood_unhappy
- bot_challenge
- block

responses:
utter_greet:
Expand All @@ -29,6 +30,35 @@ responses:
utter_iamabot:
- text: "I am a bot, powered by Rasa."

utter_block_account:
- text: "your account has been blocked"

utter_checking:
- text: "checking account"

utter_credit:
- text: "credit account"

utter_nothing:
- text: "no account type was specified"

entities:
- account_type

slots:
account_type:
type: categorical
influence_conversation: true
values:
- savings
- checking
- credit
mappings:
- type: from_entity
entity: account_type
conditions:
- active_loop: null

session_config:
session_expiration_time: 60
carry_over_slots_to_new_session: true
2 changes: 1 addition & 1 deletion docs/docs/sources/rasa_interactive___help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ options:
--conversation-id CONVERSATION_ID
Specify the id of the conversation the messages are
in. Defaults to a UUID that will be randomly
generated. (default: fcb5d7fe20df427a9fb53b2efd650753)
generated. (default: 849dd04eeb01411c9862ff3eac9aa6ed)
--endpoints ENDPOINTS
Configuration file for the model server and the
connectors as a yml file. (default: endpoints.yml)
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/sources/rasa_shell___help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ options:
-h, --help show this help message and exit
--conversation-id CONVERSATION_ID
Set the conversation ID. (default:
b1c3a4ba2c6b431e96acdd94ec846b21)
d7edd618f0be4841a429adb79893a193)
-m MODEL, --model MODEL
Path to a trained Rasa model. If a directory is
specified, it will use the latest model in this
Expand Down
9 changes: 6 additions & 3 deletions rasa/shared/core/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
SlotMappingType,
MAPPING_TYPE,
MAPPING_CONDITIONS,
ACTIVE_LOOP,
)
from rasa.shared.exceptions import (
RasaException,
Expand Down Expand Up @@ -1408,9 +1409,11 @@ def slots_for_entities(self, entities: List[Dict[Text, Any]]) -> List[SlotSet]:
matching_entities = []

for mapping in slot.mappings:
if mapping[MAPPING_TYPE] != str(
SlotMappingType.FROM_ENTITY
) or mapping.get(MAPPING_CONDITIONS):
mapping_conditions = mapping.get(MAPPING_CONDITIONS)
if mapping[MAPPING_TYPE] != str(SlotMappingType.FROM_ENTITY) or (
mapping_conditions
and mapping_conditions[0].get(ACTIVE_LOOP) is not None
):
continue

for entity in entities:
Expand Down
33 changes: 33 additions & 0 deletions tests/integration_tests/core/test_cli_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,36 @@ def test_rasa_validate_quiet_no_errors(
"you can use `rasa telemetry disable`." in output_text
assert "To learn more, check out"
"https://rasa.com/docs/rasa/telemetry/telemetry." in output_text


def test_rasa_validate_null_active_loop_no_errors(
run: Callable[..., RunResult], request: FixtureRequest
):
# Test captures the subprocess output for the command run
# and validates that the data in 'data/test/test_integration' throws no cli errors

test_data_dir = Path(request.config.rootdir, "data", "test", "test_integration")
test_config_dir = Path(request.config.rootdir, "data", "test_config")
source_file = (test_data_dir / "data").absolute()
domain_file = (test_data_dir / "domain.yml").absolute()
config_file = (test_config_dir / "config_unique_assistant_id.yml").absolute()
result = run(
"data",
"validate",
"--data",
str(source_file),
"-d",
str(domain_file),
"-c",
str(config_file),
)
assert result.ret == 0

stderr_text = str(result.stderr)
assert "INFO" in stderr_text
assert "Validating intents..." in stderr_text
assert "Validating utterances..." in stderr_text
assert "Story structure validation..." in stderr_text
assert "Validating utterances..." in stderr_text
assert "Considering all preceding turns for conflict analysis." in stderr_text
assert "No story structure conflicts found." in stderr_text
27 changes: 27 additions & 0 deletions tests/shared/core/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1977,6 +1977,33 @@ def test_domain_slots_for_entities_with_mapping_conditions_no_slot_set():
assert len(events) == 0


def test_domain_slots_for_entities_with_mapping_conditions_no_active_loop():
domain = Domain.from_yaml(
textwrap.dedent(
f"""
version: "{LATEST_TRAINING_DATA_FORMAT_VERSION}"
entities:
- city
slots:
location:
type: text
influence_conversation: false
mappings:
- type: from_entity
entity: city
conditions:
- active_loop: null
forms:
booking_form:
required_slots:
- location
"""
)
)
events = domain.slots_for_entities([{"entity": "city", "value": "Berlin"}])
assert events == [SlotSet("location", "Berlin")]


def test_domain_slots_for_entities_sets_valid_slot():
domain = Domain.from_yaml(
textwrap.dedent(
Expand Down

0 comments on commit 2c9ca58

Please sign in to comment.