brunobrandes / api-ai-csharp

A C# wrapper for the api.ai
Apache License 2.0
18 stars 7 forks source link

The Query does not return parameters #4

Closed vhugogarcia closed 7 years ago

vhugogarcia commented 7 years ago

How can you make the query to return the parameters from Api.AI?

Thanks in advance

brunobrandes commented 7 years ago

After making a call to api.ai, you receive the QueryResponse object

Ex:

var queryRequest = new QueryRequest
{
SessionId = "1",
Query = new string [] {"My email is test@gmail.com"},
Lang = Domain.Enum.Language.English
};

var queryResponse = await queryAppService.PostQueryAsync(queryRequest);

If on return intent, there are parameters the same are in queryResponse.Result.Parameters You can fetch the values through an extension by passing the parameter key.

Ex:

var email = queryResponse.Result.GetParameterValueByKey("email").ToString();

Is that your need?

vhugogarcia commented 7 years ago

That is what I was looking for yeah.

Thanks @brunobrandes

Excuse me, I would like to ask you 2 quick questions before close this ticket:

Thanks in advance for the amazing wrapper library.

brunobrandes commented 7 years ago

hugs