Example #1
0
def go(event, context, speech_config_name="default", cache=ForecastCache()):
    default_values = database.get_config(event["session"]["user"]["userId"])
    speech_config = database.get_speech_conf(speech_config_name)
    try:
    	Session = conversation.mk_session_class(IntentRequestHandlers)
        session = Session(event, context, speech_config, default_values, cache=cache)
        return session.respond()
    except conversation.PrimarySlotError as e:
        return e.message
Example #2
0
import pickle

import os
import sys
sys.path.append("..")

from reduced_dotmap import DotMap
from conversation import *
from dre.decision import Loc

from intent_processing.lambda_fn import *
from intent_processing.intent_request_handlers import IntentRequestHandlers

from database import database
speech_config = database.get_speech_conf("tests")
full_conf = database.get_config('tests')

Session = mk_session_class(IntentRequestHandlers)


class LambdaDecisionTest(unittest.TestCase):
    base = os.path.split(__file__)[0]
    with open(os.path.join(base, 'json_packets', 'in', 'sample_event.json'), 'r') as evtfile:
        event = yaml.safe_load(evtfile.read())

    cache = ForecastCache()
    with open(os.path.join(base, 'data', 'testForecast.pkl'), "rb") as f:
        timesteps = pickle.load(f)
    cache.cache_forecast(timesteps, Loc(lat=50.7, lon=-3.5))

    def testLambda(self):