tor-browser

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

commit d98f6b4f0a1f49ebc48b50993cc8b1686831c74f
parent 35865c3f99266872c9525064da1451aa2c69498c
Author: Tzu-An Liu <tliu@mozilla.com>
Date:   Mon, 27 Oct 2025 23:43:29 +0000

Bug 1996648 - Update query intent detection model to mobilebert v0.2 r=Mardak,firefox-ai-ml-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D270247

Diffstat:
Mbrowser/components/genai/SmartAssistEngine.sys.mjs | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/browser/components/genai/SmartAssistEngine.sys.mjs b/browser/components/genai/SmartAssistEngine.sys.mjs @@ -223,11 +223,19 @@ export const SmartAssistEngine = { const engine = await this._createEngine({ featureId: "smart-intent", modelId: "mozilla/mobilebert-query-intent-detection", - modelRevision: "v0.1.0", + modelRevision: "v0.2.0", taskName: "text-classification", }); + const threshold = 0.6; const resp = await engine.run({ args: [[query]] }); - return resp[0].label.toLowerCase(); + // resp example: [{ label: "chat", score: 0.95 }, { label: "search", score: 0.04 }] + if ( + resp[0].label.toLowerCase() === "chat" && + resp[0].score >= threshold + ) { + return "chat"; + } + return "search"; } catch (error) { console.error("Error using intent detection model:", error); throw error;