-
Notifications
You must be signed in to change notification settings - Fork 7
update the prompt to include needs-info
#296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ import 'package:google_generative_ai/google_generative_ai.dart'; | |
import 'package:http/http.dart' as http; | ||
|
||
class GeminiService { | ||
// gemini-1.5-pro-latest, gemini-1.5-flash-latest, gemini-1.0-pro-latest | ||
// Possible values for models: gemini-1.5-pro-latest, gemini-1.5-flash-latest, | ||
// gemini-1.0-pro-latest, gemini-1.5-flash-exp-0827. | ||
static const String classificationModel = 'models/gemini-1.5-flash-latest'; | ||
static const String summarizationModel = 'models/gemini-1.5-flash-latest'; | ||
|
||
|
@@ -33,17 +34,17 @@ class GeminiService { | |
|
||
/// Call the summarize model with the given prompt. | ||
/// | ||
/// On failures, this will throw a `GenerativeAIException`. | ||
/// On failures, this will throw a [GenerativeAIException]. | ||
Future<String> summarize(String prompt) { | ||
return _query(_summarizeModel, prompt); | ||
} | ||
|
||
/// Call the classify model with the given prompt. | ||
/// | ||
/// On failures, this will throw a `GenerativeAIException`. | ||
/// On failures, this will throw a [GenerativeAIException]. | ||
Future<List<String>> classify(String prompt) async { | ||
final result = await _query(_classifyModel, prompt); | ||
final labels = result.split(',').map((l) => l.trim()).toList(); | ||
final labels = result.split(',').map((l) => l.trim()).toList()..sort(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How big do we expect the result to be? (Or rather, how many commas?) This can do an extra string allocation per part, if the Doing final labels = result.trim.split(_trimCommaRE).toList()..sort();
...
final _trimCommaRE = RegExp(r'\s*,\s*'); will still trim the outer string (but it's more likely to not have leading and trailing spaces, than commas are to not have surrounding space), and then remove spaces around commas while splitting. (The sum of many small inefficiencies is a medium inefficiency that it's hard to find the source of. But ... this uses a RegExp, so now we have two problems 😉.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :) Thanks for the feedback; this will generally have either 0 or 1 commas. I think I'd prefer to avoid a regex for this bit of code. |
||
return labels; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// TODO(devoncarew): Add additional prompt instructions for `area-pkg` issues. | ||
|
||
String assignAreaPrompt({ | ||
required String title, | ||
required String body, | ||
|
@@ -45,13 +47,110 @@ If the issue is clearly a bug report, then also apply the label 'type-bug'. | |
If the issue is mostly a question, then also apply the label 'type-question'. | ||
Otherwise don't apply a 'type-' label. | ||
|
||
If the issue title starts with "[breaking change]" it was likely created using | ||
existing issue template; do not assign an area label. IMPORTANT: only do this if | ||
the issue title starts with "[breaking change]". | ||
|
||
If the issue was largely unchanged from our default issue template, then apply | ||
the 'needs-info' label and don't assign an area label. These issues will | ||
generally have a title of "Create an issue" and the body will start with "Thank | ||
you for taking the time to file an issue!". | ||
|
||
If the issue title is "Analyzer Feedback from IntelliJ", these are generally not | ||
well qualified. For these issues, apply the 'needs-info' label but don't assign | ||
an area label. | ||
|
||
Return the labels as comma separated text. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Returns" (A section starting with "Returns" is the recommended way to describe the returned value, just like a section starting with "The [foo] value ..." referencing a parameter is the recommended way to document that parameter.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a directive to the LLM about what it should do, not describing what it will do. As in, "You should return the ...". |
||
|
||
Issue follows: | ||
Here are a series of few-shot examples: | ||
|
||
<EXAMPLE> | ||
INPUT: title: Create an issue | ||
|
||
body: Thank you for taking the time to file an issue! | ||
|
||
This tracker is for issues related to: | ||
|
||
Dart analyzer and linter | ||
Dart core libraries (dart:async, dart:io, etc.) | ||
Dart native and web compilers | ||
Dart VM | ||
|
||
OUTPUT: needs-info | ||
</EXAMPLE> | ||
|
||
<EXAMPLE> | ||
INPUT: title: Analyzer Feedback from IntelliJ | ||
|
||
body: ## Version information | ||
|
||
- `IDEA AI-202.7660.26.42.7351085` | ||
- `3.4.4` | ||
- `AI-202.7660.26.42.7351085, JRE 11.0.8+10-b944.6842174x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1600x900` | ||
|
||
OUTPUT: needs-info | ||
</EXAMPLE> | ||
|
||
<EXAMPLE> | ||
INPUT: title: Support likely() and unlikely() hints for AOT code optimization | ||
|
||
body: ```dart | ||
// Tell the compiler which branches are going to be taken most of the time. | ||
|
||
if (unlikely(n == 0)) { | ||
// This branch is known to be taken rarely. | ||
} else { | ||
// This branch is expected to be in the hot path. | ||
} | ||
|
||
final result = likely(s == null) ? commonPath() : notTakenOften(); | ||
``` | ||
|
||
Please add support for the `likely()` and `unlikely()` optimization hints within branching conditions. The AOT compiler can use these hints to generate faster code in a hot path that contains multiple branches. | ||
|
||
$title | ||
OUTPUT: area-vm, type-enhancement, type-performance | ||
</EXAMPLE> | ||
|
||
$body | ||
<EXAMPLE> | ||
INPUT: title: Analyzer doesn't notice incorrect return type of generic method | ||
|
||
body: dart analyze gives no errors on the follow code: | ||
|
||
```dart | ||
void main() { | ||
method(getB()); | ||
} | ||
|
||
void method(String b) => print(b); | ||
|
||
B getB<B extends A>() { | ||
return A() as B; | ||
} | ||
|
||
class A {} | ||
``` | ||
I would have suspected it to say something along the line of **The argument type 'A' can't be assigned to the parameter type 'String'.** | ||
|
||
OUTPUT: area-analyzer, type-enhancement | ||
</EXAMPLE> | ||
|
||
<EXAMPLE> | ||
INPUT: title: DDC async function stepping improvements | ||
|
||
body: Tracking issue to monitor progress on improving debugger stepping through async function bodies. | ||
|
||
The new DDC async semantics expand async function bodies into complex state machines. The normal JS stepping semantics don't map cleanly to steps through Dart code given this lowering. There are a couple potential approaches to fix this: | ||
1) Add more logic to the Dart debugger to perform custom stepping behavior when stepping through async code. | ||
2) Modify the async lowering in such a way that stepping more closely resembles stepping through Dart. For example, rather than returning multiple times, the state machine function might be able to yield. Stepping over a yield might allow the debugger to stay within the function body. | ||
|
||
OUTPUT: area-web | ||
</EXAMPLE> | ||
|
||
The issue to triage follows: | ||
|
||
title: $title | ||
|
||
body: $body | ||
|
||
${lastComment ?? ''}''' | ||
.trim(); | ||
|
@@ -60,15 +159,26 @@ ${lastComment ?? ''}''' | |
String summarizeIssuePrompt({ | ||
required String title, | ||
required String body, | ||
required bool needsInfo, | ||
}) { | ||
const needsMoreInfo = ''' | ||
Our classification model determined that we'll need more information to triage | ||
this issue. Thank them for their contribution and gently prompt them to provide | ||
more information. | ||
'''; | ||
|
||
final responseLimit = needsInfo ? '' : ' (1-2 sentences, 24 words or less)'; | ||
|
||
return ''' | ||
You are a software engineer on the Dart team at Google. You are responsible for | ||
triaging incoming issues from users. For each issue, briefly summarize the issue | ||
(1-2 sentences, 24 words or less). | ||
You are a software engineer on the Dart team at Google. | ||
You are responsible for triaging incoming issues from users. | ||
For each issue, briefly summarize the issue $responseLimit. | ||
|
||
${needsInfo ? needsMoreInfo : ''} | ||
|
||
Issue follows: | ||
The issue to triage follows: | ||
|
||
$title | ||
title: $title | ||
|
||
$body'''; | ||
body: $body'''; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.