(difficulty: str, category: str, instruction: str, image_path:Path,
image_base64: str, evaluation_prompt: str, model_name: str)
| 527 | |
| 528 | |
| 529 | def create_evaluation_request(difficulty: str, category: str, instruction: str, image_path:Path, |
| 530 | image_base64: str, evaluation_prompt: str, model_name: str) -> Dict: |
| 531 | |
| 532 | task_prompt = f"""# Task |
| 533 | Category: {category} |
| 534 | """ |
| 535 | # Instruction: {instruction} |
| 536 | image_chart = encode_image_to_base64(image_path) |
| 537 | |
| 538 | user_content = [ |
| 539 | { |
| 540 | "type": "text", |
| 541 | "text": f"**Task**:\n{task_prompt}\n\n**Generated Chart**: Please evaluate based on the following generated chart image." |
| 542 | }, |
| 543 | { |
| 544 | "type": "image_url", |
| 545 | "image_url": { |
| 546 | "url": image_base64 |
| 547 | } |
| 548 | }, |
| 549 | { |
| 550 | "type": "text", |
| 551 | "text": f"**Provided Chart**: Please evaluate based on the following provided chart image. " |
| 552 | }, |
| 553 | { |
| 554 | "type": "image_url", |
| 555 | "image_url": { |
| 556 | "url": image_chart |
| 557 | } |
| 558 | } |
| 559 | ] |
| 560 | |
| 561 | return { |
| 562 | "model": model_name, |
| 563 | "messages": [ |
| 564 | {"role": "system", "content": evaluation_prompt}, |
| 565 | {"role": "user", "content": user_content} |
| 566 | ], |
| 567 | "max_tokens": 8192, |
| 568 | "temperature": 0.0, |
| 569 | } |
| 570 | |
| 571 | |
| 572 | def parse_evaluation_response(response_content: str) -> Dict: |
no test coverage detected