0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GitHub Copilot のコード補完で GPT-4o が使えるらしいので試す

Posted at

GitHub Copilot のコード補完で GPT-4o が使えるらしいので試してみます。

お題はいつものこちら

この記事にも書いておくと

■ 検証コード

こんなコードを改善してもらいます。

int[] array = new int[] { 1,2,3};
List<int> list = new List<int>();
for(int i = 0; i < array.Length; i++)
{
    list.Add(array[i]);
}

Visual Studio のクイック アクションで改善してもらうとこんな感じになります。

using System.Linq;

var list = (new int[] { 1,2,3}).ToList();

この改善コードを基準に見ていきましょう。

■ GPT-3.5 Turbo

まずはモデルを変更せず、GPT-3.5 Turbo で。

結果としてこんなコードになりました。結構違和感はありますね。

var array = new int[] { 1, 2, 3 };
var list = new List<int>(array);

image
image

■ GPT-4o Copilot (Preview)

こんなコードになりました。違いが判らない...... (違いはありません)

var array = new[] { 1, 2, 3 };
var list = new List<int>(array);

image
image
image

とはいえよく考えたら、Copilot Chat でも依然試したとき、この回答でしたね。
[https://rksoftware.hatenablog.com/entry/2025/02/02/150000:embed:cite]

■ もっとコードかかないと

もっとコード書かないと違いを体験できないですね。コード書いてきましょう!

■ モデルの変更方法

コマンドパレットの右の Copilot メニューから。

Configure Code Completions...

image

Change Completions Model...

image
モデルを選択します。
image

簡単ですね。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?