Repository navigation
feat(ai): add the input option to fakeText - #1695
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (6)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough
ChangesFake text input modalities
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Merge Risk: ⚪ Minimal · up to The input option and its documented behavior appear ready to merge after normal checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit 32a38e3
☁️ Nx Cloud last updated this comment at |
@tanstack/ai
@tanstack/ai-acp
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-bedrock
@tanstack/ai-byteplus
@tanstack/ai-claude-code
@tanstack/ai-client
@tanstack/ai-cloudflare
@tanstack/ai-code-mode
@tanstack/ai-code-mode-snippets
@tanstack/ai-codex
@tanstack/ai-cohere
@tanstack/ai-compaction
@tanstack/ai-devtools-core
@tanstack/ai-durable-stream
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-grok-build
@tanstack/ai-groq
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-daytona
@tanstack/ai-isolate-e2b
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-isolate-quickjs-bun
@tanstack/ai-llmgateway
@tanstack/ai-lovable
@tanstack/ai-mcp
@tanstack/ai-memory
@tanstack/ai-mistral
@tanstack/ai-octane
@tanstack/ai-ollama
@tanstack/ai-ollaya
@tanstack/ai-openai
@tanstack/ai-opencode
@tanstack/ai-openrouter
@tanstack/ai-perplexity
@tanstack/ai-persistence
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-react-ui
@tanstack/ai-reactor
@tanstack/ai-remix
@tanstack/ai-sandbox
@tanstack/ai-sandbox-blaxel
@tanstack/ai-sandbox-boxd
@tanstack/ai-sandbox-cloudflare
@tanstack/ai-sandbox-daytona
@tanstack/ai-sandbox-docker
@tanstack/ai-sandbox-e2b
@tanstack/ai-sandbox-local-process
@tanstack/ai-sandbox-railway
@tanstack/ai-sandbox-sprites
@tanstack/ai-sandbox-upstash-box
@tanstack/ai-sandbox-vercel
@tanstack/ai-skills
@tanstack/ai-solid
@tanstack/ai-solid-ui
@tanstack/ai-svelte
@tanstack/ai-typesafe
@tanstack/ai-utils
@tanstack/ai-vercel-gateway
@tanstack/ai-vertex
@tanstack/ai-vue
@tanstack/ai-vue-ui
@tanstack/ai-worldlabs
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
@tanstack/svelte-ai-devtools
commit: |
Coverage✅ Coverage held across 66 compared package(s). Each package is measured twice in this job — on this PR and on its merge-base with
|
fakeText()takes aninputoption again, for examplefakeText({ input: ['text', 'image'] }). It sets the fake'sinputModalities, so you can test code that checks what a model accepts with no network. #1682 left the option out, becauseinputModalitieswas not onmainyet. #1685 has landed since then.🎯 Changes
FakeTextOptionsandFakeTextAdapterget aTInputtype parameter. Its default isReadonlyArray<Modality>, so existing code does not change.inputsetsinputModalitiesat run time and'~types'.inputModalitiesat type level.inputModalitiesstays optional, as onTextAdapter, so the fake is still an adapter underexactOptionalPropertyTypes.chat()accepts a plainModelMessagetoo, on purpose, so that wire payloads can be forwarded. Soinput: ['text']does not make an image a type error inchat(). It types the adapter's modality data for the helper types.inputrow in the Options table ofadvanced/testing.md.@tanstack/aiminor.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.docs/for this change, or this change is not user-facing.pnpm changeset), or this PR does not change a published package.🚀 Release Impact
Testing
Commands run
vitest runinpackages/ai: 2116 tests pass, including the newsets inputModalities from the input option.tscforpackages/ai, with type tests infake-text.test-d.ts. They check two things:inputgivesreadonly ['text', 'image'].inputModalitiesstays optional.test:oxlint: clean.pnpm test:docs: no broken links.pnpm test:prand the E2E suite. CI runs them.Manual test
pnpm --dir packages/ai exec vitest run tests/fake-text.test.ts.fakeText({ input: ['text', 'image'] }).inputModalitiesgives['text', 'image'], and thatfakeText().inputModalitiesisundefined.How this PR makes testing easy: a unit test and a type test.
Risk / rollback
Low. This is a new optional option with a default type parameter. To undo, revert this PR.
Public API change
After
Summary by CodeRabbit