There are two ways to provide user input to a session:
audio and text. Text input is sent using the PushText
method as described below. Diatheke will respond with appropriate events
on the session’s event stream.
// Push text using the client and sessionID
err := client.PushText(context.Background(), sessionID, "What's the capital of Assyria?")
// OR push text using the session object
err := session.PushText(context.Background(), "What's the capital of Assyria?")
// Push text using the client and sessionID
client.pushText(sessionID, "What's the capital of Assyria?");
// OR push text using the session object
session.pushText("What's the capital of Assyria?");
# Push text using the client and session ID
client.push_text(session_id, "What's the capital of Assyria?")
# OR push text using the session object
session.push_text("What's the capital of Assyria?")
# Push text using the client and session ID
client.pushText(sessionID: sessionID, text: "What's the capital of Assyria?") { (error) in
print(error.localizedDescription)
}
# OR push text using the session object
session.pushText("What's the capital of Assyria?") { (error) in
print(error.localizedDescription)
}
DiathekeOuterClass.PushTextRequest pushTextRequesth = DiathekeOuterClass.PushTextRequest.newBuilder()
.setSessionId(sessionId)
.setText(text)
.build();
mClient.pushText(pushTextRequesth, new StreamObserver<DiathekeOuterClass.Empty>() {
@Override
public void onNext(DiathekeOuterClass.Empty value) {
}
@Override
public void onError(Throwable t) {
}
@Override
public void onCompleted() {
}
});