Skip to content

Commit 2b49829

Browse files
authoredSep 9, 2024
fix: use gpt-4o as default model (copilot-extensions#63)
this aligns with other uses across github
1 parent 43a5e4e commit 2b49829

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed
 

‎index.d.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ export type CreateConfirmationEventOptions = {
4747
};
4848

4949
export interface CreateConfirmationEventInterface {
50-
(
51-
options: CreateConfirmationEventOptions,
52-
): string;
50+
(options: CreateConfirmationEventOptions): string;
5351
}
5452
export interface CreateReferencesEventInterface {
5553
(references: CopilotReference[]): string;

‎index.test-d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export async function promptTest() {
218218
await prompt("What is the capital of France?", {
219219
token: "secret",
220220
request: {
221-
fetch: () => { },
221+
fetch: () => {},
222222
},
223223
});
224224

‎lib/prompt.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
// @ts-check
22

3-
/** @type {import('..').PromptInterface} */
3+
const DEFAULT_ENDPOINT = "https://api.githubcopilot.com/chat/completions";
4+
const DEFAULT_MODEL = "gpt-4o";
45

6+
/** @type {import('..').PromptInterface} */
57
function parsePromptArguments(userPrompt, promptOptions) {
68
const { request: requestOptions, ...options } =
79
typeof userPrompt === "string" ? promptOptions : userPrompt;
810

911
const promptFetch = requestOptions?.fetch || fetch;
10-
const model = options.model || "gpt-4";
11-
const endpoint =
12-
options.endpoint || "https://api.githubcopilot.com/chat/completions";
12+
const model = options.model || DEFAULT_MODEL;
13+
const endpoint = options.endpoint || DEFAULT_ENDPOINT;
1314

1415
const systemMessage = options.tools
1516
? "You are a helpful assistant. Use the supplied tools to assist the user."
@@ -58,7 +59,6 @@ async function sendPromptRequest(promptFetch, options) {
5859
}
5960

6061
const body = await response.text();
61-
console.log({ body });
6262

6363
throw Object.assign(
6464
new Error(

‎test/prompt.test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ suite("prompt", () => {
3535
content: "What is the capital of France?",
3636
},
3737
],
38-
model: "gpt-4",
38+
model: "gpt-4o",
3939
}),
4040
})
4141
.reply(
@@ -152,7 +152,7 @@ suite("prompt", () => {
152152
{ role: "assistant", content: "The capital of France is Paris." },
153153
{ role: "user", content: "What about Spain?" },
154154
],
155-
model: "gpt-4",
155+
model: "gpt-4o",
156156
}),
157157
})
158158
.reply(
@@ -216,7 +216,7 @@ suite("prompt", () => {
216216
content: "What is the capital of France?",
217217
},
218218
],
219-
model: "gpt-4",
219+
model: "gpt-4o",
220220
}),
221221
})
222222
.reply(
@@ -273,7 +273,7 @@ suite("prompt", () => {
273273
{ role: "assistant", content: "The capital of France is Paris." },
274274
{ role: "user", content: "What about Spain?" },
275275
],
276-
model: "gpt-4",
276+
model: "gpt-4o",
277277
}),
278278
})
279279
.reply(
@@ -342,7 +342,7 @@ suite("prompt", () => {
342342
},
343343
{ role: "user", content: "Call the function" },
344344
],
345-
model: "gpt-4",
345+
model: "gpt-4o",
346346
toolsChoice: "auto",
347347
}),
348348
})
@@ -412,7 +412,7 @@ suite("prompt", () => {
412412
content: "What is the capital of France?",
413413
},
414414
],
415-
model: "gpt-4",
415+
model: "gpt-4o",
416416
}),
417417
})
418418
.reply(400, "Bad Request", {
@@ -453,7 +453,7 @@ suite("prompt", () => {
453453
role: "user",
454454
},
455455
],
456-
model: "gpt-4",
456+
model: "gpt-4o",
457457
toolsChoice: undefined,
458458
},
459459
},

0 commit comments

Comments
 (0)
Failed to load comments.