MCPcopy Create free account
hub / github.com/Speakn0w/RealChart2Code / create_evaluation_request

Function create_evaluation_request

RealChart2Code_eval/evaluate_task2.py:523–564  ·  view source on GitHub ↗
(difficulty: str, category: str, data_info: str, image_path:str,
                            image_base64: str, evaluation_prompt: str, model_name: str)

Source from the content-addressed store, hash-verified

521
522
523def create_evaluation_request(difficulty: str, category: str, data_info: str, image_path:str,
524 image_base64: str, evaluation_prompt: str, model_name: str) -> Dict:
525
526 # task_prompt = f"""# Task
527 # Category: {category}
528 # """
529 # Instruction: {instruction}
530 text_prompt = create_user_prompt(category, data_info)
531 image_chart = encode_image_to_base64(image_path)
532
533 user_content = [
534 {
535 "type": "text",
536 "text": f"**Task and Data**:\n{text_prompt}\n\n**Generated Chart**: Please evaluate based on the following generated chart image."
537 },
538 {
539 "type": "image_url",
540 "image_url": {
541 "url": image_base64
542 }
543 },
544 {
545 "type": "text",
546 "text": f"**Provided Chart**: Please evaluate based on the following provided chart image. "
547 },
548 {
549 "type": "image_url",
550 "image_url": {
551 "url": image_chart
552 }
553 }
554 ]
555
556 return {
557 "model": model_name,
558 "messages": [
559 {"role": "system", "content": evaluation_prompt},
560 {"role": "user", "content": user_content}
561 ],
562 "max_tokens": 8192,
563 "temperature": 0.0,
564 }
565
566def get_gt_code_path(image_path: Path) -> Path:
567 """根据image_path获取对应的ground truth代码文件路径"""

Callers 1

run_benchmarkFunction · 0.70

Calls 2

create_user_promptFunction · 0.70
encode_image_to_base64Function · 0.70

Tested by

no test coverage detected