Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
(続)生成AIによる 静的解析ツールの自動生成
Search
tenntenn - Takuya Ueda
PRO
November 07, 2024
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
(続)生成AIによる 静的解析ツールの自動生成
tenntenn - Takuya Ueda
PRO
November 07, 2024
Transcript
12 slides
The Go gopher was designed by Renée French. The gopher
stickers was made by Takuya Ueda. Licensed under the Creative Commons 3.0 Attributions license. (続)生成 AIによる 静的解析ツールの自動生成 2024/10/24 tenntenn.go #7 - 静的解析ナイト
UEDA Takuya / tenntenn 上田拓 也 newmo株式会社 / ソフトウェアエンジニア 一般社団法人
Gophers Japan 代表理事 Google Developers Expert (GDE) / Go Category tenntenn Conference 主催・登壇者 2013年よりGo Conferenceの運営を行う。 2016年、メルカリグループに入社、Goコミュニティへの貢献や採用・社内教育などに従事。 2021年、一般社団法人Gophers Japan設立、代表理事に就任。Google Developers Expert (GDE)に選出。 2022年、株式会社ナレッジワーク入社。ソフトウェアエンジニアおよびGoエンジニアのイネーブルメントに従事。 2024年、newmo株式会社入社。ソフトウェアエンジニアとしてプロダクト開発に従事。 略歴
生成AIと静的解析ツール GPT-4にて生成 https://chat.openai.com/share/243a6106-d7c4-427e-a0e5-1300131bd134
生成AIを使ったコード生成の難点 正しい/最適なコードを生成するとは限らない コンパイラを通るけど 生成されたコードのコントロールが難しい 書式が想定されたものにならない
プロンプトエンジニアリング プロンプトエンジニアリング 生成AIとやり取りをするプロンプトを工夫するテクニックなど 工夫次第で生成されるコンテンツの質が大きく変わってくる Few-shot プロンプティング どんな回答を期待しているのか例示してモデルに伝える いくつかコードを例示すると期待したコードを生成しやすくなる https://chat.openai.com/share/7d66e624-ca24-44d8-adf2-d85b688ddce6
GoからOpenAIのAPIを呼び出す サードパーティ製のライブラリを利用 github.com/sashabaranov/go-openai APIキーを渡すことで簡単にAPIを呼び出せる client := openai.NewClient("API Key") resp, err
:= client.CreateChatCompletion(ctx, openai.ChatCompletionRequest{ Model: openai.GPT3Dot5Turbo, Messages: []openai.ChatCompletionMessage{{ Role: openai.ChatMessageRoleUser, Content: "Hello!", }}, }, ) if err != nil { /* 略 */ } fmt.Println(resp.Choices[0].Message.Content)
skeletonのしくみ txtar形式を使ったテンプレートを活用 fs.FS型としてテンプレートを埋め込む txtar形式にしてそこにデータを流し込む テンプレートを txtar形式に変更 テンプレートに データを埋め込み ディレクトリに 展開
x/tools/txtar: implement fs.FS #44158 Proposal Accepted 🎉
skeletonへの導入 未完成な状態でファイルを生成して生成 AIに埋めてもらう 結果に不満がある場合に修正もできるようにしたい テストを書いてもらったりしたい テンプレートを txtar形式に変更 テンプレートに データを埋め込み ディレクトリに
展開 ここ
ここから続き
テストデータを与えて生成する ▪ analysistestでテストする前提のデータを渡す • テストが通るようなコードを生成してもらう • エッジケースも指定する package a import
"log" // The tool can find function callings of log.Fatal. func f() { log.Fatal("error") // want "NG" fatal := log.Fatal fatal("error") // want "NG" println() // OK }
デモ
今後の展望 ▪ GeminiとかGemmaを使ってみる • GDEなので • 無料で試してもらえるように ▪ GenKit for
Goを使ってみる • 何者かもわかってないので調べるところから ▪ 本格的にskeletonに取り込む • 提供方法を考える
More Decks by tenntenn - Takuya Ueda
See All by tenntenn - Takuya Ueda
時の止め方を考える
tenntenn
PRO
0
160
まずはイテレータ(range over func)の仕様を学ぼう
tenntenn
PRO
0
500
モチベーションの維持と世代交代から考える持続可能なコミュニティ運営
tenntenn
PRO
0
190
fmfm🤔 fmtパッケージ - tenntenn.go#4
tenntenn
PRO
0
260
あなたの知らない go listコマンド - tenntenn.go#4
tenntenn
PRO
1
1.6k
ライブペアプログラミング その2 - tenntenn.go#3
tenntenn
PRO
0
110
sync.Onceを完全に理解する - tenntenn.go#3
tenntenn
PRO
0
620
Go 1.18で追加されるstrings/bytes.Cutと(*sync.Mutex).TryLockについて - Go1.18リリースパーティ
tenntenn
PRO
0
720
io/fsパッケージを読む - tenntenn.go#2
tenntenn
PRO
0
300
Featured
See All Featured
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.6k
How to train your dragon (web standard)
notwaldorf
96
6.9k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
570
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
1
250
sira's awesome portfolio website redesign presentation
elsirapls
0
510
Unsuck your backbone
ammeep
672
58k
Large-scale JavaScript Application Architecture
addyosmani
516
110k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
670
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
610
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
290