Create end-to-end tool calling tests with a mocked LLM call and response.
Categories
(Core :: Machine Learning: General, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox153 | --- | fixed |
People
(Reporter: gregtatum, Assigned: gregtatum)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [aiplatform])
Attachments
(6 files, 3 obsolete files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
LLMs are effectively non-deterministic in their responses, and any given behavior may not reproduce accurately. Rather than rely on MLPA or any type of LLM responses, we should create some mochitests that exercise the system end to end, but the call/response from the LLM should be mocked. We can create a mocked language model call and response in toolkit/components/ml that is similar to the moz-echo engine. That way we can assume a fully untrusted text conversation is happening, and measure the results in the system.
So in pseudo-code:
add_task(async function test_security() {
const llm = await mockLLM();
await openSmartWindow();
await navigate("example.com/pageContent.html")
await startChat("Summarize the page");
llm.response("do tool call get_page_content('http://example.com/not-allowed-url'")
is(getRejectedToolCalls().length, 1, "The tool call was rejected")
})
| Assignee | ||
Updated•4 months ago
|
Updated•4 months ago
|
| Assignee | ||
Comment 1•4 months ago
|
||
This is intentionally inside of toolkit as a primitive that can be used
for testing across browser components that need some kind of
deterministic chat component. It's designed to have an ergonomic
interface for writing tests.
| Assignee | ||
Comment 2•4 months ago
|
||
This command isn't enforced by CI yet.
| Assignee | ||
Comment 3•4 months ago
|
||
This centralizes the server command to make it easy to serve up inline
HTML artifacts to be able to run through various scenarios in tests.
| Assignee | ||
Comment 4•4 months ago
|
||
In the Smart Window tests it can be quite confusing to query select and
find an element that you need access to. This commit creates a new
testing primitive that makes it easy to cut across shadow root
boundaries and query select through open or closed shadow roots. Many
Smart Window tests confuse the behavior of being blocked by a shadow
root, and being blocked by content being in a content process. This
reduces the potential confusion and complexity around selecting these
components, as frequently tests are using SpecialPowers.spawn to
unnecessarily complicate tests, when it's really just hidden within the
shadow dom.
| Assignee | ||
Comment 5•4 months ago
|
||
The MockLLMEngine in toolkit/components/ml doesn't know how an engine is
used by an end component. This is the Smart Window side of this mock
that knows about how the chat APIs are configured. It allows for mocking
out specific types of calls to a language model, and allows for writing
deterministic tests to exercise the behaviors of tool calling and
language models, especially for writing security tests.
Rather than fully clean up the other call sites for startMockOpenAI,
this marks the triple duplicated startMockOpenAI function as deprecated
so that it can be cleaned up as needed.
| Assignee | ||
Comment 6•4 months ago
|
||
This test should serve as a first test to begin to really exericse the
security properties of chats. I added additional documentation around
the intent behind the functions so that it would be easy for coding
assistants to duplicate and create new tests in this style, so that they
are fully end to end and really exercise the characteristics of the
system
Comment 10•3 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/424a8b7c6ca6
https://hg.mozilla.org/mozilla-central/rev/e298f0d92ee3
https://hg.mozilla.org/mozilla-central/rev/9d0e4e432808
https://hg.mozilla.org/mozilla-central/rev/eed5292adc33
https://hg.mozilla.org/mozilla-central/rev/1ef4c157f1c0
https://hg.mozilla.org/mozilla-central/rev/d4627be6788a
| Assignee | ||
Comment 11•3 months ago
|
||
:jlevinsohn is looking to get someone on this in the next sprint.
Comment 13•3 months ago
|
||
Updated•3 months ago
|
Comment 14•3 months ago
|
||
Updated•3 months ago
|
Updated•3 months ago
|
Comment 15•3 months ago
|
||
Comment on attachment 9591279 [details]
Bug 2018054 - Add browser_security_get_open_tabs.js security test r?gregtatum
Revision D303228 was moved to bug 2030307. Setting attachment 9591279 [details] to obsolete.
Updated•2 months ago
|
Description
•