reset IPython

pull/695/head
wangzy 2024-02-06 10:58:50 +08:00
parent 62713e2a83
commit 206c3539dc
1 changed files with 3 additions and 2 deletions

View File

@ -54,7 +54,7 @@ DEFAULT_PROMPT = (
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(description='Math Code Interpreter')
parser.add_argument('--backend', parser.add_argument('--backend',
type=str, type=str,
default='lmdeploy', default='lmdeploy',
@ -572,7 +572,8 @@ def predict(args):
] ]
item['pred'].append('😭' if not lang else item['pred'].append('😭' if not lang else
extract_answer(lang[-1]['content']) or '😭') extract_answer(lang[-1]['content']) or '😭')
agent._interpreter_executor.actions[
'IPythonInteractive'].reset()
except Exception as e: except Exception as e:
err = str(traceback.format_exc()) err = str(traceback.format_exc())
print(f'Error processing index {item["idx"]}: {e}\n{err}') print(f'Error processing index {item["idx"]}: {e}\n{err}')