tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

language-model-clone.tentative.https.window.js (1331B)


      1 // META: title=Language Model Clone
      2 // META: script=/resources/testdriver.js
      3 // META: script=../resources/util.js
      4 // META: timeout=long
      5 
      6 'use strict';
      7 
      8 promise_test(async () => {
      9  await ensureLanguageModel();
     10 
     11  // Start a new session and test it.
     12  const session = await createLanguageModel();
     13  const result = await session.prompt(kTestPrompt);
     14  assert_equals(typeof result, 'string');
     15 
     16  // Clone a session and test it.
     17  const cloned_session = await session.clone();
     18  assert_equals(
     19    cloned_session.inputQuota, session.inputQuota,
     20    'cloned session should have the same inputQuota as the original session.'
     21  );
     22  assert_equals(
     23    cloned_session.inputUsage, session.inputUsage,
     24    'cloned session should have the same inputUsage as the original session.'
     25  );
     26  assert_equals(
     27    cloned_session.topK, session.topK,
     28    'cloned session should have the same topK as the original session.'
     29  );
     30  assert_equals(
     31    cloned_session.temperature, session.temperature,
     32    'cloned session should have the same temperature as the original session.'
     33  );
     34 
     35  const clone_result = await cloned_session.prompt(kTestPrompt);
     36  assert_equals(typeof clone_result, 'string');
     37  assert_greater_than(
     38      cloned_session.inputUsage, session.inputUsage,
     39      'cloned session should have increased inputUsage after prompting.');
     40 });