(paper_text, mode, model_type)
| 1181 | return images, poster_text, markdown, new_md |
| 1182 | |
| 1183 | def get_questions(paper_text, mode, model_type): |
| 1184 | from dotenv import load_dotenv |
| 1185 | load_dotenv() |
| 1186 | agent_name = f'generate_question_{mode}' |
| 1187 | with open(f"utils/prompt_templates/{agent_name}.yaml", "r") as f: |
| 1188 | config = yaml.safe_load(f) |
| 1189 | |
| 1190 | actor_model = ModelFactory.create( |
| 1191 | model_platform=ModelPlatformType.OPENAI, |
| 1192 | model_type=model_type, |
| 1193 | model_config_dict=ChatGPTConfig().as_dict(), # [Optional] the config for model |
| 1194 | ) |
| 1195 | |
| 1196 | actor_sys_msg = config['system_prompt'] |
| 1197 | |
| 1198 | actor_agent = ChatAgent( |
| 1199 | system_message=actor_sys_msg, |
| 1200 | model=actor_model, |
| 1201 | message_window_size=10, |
| 1202 | ) |
| 1203 | |
| 1204 | jinja_env = Environment(undefined=StrictUndefined) |
| 1205 | |
| 1206 | template = jinja_env.from_string(config["template"]) |
| 1207 | question_generation_prompt = template.render(**{ |
| 1208 | 'document_markdown': paper_text, |
| 1209 | }) |
| 1210 | response = actor_agent.step(question_generation_prompt) |
| 1211 | questions = get_json_from_response(response.msgs[0].content) |
| 1212 | questions = shuffle_question_options(questions) |
| 1213 | |
| 1214 | return questions |
| 1215 | |
| 1216 | def eval_vlm_as_judge_aspect(poster_image_list, agent_config, eval_aspect): |
| 1217 | judge_model = ModelFactory.create( |
no test coverage detected