From 9215b30cb2f3e6e19d7cb3138633f91bd674fe12 Mon Sep 17 00:00:00 2001 From: Luc Gagan <134170834+lucgagan@users.noreply.github.com> Date: Mon, 8 Jul 2024 23:37:15 -0600 Subject: [PATCH] Revert "Fixing breaking changes" --- src/auto.ts | 2 +- src/completeTask.ts | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/auto.ts b/src/auto.ts index 91f07c7..77497d2 100644 --- a/src/auto.ts +++ b/src/auto.ts @@ -56,7 +56,7 @@ async function runTask( snapshot: await getSnapshot(page), options: options ? { - model: options.model ?? "gpt-4o", + model: options.model ?? "gpt-4-1106-preview", debug: options.debug ?? false, openaiApiKey: options.openaiApiKey, openaiBaseUrl: options.openaiBaseUrl, diff --git a/src/completeTask.ts b/src/completeTask.ts index 22b2ed7..a387a07 100644 --- a/src/completeTask.ts +++ b/src/completeTask.ts @@ -25,7 +25,7 @@ export const completeTask = async ( const runner = openai.beta.chat.completions .runTools({ - model: task.options?.model ?? "gpt-4o", + model: task.options?.model ?? "gpt-4-1106-preview", messages: [{ role: "user", content: prompt(task) }], tools: Object.values(actions).map((action) => ({ type: "function", @@ -39,11 +39,9 @@ export const completeTask = async ( if ( message.role === "assistant" && - message.tool_calls && - message.tool_calls.length > 0 && - message.tool_calls[0].function.name.startsWith("result") + message.function_call?.name.startsWith("result") ) { - lastFunctionResult = JSON.parse(message.tool_calls[0].function.arguments); + lastFunctionResult = JSON.parse(message.function_call.arguments); } });