feat: LLM-triggered switch_language tool for multilingual conversations#533
Draft
feat: LLM-triggered switch_language tool for multilingual conversations#533
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
switch_languageas a built-in LLM tool (same pattern astransfer_call) that lets the LLM switch ASR/TTS languages mid-conversation via function callingTranscriberPoolandSynthesizerPool— thin wrappers that hold multiple transcriber/synthesizer instances and expose aswitch(label)method for instant language switching__setup_transcriber/__setup_synthesizerthat read amultilingualconfig block and build poolsapi_toolswhen pools are active (withenumconstraint listing available languages) — no manual config neededswitch_languageso the switch is seamlessFlow
Files changed
bolna/constants.py—SWITCH_LANGUAGE_TOOL_DEFINITIONschemabolna/agent_manager/task_manager.py—__inject_switch_language_tool(), handler in__execute_function_call,switch_language()method, multilingual pool setup pathsbolna/helpers/utils.py— suppress pre-call filler forswitch_languagebolna/transcriber/transcriber_pool.py— newTranscriberPoolclassbolna/synthesizer/synthesizer_pool.py— newSynthesizerPoolclassbolna/transcriber/__init__.py,bolna/synthesizer/__init__.py— pool exports