Skip to content

Commit

Permalink
fix: update to 4o
Browse files Browse the repository at this point in the history
  • Loading branch information
lucgagan authored Jul 9, 2024
2 parents 54c13ff + 281abac commit 5db16bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/auto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async function runTask(
snapshot: await getSnapshot(page),
options: options
? {
model: options.model ?? "gpt-4-1106-preview",
model: options.model ?? "gpt-4o",
debug: options.debug ?? false,
openaiApiKey: options.openaiApiKey,
openaiBaseUrl: options.openaiBaseUrl,
Expand Down
8 changes: 5 additions & 3 deletions src/completeTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const completeTask = async (

const runner = openai.beta.chat.completions
.runTools({
model: task.options?.model ?? "gpt-4-1106-preview",
model: task.options?.model ?? "gpt-4o",
messages: [{ role: "user", content: prompt(task) }],
tools: Object.values(actions).map((action) => ({
type: "function",
Expand All @@ -39,9 +39,11 @@ export const completeTask = async (

if (
message.role === "assistant" &&
message.function_call?.name.startsWith("result")
message.tool_calls &&
message.tool_calls.length > 0 &&
message.tool_calls[0].function.name.startsWith("result")
) {
lastFunctionResult = JSON.parse(message.function_call.arguments);
lastFunctionResult = JSON.parse(message.tool_calls[0].function.arguments);
}
});

Expand Down

0 comments on commit 5db16bc

Please sign in to comment.