(difficulty: str, category: str, instruction: str, image_path:Path,
image_base64: str, evaluation_prompt: str, model_name: str)
| 559 | |
| 560 | |
| 561 | def create_evaluation_request(difficulty: str, category: str, instruction: str, image_path:Path, |
| 562 | image_base64: str, evaluation_prompt: str, model_name: str) -> Dict: |
| 563 | |
| 564 | task_prompt = f"""# Task |
| 565 | Category: {category} |
| 566 | """ |
| 567 | # Instruction: {instruction} |
| 568 | image_chart = encode_image_to_base64(image_path) |
| 569 | |
| 570 | user_content = [ |
| 571 | { |
| 572 | "type": "text", |
| 573 | "text": f"**Task**:\n{task_prompt}\n\n**Generated Chart**: Please evaluate based on the following generated chart image." |
| 574 | }, |
| 575 | { |
| 576 | "type": "image_url", |
| 577 | "image_url": { |
| 578 | "url": image_base64 |
| 579 | } |
| 580 | }, |
| 581 | { |
| 582 | "type": "text", |
| 583 | "text": f"**Provided Chart**: Please evaluate based on the following provided chart image. " |
| 584 | }, |
| 585 | { |
| 586 | "type": "image_url", |
| 587 | "image_url": { |
| 588 | "url": image_chart |
| 589 | } |
| 590 | } |
| 591 | ] |
| 592 | |
| 593 | return { |
| 594 | "model": model_name, |
| 595 | "messages": [ |
| 596 | {"role": "system", "content": evaluation_prompt}, |
| 597 | {"role": "user", "content": user_content} |
| 598 | ], |
| 599 | "max_tokens": 8192, |
| 600 | "temperature": 0.0, |
| 601 | } |
| 602 | |
| 603 | |
| 604 | def parse_evaluation_response(response_content: str) -> Dict: |
no test coverage detected