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

Function deoverflow

PosterAgent/deoverflow.py:24–215  ·  view source on GitHub ↗
(args, actor_config, critic_config)

Source from the content-addressed store, hash-verified

22MAX_ATTEMPTS = 5
23
24def deoverflow(args, actor_config, critic_config):
25 total_input_token, total_output_token = 0, 0
26 style_ckpt = pkl.load(open(f'checkpoints/{args.model_name}_{args.poster_name}_style_ckpt_{args.index}.pkl', 'rb'))
27 logs_ckpt = pkl.load(open(f'checkpoints/{args.model_name}_{args.poster_name}_ckpt_{args.index}.pkl', 'rb'))
28
29 style_logs = style_ckpt['style_logs']
30 sections = list(style_logs.keys())
31 sections = [s for s in sections if s != 'meta']
32
33 slide_width = style_ckpt['outline']['meta']['width']
34 slide_height = style_ckpt['outline']['meta']['height']
35
36 content = json.load(open(f'contents/{args.model_name}_{args.poster_name}_poster_content_{args.index}.json', 'r'))
37 outline = logs_ckpt['outline']
38
39 name_to_hierarchy = get_hierarchy(outline, 1)
40
41 critic_agent_name = 'critic_overlap_agent'
42 with open(f"prompt_templates/{critic_agent_name}.yaml", "r") as f:
43 deoverflow_critic_config = yaml.safe_load(f)
44
45 actor_agent_name = 'actor_editor_agent'
46
47 with open(f"prompt_templates/{actor_agent_name}.yaml", "r") as f:
48 deoverflow_actor_config = yaml.safe_load(f)
49
50 actor_model = ModelFactory.create(
51 model_platform=actor_config['model_platform'],
52 model_type=actor_config['model_type'],
53 model_config_dict=actor_config['model_config'],
54 )
55
56 actor_sys_msg = deoverflow_actor_config['system_prompt']
57
58 actor_agent = ChatAgent(
59 system_message=actor_sys_msg,
60 model=actor_model,
61 message_window_size=10,
62 )
63
64 critic_model = ModelFactory.create(
65 model_platform=critic_config['model_platform'],
66 model_type=critic_config['model_type'],
67 model_config_dict=critic_config['model_config'],
68 )
69
70 critic_sys_msg = deoverflow_critic_config['system_prompt']
71
72 critic_agent = ChatAgent(
73 system_message=critic_sys_msg,
74 model=critic_model,
75 message_window_size=None,
76 )
77
78 jinja_env = Environment(undefined=StrictUndefined)
79
80 actor_template = jinja_env.from_string(deoverflow_actor_config["template"])
81 critic_template = jinja_env.from_string(deoverflow_critic_config["template"])

Callers 2

deoverflow.pyFile · 0.70

Calls 15

resetMethod · 0.95
stepMethod · 0.95
ChatAgentClass · 0.90
get_json_from_responseFunction · 0.90
ppt_to_imagesFunction · 0.90
edit_codeFunction · 0.85
run_code_with_utilsFunction · 0.85
get_hierarchyFunction · 0.50
create_posterFunction · 0.50
add_blank_slideFunction · 0.50
save_presentationFunction · 0.50

Tested by

no test coverage detected