Loading workspace insights... Statistics interval
7 days30 daysLatest CI Pipeline Executions
ae34d64f 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> 4a6bc95f fix(bedrock): surface in-band Converse errors, honest provider options, throw on bad tool args
Addresses the post-review findings on the Converse adapter:
- Surface in-band Converse stream errors (throttling, validation, model
stream faults, service-unavailable) as RUN_ERROR instead of dropping them
and ending the stream as a clean truncated success. Shared
`throwIfConverseStreamError` guard used by both the processor and
`structuredOutputStream`.
- Narrow Converse provider options to what the adapter actually forwards
(`BedrockConverseProviderOptions`) so it no longer advertises OpenAI-only
knobs it silently drops, and forward `stop` -> `inferenceConfig.stopSequences`.
- Throw on malformed / non-object assistant tool-call arguments instead of
coercing to `{}` and forwarding a corrupted call.
- Map the forced structured-output tool's `tool_use` stop reason to `stop`
(matching openai-base), not `tool_calls`.
- Fix `readApiKeyFromEnv` so a present-but-blank `BEDROCK_API_KEY` falls
through to `AWS_BEARER_TOKEN_BEDROCK` instead of masking it and skipping
to SigV4.
- Comment/doc accuracy: drop "(per C3)" and the pinned SDK version, correct
the generic-constraint comments (`Record<string, any>`), soften the
reasoning "field-for-field" claim, fix README SigV4 attribution, doc
reasoning caveat, and the superseded Llama model id.
- Tests: delete redundant auth.test.ts (mantle assertion folded into
client.test.ts) and factory.test.ts; add coverage for in-band errors,
buildInput sampling/stop mapping, concurrent tool blocks, auth precedence,
and malformed tool-arg throws.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> 244e5310 fix(bedrock): address maintainer review (structured output, model guard, lifecycle, auth, docs)
- extractStructuredToolInput: only accept the forced structured tool (or an
unnamed block); drop the second pass that returned any tool's input, so a
hallucinated/leftover tool call no longer masquerades as the result.
- build(): guard the api:'chat' branch with isChatModel instead of an
unchecked `as BedrockChatModels` cast (mirrors isResponsesModel).
- processConverseStream: thread incoming threadId/parentRunId/model onto
RUN_STARTED/RUN_FINISHED so the chat path matches sibling adapters.
- auth: read env directly (empty treated as absent) instead of nested blind
try/catch; drop now-unused @tanstack/ai-utils dependency.
- message-converter: log malformed/non-object tool-call args instead of
silently coercing to {}; remove an unnecessary cast.
- README: mention Converse (default), drop removed aws-sigv4-fetch peer
steps, use current claude-haiku-4-5 id, fix stream-loop snippet.
- Add unit tests for finishReason/usage folding, orphaned tool-call drain,
reasoning->text ordering, lifecycle threading, and structuredOutputStream
empty-response/parse-error paths.