-
Notifications
You must be signed in to change notification settings - Fork 76
Description
As we work on implementing support for the prompt API on Android, there is a chance that at least our initial version won't support RegExp or JSON schema constraints.
We are hopeful that this can be quickly fixed, and if so, there is no action for this issue. However, if there are platforms that cannot support input constraints, then we might want to consider an API for detecting this. (For example, if someone wanted to create a version of the prompt API wrapping the Anthropic HTTP API, I believe it would not be able to support RegExp constraints.)
That is, instead of the developer creating a session, and then realizing via repeated "NotSupportedError" DOMExceptions that regexp or JSON schema constraints are not supported, they could do something like
const availability = await LanguageModel.availability({ expectedInputConstraints: ["regexp", "json-schema"] });
// or, just create the session, but fail fast at creation time if it's not supported:
const session = await LanguageModel.create({ expectedInputConstraints: ["regexp", "json-schema"] });