public class AIDataService extends Object
| Constructor and Description |
|---|
AIDataService(AIConfiguration config)
Create new service with unique context for given configuration
|
AIDataService(AIConfiguration config,
AIServiceContext serviceContext)
Create new service for given configuration and some predefined service context
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
doSoundRequest(InputStream voiceStream,
String queryData) |
protected String |
doSoundRequest(InputStream voiceStream,
String queryData,
Map<String,String> additionalHeaders)
Method extracted for testing purposes
|
protected String |
doTextRequest(String requestJson) |
protected String |
doTextRequest(String endpoint,
String requestJson) |
protected String |
doTextRequest(String endpoint,
String requestJson,
Map<String,String> additionalHeaders) |
AIServiceContext |
getContext() |
AIResponse |
request(AIRequest request) |
AIResponse |
request(AIRequest request,
RequestExtras requestExtras)
Make request to the ai service.
|
boolean |
resetContexts()
Forget all old contexts
|
AIResponse |
uploadUserEntities(Collection<Entity> userEntities) |
AIResponse |
uploadUserEntity(Entity userEntity) |
AIResponse |
voiceRequest(InputStream voiceStream)
Make requests to the ai service with voice data.
|
AIResponse |
voiceRequest(InputStream voiceStream,
List<AIContext> aiContexts)
Make requests to the ai service with voice data.
|
AIResponse |
voiceRequest(InputStream voiceStream,
RequestExtras requestExtras)
Make requests to the ai service with voice data.
|
public AIDataService(@NotNull
AIConfiguration config,
AIServiceContext serviceContext)
config - Service configuration dataserviceContext - Service context. If null then new context will be createdIllegalArgumentException - If config parameter is nullpublic AIDataService(@NotNull
AIConfiguration config)
config - Service configuration dataIllegalArgumentException - If config parameter is null@NotNull public AIServiceContext getContext()
public AIResponse request(@NotNull AIRequest request) throws AIServiceException
AIServiceException@NotNull public AIResponse request(@NotNull AIRequest request, RequestExtras requestExtras) throws AIServiceException
request - request object to the serviceAIServiceException@NotNull public AIResponse voiceRequest(@NotNull InputStream voiceStream) throws AIServiceException
voiceStream - voice data stream for recognitionAIServiceException@NotNull public AIResponse voiceRequest(@NotNull InputStream voiceStream, List<AIContext> aiContexts) throws AIServiceException
voiceStream - voice data stream for recognitionaiContexts - additional contexts for requestAIServiceException@NotNull public AIResponse voiceRequest(@NotNull InputStream voiceStream, RequestExtras requestExtras) throws AIServiceException
voiceStream - voice data stream for recognitionrequestExtras - object that can hold additional contexts and entitiesAIServiceExceptionpublic boolean resetContexts()
public AIResponse uploadUserEntity(Entity userEntity) throws AIServiceException
AIServiceExceptionpublic AIResponse uploadUserEntities(Collection<Entity> userEntities) throws AIServiceException
AIServiceExceptionprotected String doTextRequest(String requestJson) throws MalformedURLException, AIServiceException
protected String doTextRequest(String endpoint, String requestJson) throws MalformedURLException, AIServiceException
protected String doTextRequest(@NotNull String endpoint, @NotNull String requestJson, Map<String,String> additionalHeaders) throws MalformedURLException, AIServiceException
protected String doSoundRequest(@NotNull InputStream voiceStream, @NotNull String queryData) throws MalformedURLException, AIServiceException
protected String doSoundRequest(@NotNull InputStream voiceStream, @NotNull String queryData, Map<String,String> additionalHeaders) throws MalformedURLException, AIServiceException
Copyright © 2016. All rights reserved.