Skip to content
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

Handle cases where a model does not repeat the function signature #184

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

XZ-X
Copy link

@XZ-X XZ-X commented Nov 4, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant