fix(mistralai): support assistant-ending chat contexts - #7036
Open
mikemikimike wants to merge 1 commit into
Open
fix(mistralai): support assistant-ending chat contexts#7036mikemikimike wants to merge 1 commit into
mikemikimike wants to merge 1 commit into
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
The Mistral Conversations API requires a user or tool entry after an assistant output when starting a new response. LiveKit can legitimately call
generate_reply()with an assistant message at the end of the chat context, including after a filler message, but the Mistral formatter previously forwarded that context unchanged.This change wires the existing dummy-user-message option through the Mistral provider formatter and appends an
(empty)user input only when the formatted context ends with an assistant entry. The option can still be disabled explicitly.Tests
uv run --frozen pytest tests/test_chat_ctx.py --unit: 59 passed, 1 skipped because LiveKit credentials are not configured.uv run --frozen ruff check ...: passed.uv run --frozen ruff format --check ...: passed after formatting.git diff --check: passed.The repository-wide type-check script was started but did not produce output after approximately two minutes on the local Windows environment and was stopped; it was not reported as passing.