Пример #1
0
        public string Train([FromRoute] String agentId)
        {
            _platform.LoadAgent(agentId);
            _platform.Train();

            return("");
        }
Пример #2
0
        public ActionResult <RasaResponse> Parse(RasaRequestModel request)
        {
            String clientAccessToken = Request.Headers["ClientAccessToken"];
            var    config            = new AIConfiguration(clientAccessToken, SupportedLanguage.English);

            config.SessionId = "rasa nlu";

            _platform.LoadAgent(clientAccessToken);

            var aIResponse = _platform.TextRequest(new AIRequest
            {
                Query = new String[] { request.Text }
            });

            return(new RasaResponse
            {
                Intent = new RasaResponseIntent
                {
                    Name = aIResponse.Result.Metadata.IntentName,
                    Confidence = aIResponse.Result.Score
                },
                Entities = new List <RasaResponseEntity>
                {
                },
                Text = request.Text
            });
        }
Пример #3
0
        public ActionResult <AIResponse> Query([FromBody] QueryModel request)
        {
            String clientAccessToken = Request.Headers["ClientAccessToken"];
            var    config            = new AIConfiguration(clientAccessToken, SupportedLanguage.English);

            config.SessionId = request.SessionId;

            _platform.LoadAgent(clientAccessToken);

            var aIResponse = _platform.TextRequest(new AIRequest
            {
                Timezone = request.Timezone,
                Contexts = request?.Contexts?.Select(x => new AIContext {
                    Name = x
                })?.ToList(),
                Language = request.Lang,
                Query    = new String[] { request.Query }
            });

            return(aIResponse);
        }
Пример #4
0
        public ActionResult <Agent> Dump([FromRoute] String agentId)
        {
            var agent = _platform.LoadAgent(agentId);

            return(Ok(agent));
        }