DeepSeek-Coder
DeepSeek-Coder copied to clipboard
Handle cases where a model does not repeat the function signature
This PR attempts to handle cases where a model does not repeat the function signature.
Note that the variable start
denotes the position of the queried function signature, and it will be set to 0
the function signature is not found in a model's response.
Suppose that the query prompt is
// query prefix here
void strlen(string s){
If a model returns
return s.length();
}
The original processing code yields
// query prefix here
return s.length();
which fails to compile.
A possible fix (as proposed by this PR) is not to skip the function signature when it's not found in a model's response.
That is, instead of returning func_prefix + '\n' + body + '\n'
, the function returns question + '\n' + body
when the signature is not found.