Skip to content

Commit

Permalink
Allow for --save
Browse files Browse the repository at this point in the history
  • Loading branch information
KillianLucas committed Nov 18, 2024
1 parent ca90a22 commit ab97a24
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 25 deletions.
16 changes: 14 additions & 2 deletions interpreter_1/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def _profile_to_arg_params(profile: Profile) -> Dict[str, Dict[str, Any]]:
"flags": ["--profile"],
"default": profile.profile_path,
"help": "Path to profile configuration",
"metavar": "PATH",
},
"debug": {
"flags": ["--debug", "-d"],
Expand Down Expand Up @@ -240,11 +241,14 @@ def parse_args():

parser = argparse.ArgumentParser(add_help=False)

parser.add_argument("--help", "-h", action="store_true", help=argparse.SUPPRESS)
parser.add_argument("--version", action="store_true", help=argparse.SUPPRESS)
parser.add_argument("--help", "-h", action="store_true", help="Show help")
parser.add_argument("--version", action="store_true", help="Show version")
parser.add_argument(
"--profiles", action="store_true", help="Open profiles directory"
)
parser.add_argument(
"--save", action="store", metavar="PATH", help="Save profile to path"
)

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

if args["save"]:
# Apply CLI args to profile
for key, value in args.items():
if key in vars(profile) and value is not None:
setattr(profile, key, value)
profile.save(args["save"])
sys.exit(0)

return args


Expand Down
48 changes: 25 additions & 23 deletions interpreter_1/misc/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,31 @@ def help_message():
A modern command-line assistant.
options:
--model model to use for completion
--provider api provider (e.g. openai, anthropic)
--api-base base url for api requests
--api-key api key for authentication
--api-version api version to use
--temperature sampling temperature (default: 0)
--tools comma-separated tools: interpreter,editor,gui
--allowed-commands commands the model can execute
--allowed-paths paths the model can access
--no-tool-calling disable tool calling (instead parse markdown code)
--auto-run, -y auto-run suggested commands
--interactive force interactive mode (true if sys.stdin.isatty())
--no-interactive disable interactive mode
--instructions additional instructions in system message
--input pre-fill first user message
--system-message override default system message
--max-turns maximum conversation turns (-1 for unlimited)
--profile load settings from config file
--profiles open profiles directory
--serve start openai-compatible server
--models show available models
--model <model> model to use for completion
--provider <provider> api provider (e.g. openai, anthropic)
--api-base <url> base url for api requests
--api-key <key> api key for authentication
--api-version <version> api version to use
--temperature <float> sampling temperature (default: 0)
--tools <list> comma-separated tools: interpreter,editor,gui
--allowed-commands <list> commands the model can execute
--allowed-paths <list> paths the model can access
--no-tool-calling disable tool calling (instead parse markdown code)
--auto-run, -y auto-run suggested commands
--interactive force interactive mode (true if sys.stdin.isatty())
--no-interactive disable interactive mode
--instructions <text> additional instructions in system message
--input <text> pre-fill first user message
--system-message <text> override default system message
--max-turns <int> maximum conversation turns (-1 for unlimited)
--profile <path> load settings from config file or url
--save <path> save settings to config file
--profiles open profiles directory
--serve start openai-compatible server
example: i want a venv
example: interpreter --model ollama/llama3.2 --serve
Expand Down

0 comments on commit ab97a24

Please sign in to comment.