以解释代码为例,它的 prompt 是这样的(此案例来自 OpenAI 官方案例):Explanation of what the code does:Python 3 def remove_common_prefix(x, prefix, ws_prefix): x[“completion”] = x[“completion”].str[len(prefix) :] if ws_prefix: # keep the single whitespace as prefix x[“completion”] = ” ” + x[“completion”] return x以下是 ChatGPT 的 Output,它阐述了这段代码是拿来干什么的,同时还阐述了各个参数的含义:This is a Python function called remove_common_prefix that takes in three parameters: x, prefix, and ws_prefix.The x parameter is assumed to be a Pandas DataFrame or Series object with a column named “completion”, which contains strings that may or may not start with the prefix string.The prefix parameter is a string that represents the common prefix that needs to be removed from the beginning of each string in the “completion” column of the DataFrame.The ws_prefix parameter is a Boolean value that indicates whether or not to keep a single whitespace character as a prefix after the common prefix has been removed.The function modifies the “completion” column of the DataFrame by removing the prefix string from the beginning of each string in that column using the Pandas str method and string slicing. The len(prefix) : syntax is used to slice the string starting from the character that follows the prefix.If ws_prefix is True, then the function adds a single whitespace character as a prefix to each string in the “completion” column after removing the prefix.Finally, the modified DataFrame is returned by the function.来源:https://learningprompt.wiki/