()
| 16 | |
| 17 | |
| 18 | def main(): |
| 19 | parser = argparse.ArgumentParser(description='InternAgent QA — one-shot question answering') |
| 20 | parser.add_argument('--question', '-q', required=True, help='Research question to answer') |
| 21 | parser.add_argument('--file', '-f', default=None, help='Optional file attachment') |
| 22 | parser.add_argument('--output', '-o', default=None, help='Write answer to this file path') |
| 23 | args = parser.parse_args() |
| 24 | |
| 25 | agent = DRAgent(model='o4-mini', config={'mode': 'qa'}) |
| 26 | answer = str(asyncio.run( |
| 27 | agent.execute({'task': args.question, 'file_path': args.file}, {}) |
| 28 | )) |
| 29 | print(answer) |
| 30 | if args.output: |
| 31 | os.makedirs(os.path.dirname(os.path.abspath(args.output)), exist_ok=True) |
| 32 | with open(args.output, 'w', encoding='utf-8') as f: |
| 33 | f.write(answer) |
| 34 | |
| 35 | |
| 36 | if __name__ == '__main__': |
no test coverage detected