(difficulty: str, category: str, data_info: str, image_path:str,
image_base64: str, evaluation_prompt: str, model_name: str)
| 521 | |
| 522 | |
| 523 | def 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 | |
| 566 | def get_gt_code_path(image_path: Path) -> Path: |
| 567 | """根据image_path获取对应的ground truth代码文件路径""" |
no test coverage detected