useTools option

This commit is contained in:
Nate 2024-11-22 10:58:29 -08:00
parent 045c450e4d
commit 13181dc32c
6 changed files with 17 additions and 2 deletions

View file

@ -384,7 +384,6 @@ export class Core {
const model = await configHandler.llmFromTitle(msg.data.title);
if (msg.data.useTools) {
// Array.isArray(config.experimental?.allowTools)) {
msg.data.completionOptions.tools = allTools;
}

1
core/index.d.ts vendored
View file

@ -1158,6 +1158,7 @@ interface ExperimentalConfig {
* This is needed to crawl a large number of documentation sites that are dynamically rendered.
*/
useChromiumForDocsCrawling?: boolean;
useTools?: boolean;
}
interface AnalyticsConfig {

View file

@ -3023,6 +3023,11 @@
"type": "boolean",
"description": "Use Chromium to crawl docs locally. Useful if the default Cheerio crawler fails on sites that require JavaScript rendering. Downloads and installs Chromium to `~/.continue/.utils`.",
"default": false
},
"useTools": {
"type": "boolean",
"description": "Allow tool use. Currently only supported with Claude 3.5 Sonnet",
"default": true
}
}
}

View file

@ -68,6 +68,9 @@ function ContinueInputBox(props: ContinueInputBoxProps) {
const availableContextProviders = useSelector(
(store: RootState) => store.state.config.contextProviders,
);
const useTools = useSelector(
(store: RootState) => store.state.config.experimental?.useTools,
);
useWebviewListener(
"newSessionWithPrompt",
@ -108,7 +111,7 @@ function ContinueInputBox(props: ContinueInputBoxProps) {
availableSlashCommands={availableSlashCommands}
historyKey="chat"
toolbarOptions={{
hideTools: true,
hideTools: !useTools,
}}
/>
</GradientBorder>

View file

@ -44,6 +44,7 @@ export interface IIdeMessenger {
cancelToken: AbortSignal | undefined,
messages: ChatMessage[],
options?: LLMFullCompletionOptions,
useTools?: boolean,
): AsyncGenerator<ChatMessage, PromptLog, unknown>;
ide: IDE;
@ -202,6 +203,7 @@ export class IdeMessenger implements IIdeMessenger {
cancelToken: AbortSignal | undefined,
messages: ChatMessage[],
options: LLMFullCompletionOptions = {},
useTools?: boolean,
): AsyncGenerator<ChatMessage, PromptLog> {
const gen = this.streamRequest(
"llm/streamChat",
@ -209,6 +211,7 @@ export class IdeMessenger implements IIdeMessenger {
messages,
title: modelTitle,
completionOptions: options,
useTools,
},
cancelToken,
);

View file

@ -63,6 +63,8 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) {
const streamAborter = useSelector(
(store: RootState) => store.state.streamAborter,
);
const useTools = useSelector((store: RootState) => store.uiState.useTools);
const activeRef = useRef(active);
const { saveSession } = useHistory(dispatch);
@ -85,6 +87,8 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) {
defaultModel.title,
streamAborter.signal,
messages,
{},
useTools,
);
let next = await gen.next();