Skip to content

Commit ab97a24

Browse files
committed
Allow for --save
1 parent ca90a22 commit ab97a24

File tree

2 files changed

+39
-25
lines changed

2 files changed

+39
-25
lines changed

interpreter_1/cli.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def _profile_to_arg_params(profile: Profile) -> Dict[str, Dict[str, Any]]:
158158
"flags": ["--profile"],
159159
"default": profile.profile_path,
160160
"help": "Path to profile configuration",
161+
"metavar": "PATH",
161162
},
162163
"debug": {
163164
"flags": ["--debug", "-d"],
@@ -240,11 +241,14 @@ def parse_args():
240241

241242
parser = argparse.ArgumentParser(add_help=False)
242243

243-
parser.add_argument("--help", "-h", action="store_true", help=argparse.SUPPRESS)
244-
parser.add_argument("--version", action="store_true", help=argparse.SUPPRESS)
244+
parser.add_argument("--help", "-h", action="store_true", help="Show help")
245+
parser.add_argument("--version", action="store_true", help="Show version")
245246
parser.add_argument(
246247
"--profiles", action="store_true", help="Open profiles directory"
247248
)
249+
parser.add_argument(
250+
"--save", action="store", metavar="PATH", help="Save profile to path"
251+
)
248252

249253
arg_params = _profile_to_arg_params(profile)
250254
for param in arg_params.values():
@@ -271,6 +275,14 @@ def parse_args():
271275
if key in args and args[key] is None:
272276
args[key] = value
273277

278+
if args["save"]:
279+
# Apply CLI args to profile
280+
for key, value in args.items():
281+
if key in vars(profile) and value is not None:
282+
setattr(profile, key, value)
283+
profile.save(args["save"])
284+
sys.exit(0)
285+
274286
return args
275287

276288

interpreter_1/misc/help.py

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,31 @@ def help_message():
8080
A modern command-line assistant.
8181
8282
options:
83-
--model model to use for completion
84-
--provider api provider (e.g. openai, anthropic)
85-
--api-base base url for api requests
86-
--api-key api key for authentication
87-
--api-version api version to use
88-
--temperature sampling temperature (default: 0)
89-
90-
--tools comma-separated tools: interpreter,editor,gui
91-
--allowed-commands commands the model can execute
92-
--allowed-paths paths the model can access
93-
--no-tool-calling disable tool calling (instead parse markdown code)
94-
--auto-run, -y auto-run suggested commands
95-
--interactive force interactive mode (true if sys.stdin.isatty())
96-
--no-interactive disable interactive mode
97-
98-
--instructions additional instructions in system message
99-
--input pre-fill first user message
100-
--system-message override default system message
101-
--max-turns maximum conversation turns (-1 for unlimited)
102-
103-
--profile load settings from config file
104-
--profiles open profiles directory
105-
--serve start openai-compatible server
83+
--models show available models
84+
--model <model> model to use for completion
85+
--provider <provider> api provider (e.g. openai, anthropic)
86+
--api-base <url> base url for api requests
87+
--api-key <key> api key for authentication
88+
--api-version <version> api version to use
89+
--temperature <float> sampling temperature (default: 0)
90+
91+
--tools <list> comma-separated tools: interpreter,editor,gui
92+
--allowed-commands <list> commands the model can execute
93+
--allowed-paths <list> paths the model can access
94+
--no-tool-calling disable tool calling (instead parse markdown code)
95+
--auto-run, -y auto-run suggested commands
96+
--interactive force interactive mode (true if sys.stdin.isatty())
97+
--no-interactive disable interactive mode
98+
99+
--instructions <text> additional instructions in system message
100+
--input <text> pre-fill first user message
101+
--system-message <text> override default system message
102+
--max-turns <int> maximum conversation turns (-1 for unlimited)
103+
104+
--profile <path> load settings from config file or url
105+
--save <path> save settings to config file
106+
--profiles open profiles directory
107+
--serve start openai-compatible server
106108
107109
example: i want a venv
108110
example: interpreter --model ollama/llama3.2 --serve

0 commit comments

Comments
 (0)