Skip to content

Commit 69a50e2

Browse files
jackfranklinDevtools-frontend LUCI CQ
authored andcommitted
Ai: Add jsdoc comment to handleFunction
With a couple of notes that took me a bit of time to figure out when I was working with this yesterday. Bug: none Change-Id: I8820f446e87baa173561cd289a9b46c733a8dfe3 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6187113 Reviewed-by: Nikolay Vitkov <[email protected]> Auto-Submit: Jack Franklin <[email protected]> Commit-Queue: Jack Franklin <[email protected]> Commit-Queue: Nikolay Vitkov <[email protected]>
1 parent d3eb3a1 commit 69a50e2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

front_end/panels/ai_assistance/agents/AiAgent.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,17 @@ export abstract class AiAgent<T> {
205205
return this.buildChatHistoryForAida();
206206
}
207207

208+
/**
209+
* Declare a function that the AI model can call.
210+
* @param name - The name of the function
211+
* @param declaration - the function declaration. Currently functions must:
212+
* 1. Return an object of serializable key/value pairs. You cannot return
213+
* anything other than a plain JavaScript object that can be serialized.
214+
* 2. Take one parameter which is an object that can have
215+
* multiple keys and values. For example, rather than a function being called
216+
* with two args, `foo` and `bar`, you should instead have the function be
217+
* called with one object with `foo` and `bar` keys.
218+
*/
208219
declareFunction<Args, ReturnType>(name: string, declaration: FunctionDeclaration<Args, ReturnType>): void {
209220
if (this.#functionDeclarations.has(name)) {
210221
throw new Error(`Duplicate function declaration ${name}`);

0 commit comments

Comments
 (0)