tools.reset_music_context module
Reset the Lyria music generation context for a hard transition.
- async tools.reset_music_context.run(guild_id, ctx=None)[source]
Request a context reset for the active Lyria music stream.
Entry point for the
reset_music_contexttool. It forces a hard transition in the bot’s running Lyria generation so musical changes (BPM, scale, prompts) take effect cleanly, without tearing down the audio stream itself. This is useful right after a major config change where you want the model to discard its prior musical context rather than smoothly morph into the new settings.It resolves the Discord client from the context via
tools._discord_helpers.get_discord_client()(returning that helper’s error string verbatim if the client is unavailable), reaches thelyria_servicehanging offctx.adapter(the ProxyPlatformAdapter on the inference worker), and delegates to itsreset_contextcoroutine keyed by the parsed integer guild ID. No Redis, KG, or HTTP access happens here; the side effect is the in-flight reset of the per-guild Lyria session.Dispatched by the tool registry (
tools.ToolRegistry.call()) after the loader picks up this module’srunvia itsTOOL_NAME/TOOL_DESCRIPTIONmetadata; no direct in-code callers were found.- Parameters:
guild_id (
str) – Discord server (guild) ID as a string; it is parsed to an integer to look up the active session.ctx (
ToolContext|None) – Tool execution context. Must carry a non-Noneadapterexposinglyria_service.
- Returns:
The status message returned by
lyria.reset_context, or an error string when the adapter or Discord client is missing orguild_idis not a valid integer.- Return type: