Skip to content

Commit

Permalink
Merge branch 'master' into fix_SQLTrackerStore
Browse files Browse the repository at this point in the history
  • Loading branch information
tabergma committed Aug 21, 2019
2 parents 5df7cb4 + a2a1a91 commit 4b1edf9
Show file tree
Hide file tree
Showing 38 changed files with 792 additions and 445 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ Changed
- show warning in case a default path is used instead of a provided, invalid path
- compare mode of ``rasa train core`` allows the whole core config comparison,
naming style of models trained for comparison is changed (this is a breaking change)
- Pika keeps a single connection open, instead of open and closing on each incoming event
- ``RasaChatInput`` fetches the public key from the Rasa X API. The key is used to
decode the bearer token containing the conversation ID. This requires
``rasa-x>=0.20.2``.

Fixed
-----
Expand Down
93 changes: 83 additions & 10 deletions docs/_static/spec/rasa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1239,28 +1239,104 @@ components:
description: Rasa NLU training data in markdown format
example: >-
## intent:greet
- hey
- hello
- hi
## intent:goodbye
- cu
- bye
- goodbye
- have a nice day
- see you
## intent:affirm
- yes
- indeed
## intent:deny
- no
- never
## intent:mood_great
- perfect
- very good
- great
## intent:mood_unhappy
- sad
- not good
- unhappy
StoriesTrainingData:
type: string
description: Rasa Core stories in markdown format
example: >-
## happy path
* greet
- utter_greet
* mood_great
- utter_happy
## sad path 1
* greet
- utter_greet
* mood_unhappy
- utter_cheer_up
- utter_did_that_help
* affirm
- utter_happy
## sad path 2
* greet
- utter_greet
* mood_unhappy
- utter_cheer_up
- utter_did_that_help
* deny
- utter_goodbye
## say goodbye
* goodbye
- utter_goodbye
DomainFile:
type: string
description: Rasa domain in plain text
Expand All @@ -1274,11 +1350,11 @@ components:
- mood_unhappy
actions:
- utter_greet
- utter_cheer_up
- utter_did_that_help
- utter_happy
- utter_goodbye
- utter_greet
- utter_cheer_up
- utter_did_that_help
- utter_happy
- utter_goodbye
templates:
utter_greet:
Expand All @@ -1301,13 +1377,10 @@ components:
type: string
description: Rasa config in plain text
example: >-
# Configuration for Rasa NLU.
# https://rasa.com/docs/nlu/components/
language: en
pipeline: supervised_embeddings
# Configuration for Rasa Core.
# https://rasa.com/docs/core/policies
policies:
- name: MemoizationPolicy
- name: KerasPolicy
Expand Down
2 changes: 1 addition & 1 deletion docs/api/event-brokers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ example:
# RabbitMQ credentials with username and password
credentials = pika.PlainCredentials('username', 'password')
# pika connection to the RabbitMQ host - typically 'rabbit' in a
# Pika connection to the RabbitMQ host - typically 'rabbit' in a
# docker environment, or 'localhost' in a local environment
connection = pika.BlockingConnection(
pika.ConnectionParameters('rabbit', credentials=credentials))
Expand Down
4 changes: 2 additions & 2 deletions docs/migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ General
``rasa_core.dispatcher``, these are now to be imported from ``rasa_sdk.utils``.

- Rasa NLU and Core previously used `separate configuration files
<https://legacy-docs.rasa.com/docs/nlu/0.15.1/migrations/?&_ga=2.218966814.608734414.1560704810-314462423.1543594887#id1>`.
<https://legacy-docs.rasa.com/docs/nlu/0.15.1/migrations/?&_ga=2.218966814.608734414.1560704810-314462423.1543594887#id1>`_.
These two files should be merged into a single file either named ``config.yml``, or passed via the ``--config`` parameter.

Script parameters
Expand All @@ -84,4 +84,4 @@ Script parameters

HTTP API
~~~~~~~~
- There are numerous HTTP API endpoint changes which can be found `here <http://rasa.com/docs/rasa/api/http-api/>`.
- There are numerous HTTP API endpoint changes which can be found `here <http://rasa.com/docs/rasa/api/http-api/>`_.
4 changes: 2 additions & 2 deletions rasa/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import logging

import rasa.version
from rasa import version

# define the version before the other imports since these need it
__version__ = rasa.version.__version__
__version__ = version.__version__

from rasa.run import run
from rasa.train import train
Expand Down
11 changes: 6 additions & 5 deletions rasa/cli/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import os
import sys
import json
import re
from typing import Any, Optional, Text, List, Dict
from typing import Any, Optional, Text, List, Dict, TYPE_CHECKING
import logging
from questionary import Question

if TYPE_CHECKING:
from questionary import Question

from rasa.constants import DEFAULT_MODELS_PATH

Expand Down Expand Up @@ -170,7 +171,7 @@ def element_to_string(element: Dict[Text, Any], idx: int = 0) -> Text:

def button_choices_from_message_data(
message: Dict[Text, Any], allow_free_text_input: bool = True
) -> Question:
) -> "Question":
"""Return list of choices to present to the user.
If allow_free_text_input is True, an additional option is added
Expand All @@ -186,7 +187,7 @@ def button_choices_from_message_data(
return choices


def payload_from_button_question(button_question: Question) -> Text:
def payload_from_button_question(button_question: "Question") -> Text:
"""Prompt user with a button question and returns the nlu payload."""
response = button_question.ask()
if response != FREE_TEXT_INPUT_PROMPT:
Expand Down
4 changes: 0 additions & 4 deletions rasa/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import pkg_resources

DEFAULT_ENDPOINTS_PATH = "endpoints.yml"
DEFAULT_CREDENTIALS_PATH = "credentials.yml"
Expand Down Expand Up @@ -29,9 +28,6 @@
DOCS_BASE_URL = "https://rasa.com/docs/rasa"
LEGACY_DOCS_BASE_URL = "http://legacy-docs.rasa.com"

FALLBACK_CONFIG_PATH = pkg_resources.resource_filename(
__name__, "cli/default_config.yml"
)
CONFIG_MANDATORY_KEYS_CORE = ["policies"]
CONFIG_MANDATORY_KEYS_NLU = ["language", "pipeline"]
CONFIG_MANDATORY_KEYS = CONFIG_MANDATORY_KEYS_CORE + CONFIG_MANDATORY_KEYS_NLU
Expand Down
27 changes: 10 additions & 17 deletions rasa/core/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,30 @@
import tempfile
import uuid
from asyncio import CancelledError
from sanic import Sanic
from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union

import aiohttp
from sanic import Sanic

import rasa
import rasa.utils.io
from rasa.constants import DEFAULT_DOMAIN_PATH, LEGACY_DOCS_BASE_URL
from rasa.core import constants, jobs, training
from rasa.core.channels.channel import (
InputChannel,
OutputChannel,
UserMessage,
CollectingOutputChannel,
)
from rasa.core.channels.channel import InputChannel, OutputChannel, UserMessage
from rasa.core.constants import DEFAULT_REQUEST_TIMEOUT
from rasa.core.domain import Domain, InvalidDomain
from rasa.core.domain import Domain
from rasa.core.exceptions import AgentNotReady
from rasa.core.interpreter import NaturalLanguageInterpreter, RegexInterpreter
from rasa.core.nlg import NaturalLanguageGenerator
from rasa.core.policies.policy import Policy
from rasa.core.policies.form_policy import FormPolicy
from rasa.core.policies.ensemble import PolicyEnsemble, SimplePolicyEnsemble
from rasa.core.policies.mapping_policy import MappingPolicy
from rasa.core.policies.memoization import MemoizationPolicy
from rasa.core.policies.policy import Policy
from rasa.core.processor import MessageProcessor
from rasa.core.tracker_store import InMemoryTrackerStore, TrackerStore
from rasa.core.trackers import DialogueStateTracker
from rasa.core.utils import LockCounter
from rasa.exceptions import ModelNotFound
from rasa.importers.importer import TrainingDataImporter
from rasa.model import (
get_model_subdirectories,
get_latest_model,
Expand All @@ -42,9 +37,6 @@
from rasa.nlu.utils import is_url
from rasa.utils.common import update_sanic_log_level, set_log_level
from rasa.utils.endpoints import EndpointConfig
from rasa.exceptions import ModelNotFound

from rasa.importers.importer import TrainingDataImporter

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -160,9 +152,10 @@ async def _pull_model_and_fingerprint(
return None
elif resp.status == 404:
logger.debug(
"Model server didn't find a model for our request. "
"Probably no one did train a model for the project "
"and tag combination yet."
"Model server could not find a model at the requested "
"endpoint '{}'. It's possible that no model has been "
"trained, or that the requested tag hasn't been "
"assigned.".format(model_server.url)
)
return None
elif resp.status != 200:
Expand Down
Loading

0 comments on commit 4b1edf9

Please sign in to comment.