-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bbrt] Model can set title, improved instructions, misc fixes (#4135)
- The model can call "set_title" to set the title. - New better shorter default system instructions. - Auto focus prompt when changing session - Fix bug where active tools were not updated for each iteration of a chain of tool calls
- Loading branch information
Showing
6 changed files
with
112 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* @license | ||
* Copyright 2025 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export const SYSTEM_INSTRUCTION = ` | ||
- You must use the "set_title" function within the first 2-3 turns of the | ||
conversation, with a best effort concise title. | ||
- If the user asks to make something such as a document, report, post, or any | ||
other kind of text artifact, you must use the "write_file" function to create | ||
a new markdown file. | ||
- Never call "display_file" unless you need to show an old file. Never try to | ||
provide a link to a file you have written. Never duplicate the contents of | ||
a file you have just written in your resposne. | ||
- You have access to hundreds of additional tools, particularly for image and | ||
audio generation, and for connecting to external services. To discover them, | ||
first call "list_tools", and then call "activate_tool" with specific tool ids. | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* @license | ||
* Copyright 2025 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import "../components/activate-modal.js"; | ||
import type { EmptyObject } from "../util/empty-object.js"; | ||
import type { Result } from "../util/result.js"; | ||
import type { BBRTTool, BBRTToolAPI, BBRTToolMetadata } from "./tool-types.js"; | ||
|
||
interface Inputs { | ||
title: string; | ||
} | ||
|
||
type Callback = (title: string) => Result<void>; | ||
|
||
export class SetTitleTool implements BBRTTool<Inputs, EmptyObject> { | ||
#callback: Callback; | ||
|
||
constructor(callback: Callback) { | ||
this.#callback = callback; | ||
} | ||
|
||
readonly metadata: BBRTToolMetadata = { | ||
id: "set_title", | ||
title: "Set Title", | ||
description: "Set the title of the conversation.", | ||
icon: "/bbrt/images/tool.svg", | ||
}; | ||
|
||
async api(): Promise<Result<BBRTToolAPI>> { | ||
return { | ||
ok: true as const, | ||
value: { | ||
inputSchema: { | ||
type: "object", | ||
properties: { | ||
title: { | ||
type: "string", | ||
description: "The new title.", | ||
}, | ||
}, | ||
}, | ||
outputSchema: { | ||
type: "object", | ||
properties: {}, | ||
}, | ||
} satisfies BBRTToolAPI, | ||
}; | ||
} | ||
|
||
execute(args: Inputs) { | ||
return { result: this.#execute(args) }; | ||
} | ||
|
||
async #execute({ title }: Inputs): Promise<Result<{ data: EmptyObject }>> { | ||
const result = this.#callback(title); | ||
if (!result.ok) { | ||
return result; | ||
} | ||
return { ok: true, value: { data: {} } }; | ||
} | ||
} |