Skip to content

fix AI.generate dispatch + isAvailable check - #345

Merged
dli7319 merged 1 commit into
google:mainfrom
salmanmkc:fix/ai-generate-dispatch
Jun 5, 2026
Merged

fix AI.generate dispatch + isAvailable check#345
dli7319 merged 1 commit into
google:mainfrom
salmanmkc:fix/ai-generate-dispatch

Conversation

@salmanmkc

@salmanmkc salmanmkc commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

if you've got OpenAI configured, xb.ai.generate(...) just throws 'Wrapper not implemented' because OpenAI's generate takes 0 args. same dispatch as #343, bail early for backends that don't do generate.

AI.generate forwarded 4 args to this.model!.generate, but OpenAI.generate takes 0 args and throws 'Wrapper not implemented'. with OpenAI configured, calling xb.ai.generate would just throw the wrapper error and the signature mismatch silently passes type-check via the loose abstract base.

mirrors the dispatch pattern just added to AI.query: check isAvailable first, branch on the model, throw a clear error for backends that don't support it.
@dli7319
dli7319 force-pushed the fix/ai-generate-dispatch branch from 73e5d2b to fa9930b Compare June 5, 2026 20:02
@dli7319
dli7319 merged commit 2395de6 into google:main Jun 5, 2026
8 checks passed
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.

2 participants