diff --git a/core/llm/constructMessages.ts b/core/llm/constructMessages.ts
index a80a4a72b..69425d33e 100644
--- a/core/llm/constructMessages.ts
+++ b/core/llm/constructMessages.ts
@@ -1,51 +1,23 @@
-import {
- ChatHistoryItem,
- ChatMessage,
- MessagePart,
- ModelDescription,
-} from "../";
+import { ChatHistoryItem, ChatMessage, MessagePart } from "../";
import { normalizeToMessageParts } from "../util/messageContent";
-import { modelSupportsTools } from "./autodetect";
-
-const TOOL_USE_RULES = `
- When using tools, follow the following guidelines:
- - Avoid calling tools unless they are absolutely necessary. For example, if you are asked a simple programming question you do not need web search. As another example, if the user asks you to explain something about code, do not create a new file.
-`;
-
-function constructSystemPrompt(
- modelDescription: ModelDescription,
- useTools: boolean,
-): string | null {
- let systemMessage = `
+const DEFAULT_SYSTEM_MESSAGE = `
Always include the language and file name in the info string when you write code blocks. If you are editing "src/main.py" for example, your code block should start with '\`\`\`python src/main.py'.
`;
- if (useTools && modelSupportsTools(modelDescription)) {
- systemMessage += "\n\n" + TOOL_USE_RULES;
- }
- return systemMessage;
-}
const CANCELED_TOOL_CALL_MESSAGE =
"This tool call was cancelled by the user. You should clarify next steps, as they don't wish for you to use this tool.";
-export function constructMessages(
- history: ChatHistoryItem[],
- modelDescription: ModelDescription,
- useTools: boolean,
-): ChatMessage[] {
+export function constructMessages(history: ChatHistoryItem[]): ChatMessage[] {
const filteredHistory = history.filter(
(item) => item.message.role !== "system",
);
const msgs: ChatMessage[] = [];
- const systemMessage = constructSystemPrompt(modelDescription, useTools);
- if (systemMessage) {
- msgs.push({
- role: "system",
- content: systemMessage,
- });
- }
+ msgs.push({
+ role: "system",
+ content: DEFAULT_SYSTEM_MESSAGE,
+ });
for (let i = 0; i < filteredHistory.length; i++) {
const historyItem = filteredHistory[i];
diff --git a/gui/src/redux/thunks/streamResponse.ts b/gui/src/redux/thunks/streamResponse.ts
index 9c0cb4b9a..8f17899dc 100644
--- a/gui/src/redux/thunks/streamResponse.ts
+++ b/gui/src/redux/thunks/streamResponse.ts
@@ -120,11 +120,7 @@ export const streamResponseThunk = createAsyncThunk<
// Construct messages from updated history
const updatedHistory = getState().session.history;
- const messages = constructMessages(
- [...updatedHistory],
- defaultModel,
- useTools,
- );
+ const messages = constructMessages([...updatedHistory]);
posthog.capture("step run", {
step_name: "User Input",
diff --git a/gui/src/redux/thunks/streamResponseAfterToolCall.ts b/gui/src/redux/thunks/streamResponseAfterToolCall.ts
index 3eb11b249..c3df94986 100644
--- a/gui/src/redux/thunks/streamResponseAfterToolCall.ts
+++ b/gui/src/redux/thunks/streamResponseAfterToolCall.ts
@@ -60,11 +60,7 @@ export const streamResponseAfterToolCall = createAsyncThunk<
dispatch(setActive());
const updatedHistory = getState().session.history;
- const messages = constructMessages(
- [...updatedHistory],
- defaultModel,
- useTools,
- );
+ const messages = constructMessages([...updatedHistory]);
const output = await dispatch(streamNormalInput(messages));
unwrapResult(output);
}),