Giter Club home page Giter Club logo

dialogflow-java-client's Introduction

DEPRECATED Java SDK for api.ai

Deprecated
This Dialogflow client library and Dialogflow API V1 have been deprecated and will be shut down on October 23th, 2019. Please migrate to Dialogflow API V2 and the v2 client library

Release status Maven Central

The API.AI Java SDK makes it easy to integrate speech recognition with API.AI natural language processing API on Android devices. API.AI allows using voice commands and integration with dialog scenarios defined for a particular agent in API.AI.

Authentication is accomplished through setting the client access token when initializing an AIConfiguration object. The client access token specifies which agent will be used for natural language processing.

Note: The API.AI Java SDK only makes query requests, and cannot be used to manage entities and intents. Instead, use the API.AI user interface or REST API to create, retrieve, update, and delete entities and intents.

Tutorial

This section contains a detailed tutorial on how to work with libai. This tutorial was written for IntelliJ IDEA.

Quick Start

  1. Create an API.AI agent with entities and intents, or use one that you've already created. See the API.AI documentation for instructions on how to do this.
  2. Open IntelliJ IDEA.
  3. From the start screen (or File menu) , choose Open....
    Open project
  4. In the Open project dialog, fill Path to apiai-java-sdk directory, then expand exmaples directory and choose one of the client examples. Then click Ok.
    Open project dialog
  5. Open Run, choose Edit Configuration. In the Run/Debug Configuration Dialog, fill program arguments with your Client access token
    Api keys
  6. If there are no errors, you can get the result using Idea Input/Output to make text request (text-client).

Work with library source code

If you want to work with library source code, for some reason, follow these steps:

  1. First of all, execute the steps specified in Quick Start. Only then go to the next step here.
  2. Open File, choose Project Structure..., choose Modules. Add new module libai. After this choose text-client(or voice client) module. Remove Maven: ai.api.libai:1.1.0 and Add Module dependency libai. After this click Apply.
    ProjectStructure
  3. Try to Run. If there are no errors, you can get the result using Idea Input/Output to make text request (text-client).

dialogflow-java-client's People

Contributors

a23sokolov avatar ashishpatel22 avatar folomeev avatar nikodem911 avatar shivadixith avatar xvir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dialogflow-java-client's Issues

type and platform fields in ResponseMessage are not sent in the response json

Hi,

We are doing the FB messenger integration to the api.ai agent. The quick replies are configured in the intent response section as shown below
image

With webhook is disabled:
The response from api.ai console chat is having "type" and "platform" fields populated as shown below. And, the quick reply is shown properly in FB messenger.

"fulfillment": {
"speech": "test fulfillment",
"messages": [
{
"type": 2,
"platform": "facebook",

"title": "proceed?",
"replies": [
"yes",
"no"
]
}
]
}

With webhook enabled:
In the webhook service (springboot application having http converter set to gson, spring.http.converters.preferred-json-mapper=gson),
We have created new ReponseMessage class for FB as shown below by setting Platform to FACEBOOK.

`public abstract class FBResponseMessages extends ResponseMessage {

protected FBResponseMessages(MessageType type) {
super(type, Platform.FACEBOOK);
}
.......
}`

Now, created the QuickReplyReponseMessage and added to the FulFillment messages as shown below.

Fulfillment fulFillment = aiResponse.getResult().getFulfillment(); FBResponseMessages.ResponseQuickReply quickReply = new FBResponseMessages.ResponseQuickReply(); quickReply.setTitle("do you want to proceed?"); quickReply.setReplies("yes","no"); messages.add(quickReply); fulFillment.setMessages(messages); return fulFillment;

The json coming out of this does not have type and platform set because of which the quickreply is not being shown in FB.

{
"speech": "test fulfillment",
"messages": [
{
"title": "do you want to proceed?",
"replies": [
"yes",
"no"
]
}
],
"displayText": "test fulfillment"
}

For testing purposes, we had tried to override ResponseMessage class to make type and platform attributes as public.
` @expose
public final MessageType type;

@expose
public final Platform platform;`

Now, the type and platform fields are appearing in the reponse json, but with Enum Name instead of the code and the value respectively.

{
"speech": "test fulfillment",
"messages": [
{
"title": "do you want to proceed?",
"replies": [
"yes",
"no"
],
"type": "QUICK_REPLY",
"platform": "FACEBOOK"

}
],
"displayText": "test fulfillment"
}

Can somebody suggest whether there is anything wrong with the way we are doing or problem with the code?

ResponseChatBubble (de)serialization issue

Hi !

I encoutred a problem with serialization of the attribute ResponseChatBubble.textToSpeech.
Api.ai want this :
{ "type": "simple_response", "platform": "google", "textToSpeech": "This is a simple response." }

But the class ResponseChatBubble generate this JSON :
{ "items": [ { "textToSpeech": "This is a simple response." } ], "type": "simple_response", "platform": "google" }

Even the deserialization is not working because the ResponseChatBubble is not expecting an array but a string value.

For testing :

  • Deserialization

ResponseChatBubble response = (ResponseChatBubble) GsonFactory.getDefaultFactory().getGson().fromJson( "{ \"speech\": \"Hey!\",\"messages\": [{ \"type\": \"simple_response\", \"platform\": \"google\", \"textToSpeech\": \"This is a simple response.\" }]}", Fulfillment.class).getMessages().get(0);

Here the object response does not contain the message "This is a simple response.".

  • Serialization :

Item item = new Item(); item.setTextToSpeech("This is a simple response."); response.setItems(Lists.newArrayList(item)); String json = GsonFactory.getDefaultFactory().getGson().toJson(response);
The json value will be contain an array like a said before.

Thanks !

Doesn't work for Google Assistant

This is the JSON returned by Node.js client:

{
    "speech": "Sure, here's a history fact. Google was founded by Larry Page and Sergey Brin. Would you like to hear another fact?",
    "contextOut": [
        {
            "name": "_actions_on_google_",
            "lifespan": 100,
            "parameters": {
                "historyFacts": [
                    "Google went public in 2004.",
                    "Google has more than 70 offices in more than 40 countries."
                ]
            }
        }
    ],
    "data": {
        "google": {
            "expect_user_response": true,
            "is_ssml": false,
            "no_input_prompts": [
                {
                    "text_to_speech": "I didn't hear that."
                },
                {
                    "text_to_speech": "If you're still there, say that again."
                },
                {
                    "text_to_speech": "We can stop here. See you soon."
                }
            ]
        }
    }
}

This is the JSON returned by Java client:

{
    "speech": "Meh"
}

As you can expect, api.ai is not happy:

"status": {
    "code": 206,
    "errorType": "partial_content",
    "errorDetails": "Webhook call failed. Error: Webhook response was empty."
}

Error Occurred at DetectIntentResponse response = sessionsClient.detectIntent(session, queryInput);

Java Version : jdk1.8.0_172
Tomcat Version: 8.5.20
SSL Certificate Downloaded from --> https://dialogflow.googleapis.com/
pom.xml

com.google.cloud
google-cloud-dialogflow
0.115.0-alpha

When the java code executes
DetectIntentResponse response = sessionsClient.detectIntent(session, queryInput);
The below stacktrace is captured on Tomcat Logs

com.google.api.gax.rpc.UnavailableException: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]
at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:69)
at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)
at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)
at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97)
at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:68)
at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:982)
at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1138)
at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:957)
at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:748)
at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:515)
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:490)
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:700)
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:399)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:510)
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:66)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:630)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:518)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:692)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:681)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Suppressed: com.google.api.gax.rpc.AsyncTaskException: Asynchronous task failed
at com.google.api.gax.rpc.ApiExceptions.callAndTranslateApiException(ApiExceptions.java:57)
at com.google.api.gax.rpc.UnaryCallable.call(UnaryCallable.java:112)
at com.google.cloud.dialogflow.v2.SessionsClient.detectIntent(SessionsClient.java:245)
at com.google.cloud.dialogflow.v2.SessionsClient.detectIntent(SessionsClient.java:184)
at v2.migration.util.Demo.sendMessage(Demo.java:141)
at v2.migration.ws.rest.MigrationController.sendMsg(MigrationController.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:169)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:232)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
... 1 more
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]
at io.grpc.Status.asRuntimeException(Status.java:533)
... 24 more
Caused by: javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem
at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.handshakeException(ReferenceCountedOpenSslEngine.java:1695)
at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.handshake(ReferenceCountedOpenSslEngine.java:1720)
at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.unwrap(ReferenceCountedOpenSslEngine.java:1032)
at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.unwrap(ReferenceCountedOpenSslEngine.java:1256)
at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler$SslEngineType$1.unwrap(SslHandler.java:199)
at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1329)
at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1224)
at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1271)
at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:505)
at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:444)
at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:283)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1421)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:794)
at io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:424)
at io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:326)
at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918)
at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
... 1 more
Caused by: java.security.cert.CertificateException: No subject alternative DNS name matching dialogflow.googleapis.com found.
at sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:214)
at sun.security.util.HostnameChecker.match(HostnameChecker.java:96)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:455)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:436)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:252)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:136)
at io.grpc.netty.shaded.io.netty.handler.ssl.OpenSslTlsv13X509ExtendedTrustManager.checkServerTrusted(OpenSslTlsv13X509ExtendedTrustManager.java:239)
at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslClientContext$ExtendedTrustManagerVerifyCallback.verify(ReferenceCountedOpenSslClientContext.java:248)
at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslContext$AbstractCertificateVerifier.verify(ReferenceCountedOpenSslContext.java:697)
at io.grpc.netty.shaded.io.netty.internal.tcnative.SSL.readFromSSL(Native Method)
at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.readPlaintextData(ReferenceCountedOpenSslEngine.java:563)
at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.unwrap(ReferenceCountedOpenSslEngine.java:1139)
... 22 more

You have failing tests

When running mvn package I get this:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running ai.api.AllUnitTests
Tests run: 30, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.139 sec <<< FAILURE!
getDateParameterTest(ai.api.model.AIResponseTest)  Time elapsed: 0.007 sec  <<< FAILURE!
java.lang.AssertionError: expected:<19> but was:<18>
	at org.junit.Assert.fail(Assert.java:58)
	at org.junit.Assert.failNotEquals(Assert.java:259)
	at org.junit.Assert.assertEquals(Assert.java:80)
	at org.junit.Assert.assertEquals(Assert.java:88)
	at ai.api.model.AIResponseTest.getDateParameterTest(AIResponseTest.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
	at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
	at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
	at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
	at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
	at org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:29)
	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

parseDateTimeTest(ai.api.util.ParametersConverterTest)  Time elapsed: 0.001 sec  <<< FAILURE!
java.lang.AssertionError: expected:<21> but was:<20>
	at org.junit.Assert.fail(Assert.java:58)
	at org.junit.Assert.failNotEquals(Assert.java:259)
	at org.junit.Assert.assertEquals(Assert.java:80)
	at org.junit.Assert.assertEquals(Assert.java:88)
	at ai.api.util.ParametersConverterTest.parseDateTimeTest(ParametersConverterTest.java:57)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
	at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
	at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
	at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
	at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
	at org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:29)
	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)


Results :

Failed tests:   getDateParameterTest(ai.api.model.AIResponseTest): expected:<19> but was:<18>
  parseDateTimeTest(ai.api.util.ParametersConverterTest): expected:<21> but was:<20>

Tests run: 30, Failures: 2, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.241 s
[INFO] Finished at: 2016-11-06T16:24:56-05:00
[INFO] Final Memory: 12M/309M
[INFO] ------------------------------------------------------------------------

In order to package I had to run without tests: mvn package -Dmaven.test.skip=true

"Processing" response for async requests

My webhook takes time to process a request (more or less 8-9 seconds) and I would like to send a "temporary" response like "I'm processing" "Wait a while".

Is there a way to do this?

I send every response with the output.setSpeech("MESSAGE") method but (obviously) I can’t send two of them (one while the webhook processes the request and the other at the end of it).

I'm talking about this also on the official forum https://discuss.api.ai/t/fulfilment-using-webhook-takes-time-to-get-the-data/3726 where seems that someone has found a workaroud for JS.

Getting the platform for a response message

I have a requirement to default to a particular platform under certain situations. Currently the platform is private so it isn’t accessible. Is there an alternate way of filtering the messages by platform? If not can the platform in the response message be made public?

MessageType deserialization issue

Hi !

I encoutred a problem with deserialization of the attribute ResponseMessage.type . When I deserialize a Json like this one :
"fulfillment": { "speech": "Howdy.", "messages": [ { "type": 0, "speech": "Howdy." } ] },
the attribute 'type' of ResponseMessage.ResponseSpeech is null.
Here is my code :
ResponseSpeech re = (ResponseSpeech)GsonFactory.getDefaultFactory().getGson().fromJson("{ \"speech\": \"Hey!\",\"messages\": [{\"type\": 0,\"speech\": \"Howdy.\" }]}", Fulfillment.class).getMessages().get(0);

Thanks !

Tests parsePartialDateTest fails on libai build

Hi,

My env is Ubuntu 16.04, with jvm/java-7-openjdk-amd64

I did:

  1. git clone
  2. mvn package

Build fails with failed tests:

parsePartialDateTest(ai.api.util.ParametersConverterTest): expected:<5> but was:<6>
testCustomContext(ai.api.AIDataServiceTest): null expected:<[Europe/London]> but was:<[GMT]>

If I skip tests, then javadoc fails, if I skip that, then libai-speech-gcp fails.

Why I feel I'm missing a step here?

Any help or clarification would be much appreciated,

thanks

Unable to trigger an event

"Json request can't have both query and event specified" is displayed when a event (AIEvent) is added to AIRequest and sent to bot.
Also I'm unable to set query = null in AIRequest.
How can I trigger an event via Java SDK.

How to read developer entities?

I wanted to read developer entities without reimplementing everything from scratch and I see there are two ways to do it now:

  1. Add it on top of #13 , as this would require minimal additions
  2. More generic - change the method protected <TResponse> TResponse doRequest(final Type responseType, final String endpoint, final String method) to public. This would also require adding method AIConfig.getServiceUrl() as it is currently missing.

Is there a chance to have one of them approved? I can provide a pull request for option 2.

Use SLF4J

SLF4J is a much better logging standard than log4j as it is both faster and more easily configurable for the end user. I would urge you to take a look at it. They also provide a bridge for using log4j so you may keep using that if its more comfortable for you.

https://www.slf4j.org/

Gson deserialization issue

Hi,
i'm unable to deserialize AIResponse from String.
I'm using SDK 1.4.9 with Gson version 2.8.1

My code is

Gson jsoner = new Gson();
AIResponse aiResponse = jsoner.fromJson(requestData, AIResponse.class);

requestData is the json received in webhook method.

The exception is

RuntimeException: Unable to invoke no-args constructor for class ai.api.model.ResponseMessage. Register an InstanceCreator with Gson for this type may fix this problem.] with root cause
java.lang.UnsupportedOperationException: Abstract class can't be instantiated! Class name: ai.api.model.ResponseMessage
        at com.google.gson.internal.UnsafeAllocator.assertInstantiable(UnsafeAllocator.java:120)
        at com.google.gson.internal.UnsafeAllocator$1.newInstance(UnsafeAllocator.java:49)
        at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:223)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:210)
        at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
        at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
        at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
        at com.google.gson.Gson.fromJson(Gson.java:887)
        at com.google.gson.Gson.fromJson(Gson.java:852)
        at com.google.gson.Gson.fromJson(Gson.java:801)
        at com.google.gson.Gson.fromJson(Gson.java:773)

Session ID is missing

The query response does not contain the session ID. I dont see any session ID parameter in AIResponse object.Can you fix that? Thanks in advance.

Web-Client sample doesn't work (404 on everything)

Hello, i've deploy the web-client project with Glassfish but no path that is in the project works (/ai, /client-web, /webhook) and give me 404 error.

What have I to do?

I've fixed that but I reopened because now I don't know how the webhook works.

class path for running text example

I have struggled for several hours now to get the text example to run. No matter what I do with the class path, I can not get it to find the classes required. Would it be possible to add a couple of lines to say how it is normally run e.g. is the library built and installed, or should the example point at it in its target dirctory. I am not sure whether there is a mistake in one of the pom.xml fles or maybe the build sequence I am using is not matching the authors expectation. It is also not clear to me if I need the library signed if I am just running this on my local machine.

Need Latest AIConfiguration

Hi Team,

Can we have latest AIConfiguration which will connect to Dialogflow V2 API version.

Thanks and Regards,
Shishir Bhujbal

Support for UI Agent Settings

I'm curious if there will ever be support for UI based agent Settings. It looks like there is an internal endpoint that the UI uses to do things like set voice settings for the agent globally rather than only in a published version in an environment. The endpoint is

https://dialogflow.clients6.google.com/v2beta1/projects/[agentId]/locations/global/agent:updateSettings?alt=json&key=[apiKey}

Here's an example payload:

{"agentSettings":{"enableSmalltalk":false,"enableValidation":false,"enableSpeechRequestContext":true,"enableAgentWideKnowledgeConnector":false,"knowledgeBaseNames":[],"knowledgeConfidenceAdjustment":0,"textToSpeechSettings":{"enableTextToSpeech":true,"outputAudioEncoding":"OUTPUT_AUDIO_ENCODING_LINEAR_16","synthesizeSpeechConfigs":{"en":{"speakingRate":1,"pitch":0,"volumeGainDb":0,"effectsProfileId":[],"voice":{"name":"en-US-Wavenet-F","customVoice":{}}}}}},"updateMask":"enableStackdriverLogging,enableSmalltalk,enableSpellCorrection,disableAutomaticTraining,enableValidation,enableSpeechLogging,enableSpeechRequestContext,endpointerSensitivity,enableSentimentAnalysis,enableAgentWideKnowledgeConnector,enableCustomSpeechModels,knowledgeBaseNames,knowledgeConfidenceAdjustment,textToSpeechSettings"}
i don't see any protobuf files for agentSettings...

Other functions that we need in the client library are the telephony integrations, especially the one click Google one.

Right now these things are blocking us from being able to programmatically provision agents and have them fully set up without having to go into the UI and click buttons. This is driving us towards seeking alternate solutions that do enable us to do that. But we would love to stick with dialogflow...

new Fulfillment for webhook response

I'm creating a a new object of type Fulfillment to use on my webhook and send it as a response. When it gets serialized to Json only the ResponseSpeech is correct, all other types don't. I'm using the gson builder from the SDK.

example:

ResponseSpeech speech = new ResponseMessage.ResponseSpeech();
speech.setSpeech(Arrays.asList("speech 1", "speech 2"));
	
ResponseImage image = new ResponseMessage.ResponseImage();
image.setImageUrl("url image");

ResponseQuickReply quickReply = new ResponseMessage.ResponseQuickReply();
quickReply.setTitle("Quick title");
(...)
Fulfillment full = new Fulfillment();
full.getMessages(new ArrayList<>());
full.setSpeech("test speech");
full.getMessages().add(card);
full.getMessages().add(image);
full.getMessages().add(quickReply);
full.getMessages().add(speech);

This is the json result:

{"speech":"test speech","messages":[{"type":0},{"type":0},{"type":0},{"speech":["speech 1","speech 2"],"type":0}]}

Other thing: there is no setMessages to the Fulfillment class, this is expected?

simple_response fulfillment message type unsupported in API

Sometimes(I'm not sure when and why) on a query request, the api.ai replies with the following content in the fulfillment bloc. Notice that the type tag is simple_response for the first response and a number for the other ones.

... "fulfillment": { "speech": "resize my aws server i-XXXXX to m4.xlarge", "messages": [ { "type": "simple_response", "platform": "google", "textToSpeech": "resize my aws server i-XXXXX to m4.xlarge" }, { "type": 0, "platform": "facebook", "speech": "resize my aws server i-XXXXX to m4.xlarge" }, ...

The problem is that the java client does not seem to support this and fails with a NumberFormatException:

java.lang.NumberFormatException: For input string: "simple_response" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[na:1.8.0_111] at java.lang.Integer.parseInt(Integer.java:580) ~[na:1.8.0_111] at java.lang.Integer.parseInt(Integer.java:615) ~[na:1.8.0_111] at com.google.gson.JsonPrimitive.getAsInt(JsonPrimitive.java:260) ~[gson-2.8.0.jar!/:na] at ai.api.GsonFactory$ResponseItemAdapter.deserialize(GsonFactory.java:78) ~[libai-1.4.8.jar!/:na] at ai.api.GsonFactory$ResponseItemAdapter.deserialize(GsonFactory.java:71) ~[libai-1.4.8.jar!/:na] at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[gson-2.8.0.jar!/:na] at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41) ~[gson-2.8.0.jar!/:na] at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82) ~[gson-2.8.0.jar!/:na] at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61) ~[gson-2.8.0.jar!/:na] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129) ~[gson-2.8.0.jar!/:na] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220) ~[gson-2.8.0.jar!/:na] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129) ~[gson-2.8.0.jar!/:na] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220) ~[gson-2.8.0.jar!/:na] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129) ~[gson-2.8.0.jar!/:na] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220) ~[gson-2.8.0.jar!/:na] at com.google.gson.Gson.fromJson(Gson.java:887) ~[gson-2.8.0.jar!/:na] at com.google.gson.Gson.fromJson(Gson.java:852) ~[gson-2.8.0.jar!/:na] at com.google.gson.Gson.fromJson(Gson.java:801) ~[gson-2.8.0.jar!/:na] at com.google.gson.Gson.fromJson(Gson.java:773) ~[gson-2.8.0.jar!/:na]

simple_response fulfillment message type unsupported in API when i fill the default response on intent creation

I followed the same example of yahoo-weather and based on the same only i put the default response assuming on failure of webhook response the default response will pop up. But, i am getting error simple_response fulfillment message type unsupported in API

https://github.com/api-ai/apiai-java-client/blob/master/web/servlet/src/main/java/ai/api/web/AIWebhookServlet.java and i am using same

AIWebhookServlet.java in my code to receive the data and parse. Exactly in the
doWebhook(gson.fromJson(request.getReader(), AIWebhookRequest.class), output); its failing in case of default response if i add. If i remove the default response then response from server comes but, if the server failed to respond then default error response is not poping up.

thanks,
gubs

Can't communicate with Dialogflow service

My working app suddenly started throwing an error and I am unable to communicate with Dialogflow service via API.ai library for Android.
Error:
W/System.err: ai.api.AIServiceException: Wrong service answer format. Please, connect to API.AI Service support

Entity @sys.duration returns inconsistent Json structure for quarters

For input "1 quarter" entity @sys.duration returns
"duration": "1 quarter"
instead of expected:

 "duration": {
        "amount": 1,
        "unit": "q"
      }

This is the only unit I noticed that behaves that way.

Following this topic - the supported units are not documented anywhere (was asked before on: https://discuss.api.ai/t/what-are-legal-sys-duration-units/4020 ) so I have enumerated there what I found.

  1. Would you accept a patch to ai.api.util.ParametersConverter class that adds the duration parsing functionality?
  2. What should it return? java.time.Duration?

parsing responses fails sometimes on fullfillment node

Response from an Intent without webhook:
...

"fulfillment": {                                    
	"speech": "Hallo.." 
	"messages": [{                              
		"type": 0,                          
		"speech": "Hallo.."
	}]                                          
}, 

...
With webhook enabled:
...

fulfillment": {                                                                           
   	"speech": "Hallo..",              
   	"source": "oo",                           
   	"displayText": "Test",                   
   	"messages": {                             
   		"type": 0,                        
   		"speech": "Hallo..o"       
  	}
},

the gson parser seems to insist on the array of messages:

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 34 column 20 path $.result.fulfillment.messages
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:200)

Or: the additonal "displayText" in the webhook response triggers that change.

"Accessibility Text" method in GoogleAssistant CardImage

Hello guys, I'm developing an Actions On Google app and, developing a list of CardItem I've realised a little bug of your library.

In the CardImage method is missing an important tag called "accessibility_text" that gives the following error on Google Assistant:

MalformedResponse
expected_inputs[0].possible_intents[0].input_value_data.option_value_spec.list_select.items[0].image: 'accessibility_text' is required.

I would like to help you and add it by myself: could i fork and pull request it?

Support of Arrays in followupEvent

Since introduction of "list" parameters in api.ai it is possible to bind the json array from the response of the followup event (AIEvent) to a "list" variable. This allows to output nice data driven buttons etc.

AIEvent has currently support of parameter map key=value where both key and a value are strings.

We should be able to support JsonElement as a value here, so that more complex types eg. array can be sent in the response.
screen shot 2017-09-11 at 18 07 44
screen shot 2017-09-11 at 18 08 47

{
  "speech": "some response",
  "followupEvent": {
    "name": "show-list-success",
    "data": {
      "running": [
        "server1",
        "server2",
        "server3"
      ],
      "stopped": [
        "server7",
        "server9"
      ]
    }
  }
}

How to set sessionId?

Hi,

Is there any way to set sessionId for a request?
For some reason, using the setter is not enough as somewhere along the way it get overriden.
I also looked into the configuration class and I don't see any point in which the sessionId is updated.

While making a request its not taking user supplied sessionId.

Hi,
I'm making a request to api.ai as
AIRequest request = new AIRequest(line); request.setSessionId(uId); AIResponse response = dataService.request(request);

but the request is not using the sessionId passed in AIRequest and its using the sessionId from the serviceContext which is sending same sessionId each time and its causing my contexts to be shared globally by all users. Do I need to create a new AIDataService object for each request and then set context?

Program Args

Hello! How do you program arguments in Intellij (Windows)? I am unable to find it in Run/Debug config. Any help is appreciated.

Where is Carousel List Object?

Hello,

I'm developing a Google Assistant app but in the Java DialogFlow library there is not support for Carousel List (or Carousel Selector). Can you help me?

Here is the source from Actions on Google.

The carousel scrolls horizontally and allows for selecting one item. Compared to the list selector, it has large tiles-allowing for richer content. The tiles that make up a carousel are similar to the Basic card with image. Selecting an item from the carousel will simply generate a chat bubble as the response just like with list selector. While they are visually compelling, carousels are limited in their utility in a multimodal interface. This is because they are hard to interact with as a voice interface (for that, we favor lists). Refer to the guidelines section of the carousels to learn more.

Test failing on mvn

Tests failing when running mvn install without -Dmaven.test.skip=true. Please check.


T E S T S

Running ai.api.AllUnitTests
date : ""
date-time : "2016-12-21T07:00:00-0400"
complex_param : {"nested_key":"nested_value"}
time : ""
text : "feed cat"
priority : ""
remind : "remind"
16:56:15.760 [main] DEBUG ai.api.AIDataService - Start request
16:56:15.762 [main] DEBUG ai.api.AIDataService - Response json: {}
16:56:15.762 [main] DEBUG ai.api.AIDataService - Start request
16:56:15.762 [main] DEBUG ai.api.AIDataService - Response json: {}
16:56:15.762 [main] DEBUG ai.api.AIDataService - Start request
16:56:15.763 [main] DEBUG ai.api.AIDataService - Response json: {}
Tests run: 69, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.896 sec <<< FAILURE!
getDateParameterTest(ai.api.model.AIResponseTest) Time elapsed: 0.01 sec <<< FAILURE!
java.lang.AssertionError: expected:<7> but was:<6>
at org.junit.Assert.fail(Assert.java:58)
at org.junit.Assert.failNotEquals(Assert.java:259)
at org.junit.Assert.assertEquals(Assert.java:80)
at org.junit.Assert.assertEquals(Assert.java:88)
at ai.api.model.AIResponseTest.getDateParameterTest(AIResponseTest.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:29)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

parseDateTimeTest(ai.api.util.ParametersConverterTest) Time elapsed: 0 sec <<< FAILURE!
java.lang.AssertionError: expected:<7> but was:<6>
at org.junit.Assert.fail(Assert.java:58)
at org.junit.Assert.failNotEquals(Assert.java:259)
at org.junit.Assert.assertEquals(Assert.java:80)
at org.junit.Assert.assertEquals(Assert.java:88)
at ai.api.util.ParametersConverterTest.parseDateTimeTest(ParametersConverterTest.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:29)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Results :

Failed tests: getDateParameterTest(ai.api.model.AIResponseTest): expected:<7> but was:<6>
parseDateTimeTest(ai.api.util.ParametersConverterTest): expected:<7> but was:<6>

Tests run: 69, Failures: 2, Errors: 0, Skipped: 0

Structure Issue In Json Object

Can we get some solid structure for parameters in results section?
For example for unit currency type when we give $50 we get currency type divided to amount and currency but when we give 50 it gives only unit currency and its value as 50 and now there is no sections like amount and currency.
Is there a way to get to know if inner parameter is null?
For example when we give 50 then can it give unit currency entity as amount=50 and currency=null?

Update Log4j version, improve tests

Hello,
A handful of requests:

  1. Update the Log4j version to 2.4 (or later) so that the library works on the Google App Engine, https://issues.apache.org/jira/browse/LOG4J2-1035
  2. There are some tests in AIResponseTest and ParametersConverterTest that are failing due to what appears to be timezone issues
  3. The libai-speech-gcp goal is failing.

I'd be happy to open a PR to address items 1 and 2. Item 3 would require some additional investigation.

Thanks!

Avoid use of Gson library JsonElement

While some of the models in the client contain maps of <String, Object>, others use <String, JsonElement> which can cause problems if you have a conflicting JSON library like Jackson (we're using Spring Boot). Suggest swapping to a more generic Java Object, which will make the library models more usable on their own.

Classes affected (it appears) are AIOutputContext.java, Fulfillment.java, and Result.java.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.