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

Function create_evaluation_request

RealChart2Code_eval/evaluate_task1.py:529–569  ·  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

527
528
529def 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
572def 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