Skip to content

Add missing speech.context fields to match native SDK#1004

Open
rhurey wants to merge 2 commits into
masterfrom
rhurey/speech-context-missing-fields
Open

Add missing speech.context fields to match native SDK#1004
rhurey wants to merge 2 commits into
masterfrom
rhurey/speech-context-missing-fields

Conversation

@rhurey
Copy link
Copy Markdown
Member

@rhurey rhurey commented Apr 21, 2026

Summary

Populates 6 fields in the speech.context message that the native C++ SDK sends but the JS SDK was missing.

Changes

New methods in ServiceRecognizerBase.ts:

Method speech.context field Source property
setLanguageJson() phraseDetection.language RecoLanguage
setInitialSilenceTimeoutJson() phraseDetection.initialSilenceTimeout InitialSilenceTimeoutMs
setEndSilenceTimeoutJson() phraseDetection.trailingSilenceTimeout EndSilenceTimeoutMs
setProfanityOptionJson() phraseDetection.enrichment.profanity ProfanityOption
setStableIntermediateThresholdJson() phraseOutput.interimResults.stableThreshold StablePartialResultThreshold
setPostProcessingOptionJson() phraseDetection.enrichment.[mode].* PostProcessingOption

Interface changes:

  • Added postprocessingoption field to InteractiveEnrichmentOptions, ConversationEnrichmentOptions, DictationEnrichmentOptions

Design Decisions

  • Backward compatible: Existing URL query parameters in ConnectionFactoryBase are retained.
  • Stale state prevention: Each setter clears its field when the property is absent.
  • Deep merge: All setters mutate in place rather than replacing subtrees.
  • Language skip logic: setLanguageJson() skips when auto-detect is configured with a non-open-range value, matching native SDK.
  • TrueText expansion: setPostProcessingOptionJson() expands truetext to explicit punctuation/disfluency mode settings.

ADO Work Item

Task #31645 in Speedme/Carbon

Populate 6 fields in the speech.context message that the native C++ SDK
sends but the JS SDK was missing:

- phraseDetection.language (recognition language)
- phraseDetection.initialSilenceTimeout
- phraseDetection.trailingSilenceTimeout
- phraseDetection.enrichment.profanity
- phraseOutput.interimResults.stableThreshold
- phraseDetection.enrichment.[mode].postprocessingoption (with truetext expansion)

These were previously only sent as URL query parameters. They are now
also sent in the speech.context JSON body, matching native SDK behavior.
Existing URL query params are retained for backward compatibility.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rhurey
Copy link
Copy Markdown
Member Author

rhurey commented Apr 21, 2026

@copilot resolve the merge conflicts in this pull request

Resolve conflicts in:
- ServiceMessages/PhraseDetection/ConversationEnrichmentOptions.ts
- ServiceMessages/PhraseDetection/DictationEnrichmentOptions.ts
- ServiceMessages/PhraseDetection/InteractiveEnrichmentOptions.ts
- ServiceRecognizerBase.ts

Keep PR's implementations for all new methods (setLanguageJson,
setInitialSilenceTimeoutJson, setEndSilenceTimeoutJson,
setProfanityOptionJson, setStableIntermediateThresholdJson) and
use cleaner typed setPostProcessingOptionJson from PR, removing
duplicate imports that the auto-merge added from master.

Co-authored-by: rhurey <13647168+rhurey@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI commented Apr 21, 2026

@copilot resolve the merge conflicts in this pull request

Merge conflicts resolved in commit 8299ac4. The conflicts were in 4 files where both branches had added the postprocessingoption field and setPostProcessingOptionJson() method. I kept the PR's cleaner implementations (typed intermediateDisfluencyMode property instead of type casting, plus all the additional new methods) and removed the duplicate imports that the auto-merge had introduced.

@rhurey
Copy link
Copy Markdown
Member Author

rhurey commented Apr 21, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants