Skip to content

Commit

Permalink
Merge pull request #1069 from microsoft/isidorn/purring-wren
Browse files Browse the repository at this point in the history
use gpt-4o in sample
  • Loading branch information
isidorn authored Jul 31, 2024
2 parents 9599998 + d92c5fc commit e403f5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion chat-sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ When an extension uses the Chat or the Language Model API, we call it a GitHub C
This GitHub Copilot Extension sample shows:

- How to contribute a chat participant to the GitHub Copilot Chat view.
- How to use the Language Model API to request access to the Language Model (gpt-3.5-turbo, gpt-4).
- How to use the Language Model API to request access to the Language Model (gpt-4o, gpt-3.5-turbo, gpt-4).

![demo](./demo.png)

Expand Down
6 changes: 4 additions & 2 deletions chat-sample/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ interface ICatChatResult extends vscode.ChatResult {
}
}

const MODEL_SELECTOR: vscode.LanguageModelChatSelector = { vendor: 'copilot', family: 'gpt-3.5-turbo' };
// Use gpt-4o since it is fast and high quality. gpt-3.5-turbo and gpt-4 are also available.
const MODEL_SELECTOR: vscode.LanguageModelChatSelector = { vendor: 'copilot', family: 'gpt-4o' };

export function activate(context: vscode.ExtensionContext) {

Expand All @@ -24,6 +25,7 @@ export function activate(context: vscode.ExtensionContext) {
stream.progress('Picking the right topic to teach...');
const topic = getTopic(context.history);
try {
// To get a list of all available models, do not pass any selector to the selectChatModels.
const [model] = await vscode.lm.selectChatModels(MODEL_SELECTOR);
if (model) {
const messages = [
Expand Down Expand Up @@ -118,7 +120,7 @@ export function activate(context: vscode.ExtensionContext) {

let chatResponse: vscode.LanguageModelChatResponse | undefined;
try {
const [model] = await vscode.lm.selectChatModels({ vendor: 'copilot', family: 'gpt-3.5-turbo' });
const [model] = await vscode.lm.selectChatModels(MODEL_SELECTOR);
if (!model) {
console.log('Model not found. Please make sure the GitHub Copilot Chat extension is installed and enabled.');
return;
Expand Down

0 comments on commit e403f5e

Please sign in to comment.