MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / get_questions

Function get_questions

utils/poster_eval_utils.py:1183–1214  ·  view source on GitHub ↗
(paper_text, mode, model_type)

Source from the content-addressed store, hash-verified

1181 return images, poster_text, markdown, new_md
1182
1183def 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
1216def eval_vlm_as_judge_aspect(poster_image_list, agent_config, eval_aspect):
1217 judge_model = ModelFactory.create(

Callers 1

Calls 8

stepMethod · 0.95
ChatGPTConfigClass · 0.90
ChatAgentClass · 0.90
get_json_from_responseFunction · 0.90
shuffle_question_optionsFunction · 0.70
createMethod · 0.45
as_dictMethod · 0.45
from_stringMethod · 0.45

Tested by

no test coverage detected