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

Function create_evaluation_request

RealChart2Code_eval/evaluate_task3.py:561–601  ·  view source on GitHub ↗
(difficulty: str, category: str, instruction: str, image_path:Path,
                            image_base64: str, evaluation_prompt: str, model_name: str)

Source from the content-addressed store, hash-verified

559
560
561def 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
604def parse_evaluation_response(response_content: str) -> Dict:

Callers 1

run_benchmarkFunction · 0.70

Calls 1

encode_image_to_base64Function · 0.70

Tested by

no test coverage detected