Virtual Agent AI Search Fallback - Empty JSON
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2024 06:45 AM
I am working with an OOB Virtual Agent, I've enabled AI Search within it but it appears that it is not passing the search value or some other error causing no result.
I get the "I'm having technical issues and won't be able to continue this conversation" error when attempting to search within the Virtual Agent.
When I try in Flow Designer and check the AI Search action I get "Error: Empty JSON string,Detail: Empty JSON string"
Below is the log:
Encountered error executing instruction: OpInstruction{id=1, opClass=com.snc.process_flow.operation.script.ScriptOperation, io=Io{input={mid_selection=RefOrValue{value=auto_select, isRef=false}, capabilities=RefOrValue{value=, isRef=false}, mid_server=RefOrValue{value=, isRef=false}, mid_cluster=RefOrValue{value=, isRef=false}, mid_selection_type=RefOrValue{value=any, isRef=false}, additional_context=RefOrValue{value=in.additional_context, isRef=true}, search_context_id=RefOrValue{value=in.search_context_id, isRef=true}, locale=RefOrValue{value=in.locale, isRef=true}, script=RefOrValue{value=(function execute(inputs, outputs) {
var context = JSON.parse(inputs.logging_context);
var actionStartTime = new GlideDateTime().getNumericValue() - parseInt(inputs.start_time);
var logger = VAAISearchHelper.getLogger(context);
gs.log('AI Search FDIH action started: {0}ms', actionStartTime);
try {
// Log all inputs
gs.log('Inputs: {0}', JSON.stringify(inputs));
// Retrieve search results
var api = new AISearchRetrieveSearchResultsWrapper();
var searchResult = api.retrieveSearchResults(inputs.search_term, inputs.context_profile_id, inputs.search_context_id,
inputs.logging_context, inputs.locale, inputs.additional_context);
// Log the API response
gs.log('API Response: {0}', searchResult);
// Check if searchResult is empty or invalid JSON
if (!searchResult) {
throw new Error("Empty response from API");
}
outputs.search_results = JSON.parse(searchResult);
} catch (ex) {
gs.log("Error retrieving search results: {0}", ex.toString());
// Set default response
var defaultResponse = "{\n" +
" \"result\": [\n" +
" {\n" +
" \"executionResult\": {\n" +
" \"searchResultsTemplates\": {\n" +
" \"items\": [\n" +
" ]\n" +
" },\n" +
" \"geniusResultsTemplates\": {\n" +
" \"items\": [\n" +
" ]\n" +
" }\n" +
" },\n" +
" \"errors\": [],\n" +
" \"status\": 204\n" +
" }\n" +
" ]\n" +
"}";
outputs.search_results = JSON.parse(defaultResponse);
}
outputs.end_time = new GlideDateTime().getNumericValue().toString();
})(inputs, outputs);
, isRef=false}, start_time=RefOrValue{value=in.start_time, isRef=true}, connection_alias=RefOrValue{value=, isRef=false}, application=RefOrValue{value={"display":"ALL", "value":"35aa573fd7802200bdbaee5b5e610375"}, isRef=false}, required_run_time=RefOrValue{value=instance, isRef=false}, host=RefOrValue{value=, isRef=false}, search_term=RefOrValue{value=in.search_term, isRef=true}, logging_context=RefOrValue{value=in.logging_context, isRef=true}, context_profile_id=RefOrValue{value=in.context_profile_id, isRef=true}}, output={search_results=s1o.search_results, end_time=s1o.end_time, __step_status__=s1o.__step_status__}, defaultOutput={}}, name=3f92b6168752421009cf4229dabb35a6, parentActionId=c93fa3795b221010a76b04d13d81c767}
com.snc.process_flow.exception.OpException: Error: Empty JSON string,Detail: Empty JSON string
at com.snc.process_flow.operation.script.ScriptOperationBase.handleScriptResult(ScriptOperationBase.java:64)
at com.snc.process_flow.operation.script.ScriptOperationBase.runScript(ScriptOperationBase.java:52)
at com.snc.process_flow.operation.script.ScriptOperation.run(ScriptOperation.java:75)
at com.snc.process_flow.engine.Operation.run2(Operation.java:90)
at com.snc.process_flow.v2.exec.OpRunner.runOperation(OpRunner.java:73)
at com.snc.process_flow.v2.exec.OpRunner.runOperation(OpRunner.java:67)
at com.snc.process_flow.v2.exec.OpInstructionExecutor.runOperation(OpInstructionExecutor.java:60)
at com.snc.process_flow.v2.exec.OpInstructionExecutor.execute(OpInstructionExecutor.java:27)
at com.snc.process_flow.v2.exec.OpInstructionExecutor.execute(OpInstructionExecutor.java:16)
at com.snc.process_flow.v2.exec.EngineV2.executeInstructions(EngineV2.java:176)
at com.snc.process_flow.v2.exec.EngineV2.run(EngineV2.java:102)
at com.snc.process_flow.v2.exec.EngineRunner.lambda$run$0(EngineRunner.java:28)
at com.snc.process_flow.v2.exec.enviroment.execution.ExecutionScopeRunner.run(ExecutionScopeRunner.java:37)
at com.snc.process_flow.v2.exec.EngineRunner.run(EngineRunner.java:28)
at com.snc.process_flow.engine.EngineV2Adapter.run(EngineV2Adapter.java:253)
at com.snc.process_flow.engine.EngineV2Adapter.resume(EngineV2Adapter.java:349)
at com.snc.process_flow.engine.ProcessAutomation.run(ProcessAutomation.java:101)
at com.snc.process_flow.engine.GlideProcessAutomation.runSync(GlideProcessAutomation.java:218)
at com.snc.process_flow.engine.GlideProcessAutomation.runWithDomain(GlideProcessAutomation.java:378)
at com.snc.process_flow.engine.GlideProcessAutomation.lambda$runAsUserSync$1(GlideProcessAutomation.java:343)
at com.snc.process_flow.engine.PFSessionClone.run(PFSessionClone.java:71)
at com.snc.process_flow.engine.GlidePFSession.runPlanAsUserSession(GlidePFSession.java:42)
at com.snc.process_flow.engine.GlideProcessAutomation.runAsUserSync(GlideProcessAutomation.java:341)
at com.snc.process_flow.engine.GlideProcessAutomation.messageFlow(GlideProcessAutomation.java:429)
at com.snc.process_flow.engine.GlideProcessAutomation._start(GlideProcessAutomation.java:711)
at com.snc.process_flow.engine.GlideProcessAutomation$StartBuilder.start(GlideProcessAutomation.java:1723)
at com.glide.flow_design.action.providers.ActionTypeRepoBackedProvider.testAction(ActionTypeRepoBackedProvider.java:771)
at com.glide.flow_design.rest.ActionService.testAction(ActionService.java:1095)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.glide.rest.handler.impl.ServiceHandlerImpl.invokeService(ServiceHandlerImpl.java:44)
at com.glide.rest.processors.RESTAPIProcessor.process(RESTAPIProcessor.java:345)
at com.glide.processors.AProcessor.runProcessor(AProcessor.java:762)
at com.glide.processors.AProcessor.processTransaction(AProcessor.java:313)
at com.glide.processors.ProcessorRegistry.process0(ProcessorRegistry.java:187)
at com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:175)
at com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:58)
at com.glide.sys.Transaction.run(Transaction.java:2734)
at com.glide.ui.HTTPTransaction.run(HTTPTransaction.java:35)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
I tried adding some logging into the AI Search Action but was unable to find any further information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2024 12:45 PM
The utterance is hitting AI Search - Fallback but not AI Search is the best I can figure out as to the why, but the how/how to fix is not something I've been able to drill into.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2025 06:08 AM