| 42 | |
| 43 | |
| 44 | def cli_main(): |
| 45 | print(args.tasks_dir) |
| 46 | if not args.skip_saving: |
| 47 | f = open(f"{args.output_path}/results_{args.postfix}.jsonl", "w" if args.overwrite else "a") |
| 48 | agentversepipeline = TaskSolving.from_task(args.task, args.tasks_dir, args.postfix) |
| 49 | plan, result, logs, decision_making_process = agentversepipeline.run() |
| 50 | total_spent = agentversepipeline.environment.get_spend() |
| 51 | if not args.skip_saving: |
| 52 | f.write( |
| 53 | json.dumps( |
| 54 | { |
| 55 | "input": agentversepipeline.environment.task_description, |
| 56 | "response": plan, |
| 57 | "logs": logs, |
| 58 | "decision_making_process": decision_making_process, |
| 59 | "spent": total_spent |
| 60 | }, ensure_ascii=False |
| 61 | ) |
| 62 | + "\n" |
| 63 | ) |
| 64 | f.flush() |
| 65 | f.close() |
| 66 | return |
| 67 | |
| 68 | if __name__ == "__main__": |
| 69 | cli_main() |