Skip to content

fix(mistralai): support assistant-ending chat contexts - #7036

Open
mikemikimike wants to merge 1 commit into
livekit:mainfrom
mikemikimike:fix/7030-mistral-assistant-tail
Open

fix(mistralai): support assistant-ending chat contexts#7036
mikemikimike wants to merge 1 commit into
livekit:mainfrom
mikemikimike:fix/7030-mistral-assistant-tail

Conversation

@mikemikimike

Copy link
Copy Markdown
Contributor

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.

@mikemikimike
mikemikimike requested a review from a team as a code owner August 29, 2026 08:54

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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.

1 participant