(args, actor_config, critic_config)
| 343 | |
| 344 | |
| 345 | def deoverflow(args, actor_config, critic_config): |
| 346 | total_input_token, total_output_token = 0, 0 |
| 347 | style_ckpt = pkl.load(open(f'checkpoints/{args.model_name}_{args.poster_name}_style_ckpt_{args.index}.pkl', 'rb')) |
| 348 | logs_ckpt = pkl.load(open(f'checkpoints/{args.model_name}_{args.poster_name}_ckpt_{args.index}.pkl', 'rb')) |
| 349 | |
| 350 | style_logs = style_ckpt['style_logs'] |
| 351 | sections = list(style_logs.keys()) |
| 352 | sections = [s for s in sections if s != 'meta'] |
| 353 | |
| 354 | slide_width = style_ckpt['outline']['meta']['width'] |
| 355 | slide_height = style_ckpt['outline']['meta']['height'] |
| 356 | |
| 357 | content = json.load(open(f'contents/{args.model_name}_{args.poster_name}_poster_content_{args.index}.json', 'r')) |
| 358 | outline = logs_ckpt['outline'] |
| 359 | |
| 360 | name_to_hierarchy = get_hierarchy(outline, 1) |
| 361 | |
| 362 | critic_agent_name = 'critic_overlap_agent' |
| 363 | with open(f"prompt_templates/{critic_agent_name}.yaml", "r") as f: |
| 364 | deoverflow_critic_config = yaml.safe_load(f) |
| 365 | |
| 366 | actor_agent_name = 'actor_editor_agent' |
| 367 | |
| 368 | with open(f"prompt_templates/{actor_agent_name}.yaml", "r") as f: |
| 369 | deoverflow_actor_config = yaml.safe_load(f) |
| 370 | |
| 371 | actor_model = ModelFactory.create( |
| 372 | model_platform=actor_config['model_platform'], |
| 373 | model_type=actor_config['model_type'], |
| 374 | model_config_dict=actor_config['model_config'], |
| 375 | ) |
| 376 | |
| 377 | actor_sys_msg = deoverflow_actor_config['system_prompt'] |
| 378 | |
| 379 | actor_agent = ChatAgent( |
| 380 | system_message=actor_sys_msg, |
| 381 | model=actor_model, |
| 382 | message_window_size=10, |
| 383 | ) |
| 384 | |
| 385 | critic_model = ModelFactory.create( |
| 386 | model_platform=critic_config['model_platform'], |
| 387 | model_type=critic_config['model_type'], |
| 388 | model_config_dict=critic_config['model_config'], |
| 389 | ) |
| 390 | |
| 391 | critic_sys_msg = deoverflow_critic_config['system_prompt'] |
| 392 | |
| 393 | critic_agent = ChatAgent( |
| 394 | system_message=critic_sys_msg, |
| 395 | model=critic_model, |
| 396 | message_window_size=None, |
| 397 | ) |
| 398 | |
| 399 | jinja_env = Environment(undefined=StrictUndefined) |
| 400 | |
| 401 | actor_template = jinja_env.from_string(deoverflow_actor_config["template"]) |
| 402 | critic_template = jinja_env.from_string(deoverflow_critic_config["template"]) |
no test coverage detected