feat(ai): MiniMax full-stack — embeddings compat shim, asymmetric type, chat touchpoint#2220
Open
tcflying wants to merge 7 commits into
Open
feat(ai): MiniMax full-stack — embeddings compat shim, asymmetric type, chat touchpoint#2220tcflying wants to merge 7 commits into
tcflying wants to merge 7 commits into
Conversation
Author
|
Added one more commit ( |
added 7 commits
June 19, 2026 19:43
…ata)
MiniMax /v1/embeddings is not OpenAI-shaped: it requires {model,texts,type}
and returns {vectors,base_resp}, but the minimax recipe was tagged
openai-compatible with no fetch shim, so embed sent {input} and got
status_code 2013, surfacing as 'Invalid JSON response' / 0 chunks embedded.
Adds minimaxCompatFetch (mirrors voyage/zeroentropy shims): maps input->texts,
derives type from threaded input_type (query|db), strips OpenAI-only keys,
rewrites {vectors} -> {data:[{embedding,index}]}, and surfaces a non-zero
base_resp.status_code as a thrown error. Verified end-to-end: embo-01 (1536d)
embeds + semantic query returns the expected page.
dims.ts hardcoded type:'db' for embo-01 (symmetric), with the asymmetric seam deferred. Emit input_type instead so embedQuery threads 'query' and embed threads 'document' through __embedInputTypeStore; minimaxCompatFetch maps it to the wire type. Verified: doc embed (type:db) + query (type:query) both succeed against embo-01, semantic recall intact.
…thesis on MMX MiniMax exposes an OpenAI-compatible /v1/chat/completions endpoint (same MINIMAX_API_KEY); M3 function-calls and returns OpenAI-shaped responses, so no compat shim is needed. Adds a chat touchpoint (MiniMax-M3, MiniMax-M2.7; supports_tools, 800K ctx, ~$0.58/$2.33 per 1M). With this + the embo-01 embedding fix, gbrain runs end-to-end (embed + search + graph + chat synthesis) on MiniMax alone — no OpenAI/Anthropic key. Verified: gbrain think synthesizes from a brain page with a citation, Model: minimax:MiniMax-M3.
… touchpoint dimsProviderOptions now emits input_type (mapped to MiniMax's wire type by minimaxCompatFetch) instead of the hardcoded type:'db'; assert the document default + query path. Add coverage for the new chat touchpoint.
The detached `gbrain check-update --refresh-cache` refresh spawned on CLI startup had no windowsHide, so on Windows it flashed a console window and could surface a launch-error dialog (0x800700e8). Add windowsHide: true — it is a best-effort background refresh, never user-facing.
propose_takes hardcoded 'claude-sonnet-4-6' for the budget pre-check estimate AND the take_proposals.model_id audit column, while the actual gateway.chat call uses the configured chat model. On a non-Anthropic setup (e.g. MiniMax) this estimated cost at Sonnet rates (over-charging the budget → fewer pages scanned per run) and mislabeled the audit. Add getChatModelSafe() (resolved chat model, never-throws) and use it as the fallback so budget + label match the model actually used. Verified: propose-takes + grade-takes + calibration tests pass, typecheck clean.
Same fix as propose_takes: grade-takes (single-judge fallback) and calibration-profile hardcoded 'claude-sonnet-4-6' for the judge/model label while the real gateway.chat call uses the configured model. Use getChatModelSafe() so non-Anthropic setups (MiniMax) record the model actually used. Tests pin the default model explicitly (model: 'claude-sonnet-4-6') so they stay deterministic regardless of gateway config. All cycle tests pass + typecheck clean.
8693b83 to
4813e13
Compare
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.
Problem
The
minimaxrecipe declared only anembeddingtouchpoint and was taggedopenai-compatible, but MiniMax's/v1/embeddingsendpoint is not OpenAI-shapedat the wire level — it requires
{model, texts, type}and returns{vectors, base_resp}. With no fetch shim, the AI SDK sent{input}and MiniMaxreplied
status_code 2013 "missing required parameter texts", surfacing as[embed(minimax:embo-01)] Invalid JSON responseandEmbedded 0 chunks. MiniMax waseffectively unusable for embeddings, and there was no chat touchpoint at all.
Fix (3 commits)
gateway.ts—minimaxCompatFetch(mirrorsvoyageCompatFetch/zeroEntropyCompatFetch): OUTBOUND mapsinput → texts, derivestypefrom thethreaded
input_type, strips OpenAI-only keys; INBOUND rewrites{vectors} → {data:[{embedding,index}]}and surfaces a non-zerobase_resp.status_codeas a thrown error (MiniMax returns HTTP 200 on logicalerrors). Wired into
instantiateEmbedding'sfetchWrapperdispatch forrecipe.id === 'minimax'.dims.ts— asymmetric retrieval. embo-01 now emitsinput_type(same seam asZE/Voyage) instead of a hardcoded
type:'db', soembedQuery()threads'query'and
embed()threads'document'; the shim maps that to MiniMax'stype: db|querywire field.
recipes/minimax.ts— chat touchpoint. MiniMax exposes an OpenAI-compatible/v1/chat/completionsendpoint (same key); M3 function-calls and returnsOpenAI-shaped responses (no shim needed). Adds
MiniMax-M3/MiniMax-M2.7(
supports_tools, 800K ctx). With this plus the embedding fix, gbrain runsend-to-end — embed + search + graph + chat synthesis — on MiniMax alone, no
OpenAI/Anthropic key required.
Testing
embo-01embeds(1536d), asymmetric
db/queryboth succeed,gbrain thinksynthesizes from abrain page with a citation (
Model: minimax:MiniMax-M3).test/ai/recipe-minimax.test.tsupdated for the newinput_typebehavior (documentdefault + query path) and a new chat-touchpoint assertion.
recipe-minimax,recipes-existing-regression,gateway,gateway-chat,dims-openai,dims-zeroentropy(89+ tests, 0 fail);bun run typecheckclean.🤖 Generated with Claude Code