How to use the Multi-Round with System Prompt

#5
by hanjin996 - opened

I use the Multi-Round prompt template
"""
system
System instruction
human
Human 1st round input
bot
Bot 1st round output<|end▁of▁sentence|>
human
Human 2nd round input
bot
Bot 2nd round output<|end▁of▁sentence|>
...
...
...
human
Human nth round input
bot
"""
as
system
程序修复任务
human
这是一个存在缺陷的Java方法:public TimeSeries createCopy(RegularTimePeriod start, RegularTimePeriod end) throws CloneNotSupportedException {
if (start == null) {
throw new IllegalArgumentException("Null 'start' argument.");
}
if (end == null) {
throw new IllegalArgumentException("Null 'end' argument.");
}
if (start.compareTo(end) > 0) {
throw new IllegalArgumentException("Requires start on or before end.");
}
boolean emptyRange = false;
int startIndex = getIndex(start);
if (startIndex < 0) {
startIndex = -(startIndex + 1);
if (startIndex == this.data.size()) {
emptyRange = true;
}
}
int endIndex = getIndex(end);
if (endIndex < 0) {
endIndex = -(endIndex + 1);
endIndex = endIndex - 1;
}
if (endIndex < 0) {
emptyRange = true;
}
if (emptyRange) {
TimeSeries copy = (TimeSeries) super.clone();
copy.data = new java.util.ArrayList();
return copy;
} else {
return createCopy(startIndex, endIndex);
}
}, 具体的缺陷行是: if (endIndex < 0) {
, 缺陷行行号是:20,请解释该缺陷行缺陷导致方法出现缺陷的原因。
bot
human
请给出修复该缺陷方法的策略。优先考虑修复缺陷行使缺陷方法正确,如不行,再考虑增加、删除行等操作。
bot
human
请根据之前给出的错误原因和修复策略,修复这个缺陷方法。请以如下格式给出修复后的缺陷行和完整的缺陷方法。// fixed line: // fixed method:
bot
human
请逐行解释修复后的缺陷方法,并确认是否修复成功。若不成功,请重新修复,并以如下格式给出重新修复后的缺陷行和完整的缺陷方法。// fixed line: // fixed method:
bot
but it only gengrate at the last round: 修复后的缺陷行:
if (endIndex < 0) {
endIndex = -(endIndex + 1);
endIndex = endIndex - 1;
}

修复后的完整方法:
public TimeSeries createCopy(RegularTimePeriod start, RegularTimePeriod end) throws CloneNotSupportedException {
if (start == null) {
throw new IllegalArgumentException("Null 'start' argument.");
}
if (end == null) {
throw new IllegalArgumentException("Null 'end' argument.");
}
if (start.compareTo(end) > 0) {
throw new IllegalArgumentException("Requires start on or before end.");
}
boolean emptyRange = false;
int startIndex = getIndex(start);
if (startIndex < 0) {
startIndex = -(startIndex + 1);
if (startIndex == this.data.size()) {
emptyRange = true;
}
}
int endIndex = getIndex(end);
if (endIndex < 0) {
endIndex = -(endIndex + 1);
endIndex = endIndex - 1;
}
if (endIndex < 0) {
emptyRange = true;
}
if (emptyRange) {
TimeSeries copy = (TimeSeries) super.clone();
copy.data = new java.util.ArrayList();
return copy;
} else {
return createCopy(startIndex, endIndex);
}
}

修复后的方法解释:
修复后的缺陷行解决了当endIndex小于0时,endIndex的值不正确的问题。修复后的完整方法在原有基础上增加了对endIndex的处理,确保了方法的正确性。
I would like to know how to design a prompt that will allow the model to generate multiple rounds of answers.

CodeFuse AI org

hello,

This is the multi-round prompt format:

"""
<s>system
System instruction
<s>human
Human 1st round input
<s>bot
Bot 1st round output<|end▁of▁sentence|>
<s>human
Human 2nd round input
<s>bot
Bot 2nd round output<|end▁of▁sentence|>
...
...
...
<s>human
Human nth round input
<s>bot
"""
twelveand0 changed discussion status to closed

Sign up or log in to comment