# GenieDialog\_setStopSequence API Users can set a list of stop sequences in dialog config initially. Along with that, Genie provides the ability of updating stop sequences dynamically at runtime. The API to achieve this: /** * @brief A function to set/update the list of stop sequences of a dialog. Old sequences if any are discarded. * Call with a nullptr or an empty JSON or an empty string to reset to no stop sequence. * * @param[in] dialogHandle A dialog handle. * * @param[in] newStopSequences A JSON string with list of new stop sequences. Must be null terminated. * * @return Status code: * - GENIE_STATUS_SUCCESS: API call was successful. * - GENIE_STATUS_ERROR_INVALID_HANDLE: Dialog handle is invalid. * - GENIE_STATUS_ERROR_JSON_FORMAT: JSON string is invalid. */ GENIE_API Genie_Status_t GenieDialog_setStopSequence(const GenieDialog_Handle_t dialogHandle, const char* newStopSequences); Copy to clipboard ## Example on how to update stop sequences in between queries //Create dialog config GenieDialogConfig_Handle_t dialogConfigHandle = NULL; GenieDialogConfig_createFromJson(dialogConfigStr, &dialogConfigHandle); //Create dialog GenieDialog_Handle_t dialogHandle = NULL; GenieDialog_create(dialogConfigHandle, &dialogHandle); //Query with original config GenieDialog_query(dialogHandle, promptStr, GenieDialog_SentenceCode_t::GENIE_DIALOG_SENTENCE_COMPLETE, queryCallback); //Update stop sequences using JSON string const char newStopSequences[] = "{\"stop-sequence\":[\".\",\",\"]}"; GenieDialog_setStopSequence(dialogHandle, newStopSequences); //Query with updated stop sequences GenieDialog_query(dialogHandle, promptStr, GenieDialog_SentenceCode_t::GENIE_DIALOG_SENTENCE_COMPLETE, queryCallback); //Fallback to no stop sequence, using any of the below const char noStopSequences[] = "{}"; //empty json GenieDialog_setStopSequence(dialogHandle, noStopSequences); const char noStopSequences2[] = "{\"stop-sequence\":[\"\"]}"; //empty string in json GenieDialog_setStopSequence(dialogHandle, noStopSequences2); GenieDialog_setStopSequence(dialogHandle, nullptr); //null pointer Copy to clipboard Last Published: Oct 02, 2025 [Previous Topic Using KV Rewind between queries](https://docs.qualcomm.com/bundle/publicresource/80-63442-100/topics/rewind.md) [Next Topic Token Query](https://docs.qualcomm.com/bundle/publicresource/80-63442-100/topics/token_query.md)