// META: title=Language Model Response Regex - Quote // META: script=/resources/testdriver.js // META: script=/resources/testdriver-vendor.js // META: script=../../../resources/util.js // META: timeout=long 'use strict'; promise_test(async t => { await ensureLanguageModel(); const session = await createLanguageModel(); const regex = /^\"[^\"]*\"$/; const response = await session.prompt( 'Extract a short quote from "Absolutely the best meal ever!"', {responseConstraint: regex}); assert_true(typeof response === 'string'); assert_true(regex.test(response), `Response "${response}" should match regex ${regex}`); }, 'Prompt should work with a quote regex constraint.');