TanStack
OSS
ai
feat: add Mistral provider adapter for TanStack AI (#462) * feat: add Mistral provider adapter for TanStack AI - Implemented MistralTextAdapter and related functions for chat completions. - Defined Mistral-specific message types and metadata structures. - Created model metadata for various Mistral models with pricing and capabilities. - Added text provider options and validation for Mistral text models. - Developed utility functions for Mistral client configuration and schema conversion. - Implemented function tool conversion for Mistral-specific formats. - Added tests for Mistral adapters, including event emissions and error handling. - Configured TypeScript and Vite for the new package. * feat: implement Mistral text adapter with enhanced streaming and error handling * ci: apply automated fixes * fix(e2e): re-add @tanstack/ai-mistral dependency to package.json Co-authored-by: Copilot <copilot@github.com> * refactor: reorder imports and simplify UUID generation in client utility * ci: apply automated fixes * fix(ai-mistral): CR loop fixes — data correctness, lifecycle, reasoning - transformNullsToUndefined preserves array length and object keys instead of dropping null slots/keys (data corruption fix). - Stream lifecycle: emit TEXT_MESSAGE_END / TOOL_CALL_END / RUN_FINISHED on early termination; inner generator no longer double-emits RUN_ERROR. - Tool-call args buffered before id+name arrive are now replayed as a single TOOL_CALL_ARGS event so streaming consumers see the full prefix. - Tool-call argument JSON.parse failures throw with tool name + id context instead of silently substituting {}. - transformNullsToUndefined now applied to tool-call inputs (not only structuredOutput), so user tool handlers receive undefined where the schema declared optional. - Streaming requests now opt in to stream_options.include_usage so RUN_FINISHED.usage isn't permanently undefined. - modelOptions.temperature / top_p are no longer silently dropped. - Empty SSE catch swallowing JSON.parse errors replaced with explicit warn-on-syntax-error and throw-on-error-frame paths. - response.body non-null assertion replaced with a clear empty-body error. - convertContentPartToMistral throws a descriptive error for unsupported modalities instead of silently dropping the part. - Reasoning streams (Magistral) plumbed through as REASONING_* AG-UI events. Adapter accepts both wire shapes: - Mistral SDK ContentChunk: delta.content[].type='thinking' - OpenAI-compat (DeepSeek, aimock): delta.reasoning_content - generateId switched to crypto.randomUUID(). - Build/config consistency: deleted duplicate vitest.config.ts; added @tanstack/ai, @tanstack/ai-client, zod to devDependencies; tsconfig now includes tests/. - README narrows multimodal claim to the vision-capable model list and advertises reasoning support. - E2E: enable mistral on the reasoning feature row with a magistral modelOverride (uses the existing modelOverrides mechanism). - Docs: new docs/adapters/mistral.md page wired into config.json. 23 unit tests pass (was 10), publint --strict clean, vite build clean. * ci: apply automated fixes * ci: apply automated fixes (attempt 2/3) * fix(docs): make mistral adapter doc snippets type-check under kiira - Structured-output example uses `await chat({ outputSchema })` (returns the typed object directly); `generate` is not exported from `@tanstack/ai`. - Model-options example moves `temperature`/`top_p`/`max_tokens` into `modelOptions` (Mistral's native names) — they are no longer top-level `TextOptions` fields — and fixes the now-inaccurate note. - Data-URL image fragment is a complete, type-checked `chat()` snippet. - Reasoning raw-stream example tagged `ignore` (matches the gemini/cencori/ middleware precedent: @ag-ui/core's `chunk.type` discriminant isn't resolvable in kiira's source-only check). --------- Co-authored-by: Alem Tuzlak <t.zlak@hotmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Copilot <copilot@github.com>
nx run-many --targets=build --exclude=examples/**,testing/**
Sign in / Sign up
Open main menu
Succeeded
CI Pipeline Execution
nx run-many --targets=build --exclude=examples/**,testing/**
Click to copy
Linux
4 CPU cores
ae34d64f
665
Get faster results
Learn how to enable distribution.
Atomizer enabled
35 groups of tasks optimized.