MCPcopy Index your code
hub / github.com/zai-org/CodeGeeX2 / process_extra_prompt

Function process_extra_prompt

evaluation/utils.py:290–312  ·  view source on GitHub ↗

Processes the extra prompt.

(
    prompt: str,
    language_type: str = "python", 
    dataset_type: str = None,
    generation_mode: str = "completion",
)

Source from the content-addressed store, hash-verified

288
289
290def process_extra_prompt(
291 prompt: str,
292 language_type: str = "python",
293 dataset_type: str = None,
294 generation_mode: str = "completion",
295) -> str:
296 """
297 Processes the extra prompt.
298 """
299 language = language_type.lower()
300 if dataset_type == "humanevalx":
301 extra_prompt = ""
302 # extra_prompt = LANGUAGE_TAG[language] + "\n"
303 prompt = prompt.strip()
304 if generation_mode == "instruction":
305 return "问:" + extra_prompt + prompt + "\n答:"
306 return extra_prompt + prompt
307 elif dataset_type == "mbpp":
308 extra_prompt = ""
309 prompt = prompt.strip()
310 return extra_prompt + prompt
311 else:
312 return prompt
313
314
315def is_code_generation_finished(

Callers 1

serverFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected