-
Notifications
You must be signed in to change notification settings - Fork 39
An output language support detection option #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Depending on the model, the prompt could also be "Write me a poem in Japanese" - i.e. instruct the model, which may respond "Sorry, I don't know Japanese." But detecting language support, and setting external constraints by an explicit API could also be a use case. |
I think the naming ( However, I'm questioning whether this parameter should be an array. Does this imply that all specified languages would be supported? If that’s the case, what specific scenario would require this functionality? const session = await LanguageModel.create({ expectedOutputLanguages: ["de", "en", "fr"] });
console.log(await session.prompt("Write me a poem in English, French or German.")); |
I've put up a draft at #111. I noticed two things while writing it:
Yes, it'd be a request to support all such languages. A typical case for requiring multilingual support is something like the language-tutor example given in https://github.com/webmachinelearning/prompt-api?tab=readme-ov-file#multilingual-content-and-expected-languages . |
In Chrome, we only support the prompt API outputting certain human languages, which have been tested to give safe and sensible results.
Right now, there is no way for web developers to know what those supported languages are from the API. This could be problematic for sites which want to ensure that the language model output is of good quality. They could read each browser's documentation, but of course part of the point of the prompt API is to abstract over that.
It would be good to give developers who want to ensure they're only working with supported output languages some way of signaling the expected output language when using
LanguageModel.create()
, or checkingLanguageModel.availability()
. Then, the API could reject or return"unavailable"
if the developer needs a guarantee from the browser that a given output language has been tested and is supported.The tricky part of designing this API is that the option would have no impact on the actual output language. The actual output just whatever the model decides to respond with, given its current prompt history. Unlike with the writing assistance APIs, we're not using high-level options to prompt-engineer or apply DPO or fine-tunings. The prompt API is about talking directly to the language model, with what you get back controlled by your prompts and your prompts alone.
So if we named this option something like
outputLanguage
, that would be misleading. Cases likewould almost certainly give you a result back in English, not Japanese.
I think we could tackle this with just better naming. Maybe something as simple as
expectedOutputLanguages
? This kind of parallels theexpectedInputLanguage
of the writing assistance APIs, or theexpectedInputLanguages
of the language detector API. Both of those use theexpected
prefix to mean "I expect what follows will be from these languages, so please check for availability before creating this model object". But they don't influence the actual inputs, since those are web developer-provided and could be arbitrary. Our case is similar, except instead of web-developer provided inputs we have model-provided outputs.Is
expectedOutputLanguages
clear enough that it won't actually influence the output? Or do we need something more explicit?The text was updated successfully, but these errors were encountered: