new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Electron · API · all subjects

localaihandler/methods

3 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

localAIHandler.setPromptAPIHandler method

Sets the handler for new Prompt API binding requests from the renderer process. The method signature is localAIHandler.setPromptAPIHandler(promptAPIHandler). The promptAPIHandler parameter is a Function that receives a details object and returns typeof LanguageModelUtility | null. The handler is called once per pair of webContentsId and securityOrigin. Returning null from the handler rejects creation of a new Prompt API session in the renderer. To invalidate existing Prompt API sessions, clear the local AI handler using ses.registerLocalAIHandler(null).

localAIHandler.setPromptAPIHandler details object properties

The details object passed to promptAPIHandler contains the following properties: webContentsId (Integer) - the unique id of the WebContents calling the Prompt API; securityOrigin (string) - origin of the page calling the Prompt API; frameToken (string) - the frame token of the frame calling the Prompt API; renderProcessId (Integer) - the process id of the renderer process hosting the frame calling the Prompt API.

localAIHandler.setPromptAPIHandler request queueing behavior

If a renderer calls the Prompt API before setPromptAPIHandler() has been called, the request is queued. Once the handler is set, all queued requests are flushed. If too many requests are queued, the oldest pending request is dropped and pending promises in the renderer are rejected. To avoid this, call setPromptAPIHandler() as early as possible.

Give your agent this brain