assistant 2.0.0b1__tar.gz → 2.0.0b2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {assistant-2.0.0b1/assistant.egg-info → assistant-2.0.0b2}/PKG-INFO +9 -6
- {assistant-2.0.0b1 → assistant-2.0.0b2}/README.md +8 -5
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/__init__.py +1 -1
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/builtin_cmds.py +40 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/config.py +7 -4
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/main.py +10 -8
- assistant-2.0.0b2/assistant/setup_wizard.py +657 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2/assistant.egg-info}/PKG-INFO +9 -6
- assistant-2.0.0b1/assistant/setup_wizard.py +0 -120
- {assistant-2.0.0b1 → assistant-2.0.0b2}/LICENSE +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/MANIFEST.in +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/__main__.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/_execer.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/agent.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/as_client.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/as_service.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/codecache.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/conditions.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/entry_points/__init__.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/entry_points/run_assistant.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/execer.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/history.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/icons.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/listen/__init__.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/listen/__main__.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/listen/interface.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/listen/main.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/memory.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/nlp/__init__.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/nlp/clear.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/nlp/exit.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/nlp/interface.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/nlp/providers/__init__.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/nlp/providers/ollama.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/nlp/providers/openai.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/nlp/think.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/parser.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/procs/pipelines.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/procs/specs.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/ptk_shell/__init__.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/ptk_shell/bindings.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/ptk_shell/completer.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/ptk_shell/dialogs.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/ptk_shell/floats.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/ptk_shell/layout.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/ptk_shell/shell.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/ptk_shell/strformat_utils.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/ptk_shell/styles.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/ptk_shell/windows.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/say/__init__.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/say/interface.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/time.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/tools.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/utils.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/version.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant/vocabulary.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant.egg-info/SOURCES.txt +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant.egg-info/dependency_links.txt +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant.egg-info/entry_points.txt +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant.egg-info/requires.txt +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/assistant.egg-info/top_level.txt +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/pyproject.toml +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/setup.cfg +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/setup.py +0 -0
- {assistant-2.0.0b1 → assistant-2.0.0b2}/tests/test_tools_execution.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: assistant
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0b2
|
|
4
4
|
Summary: Your very own Assistant. Because you deserve it.
|
|
5
5
|
Home-page: https://gitlab.com/waser-technologies/technologies/assistant
|
|
6
6
|
Author: Danny Waser
|
|
@@ -126,12 +126,12 @@ pacman -S python-assistant
|
|
|
126
126
|
|
|
127
127
|
</details>
|
|
128
128
|
|
|
129
|
-
### 2. Run the
|
|
129
|
+
### 2. Run the Configuration Wizard
|
|
130
130
|
|
|
131
131
|
On the first launch the wizard starts automatically. You can also re-run it at any time:
|
|
132
132
|
|
|
133
133
|
```bash
|
|
134
|
-
assistant
|
|
134
|
+
assistant config
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
The wizard asks you to choose:
|
|
@@ -179,15 +179,18 @@ That's it — you're in. Type commands, ask questions, or mix both.
|
|
|
179
179
|
```text
|
|
180
180
|
assistant --help
|
|
181
181
|
assistant --version
|
|
182
|
-
assistant
|
|
182
|
+
assistant config # (re)run the configuration wizard
|
|
183
183
|
assistant -c "what time is it" # single query, then exit
|
|
184
|
-
assistant -n # skip the intro message
|
|
184
|
+
assistant -n # skip the interactive intro message (warmup)
|
|
185
185
|
assistant Hello Assistant # one-shot query
|
|
186
186
|
assistant # interactive mode
|
|
187
187
|
```
|
|
188
188
|
|
|
189
189
|
### Interactive Mode
|
|
190
190
|
|
|
191
|
+
<!-- [](https://youtu.be/OAgLgq0aGhI?si=8kIrj24neGD8sWec) -->
|
|
192
|
+
[](https://youtu.be/OAgLgq0aGhI?si=8kIrj24neGD8sWec)
|
|
193
|
+
|
|
191
194
|
```text
|
|
192
195
|
waser@host ~
|
|
193
196
|
❯ Hi Assistant.
|
|
@@ -329,7 +332,7 @@ Credentials are resolved in this order:
|
|
|
329
332
|
3. **OpenAI fallback** — for OpenAI provider, also checks `OPENAI_API_KEY` standard env var
|
|
330
333
|
4. **Plain text** — last resort (not recommended)
|
|
331
334
|
|
|
332
|
-
To store credentials securely in your system keyring, use `assistant
|
|
335
|
+
To store credentials securely in your system keyring, use `assistant config` and select "Store in keyring" when prompted, or manually:
|
|
333
336
|
|
|
334
337
|
```python
|
|
335
338
|
import keyring
|
|
@@ -73,12 +73,12 @@ pacman -S python-assistant
|
|
|
73
73
|
|
|
74
74
|
</details>
|
|
75
75
|
|
|
76
|
-
### 2. Run the
|
|
76
|
+
### 2. Run the Configuration Wizard
|
|
77
77
|
|
|
78
78
|
On the first launch the wizard starts automatically. You can also re-run it at any time:
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
assistant
|
|
81
|
+
assistant config
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
The wizard asks you to choose:
|
|
@@ -126,15 +126,18 @@ That's it — you're in. Type commands, ask questions, or mix both.
|
|
|
126
126
|
```text
|
|
127
127
|
assistant --help
|
|
128
128
|
assistant --version
|
|
129
|
-
assistant
|
|
129
|
+
assistant config # (re)run the configuration wizard
|
|
130
130
|
assistant -c "what time is it" # single query, then exit
|
|
131
|
-
assistant -n # skip the intro message
|
|
131
|
+
assistant -n # skip the interactive intro message (warmup)
|
|
132
132
|
assistant Hello Assistant # one-shot query
|
|
133
133
|
assistant # interactive mode
|
|
134
134
|
```
|
|
135
135
|
|
|
136
136
|
### Interactive Mode
|
|
137
137
|
|
|
138
|
+
<!-- [](https://youtu.be/OAgLgq0aGhI?si=8kIrj24neGD8sWec) -->
|
|
139
|
+
[](https://youtu.be/OAgLgq0aGhI?si=8kIrj24neGD8sWec)
|
|
140
|
+
|
|
138
141
|
```text
|
|
139
142
|
waser@host ~
|
|
140
143
|
❯ Hi Assistant.
|
|
@@ -276,7 +279,7 @@ Credentials are resolved in this order:
|
|
|
276
279
|
3. **OpenAI fallback** — for OpenAI provider, also checks `OPENAI_API_KEY` standard env var
|
|
277
280
|
4. **Plain text** — last resort (not recommended)
|
|
278
281
|
|
|
279
|
-
To store credentials securely in your system keyring, use `assistant
|
|
282
|
+
To store credentials securely in your system keyring, use `assistant config` and select "Store in keyring" when prompted, or manually:
|
|
280
283
|
|
|
281
284
|
```python
|
|
282
285
|
import keyring
|
|
@@ -123,6 +123,7 @@ Direct assistant commands:
|
|
|
123
123
|
|
|
124
124
|
if args and args[0] in ("version", "--version"):
|
|
125
125
|
from assistant import __version__
|
|
126
|
+
|
|
126
127
|
shell.log_response(Markdown(f"Assistant version {__version__}"))
|
|
127
128
|
return 0
|
|
128
129
|
|
|
@@ -366,6 +367,40 @@ Subcommands:
|
|
|
366
367
|
help Show this help"""
|
|
367
368
|
|
|
368
369
|
|
|
370
|
+
def config_fn(args, stdin=None):
|
|
371
|
+
"""Run the configuration wizard."""
|
|
372
|
+
from assistant.setup_wizard import run_setup_wizard
|
|
373
|
+
|
|
374
|
+
shell = XSH.shell.shell
|
|
375
|
+
if args is None:
|
|
376
|
+
args = []
|
|
377
|
+
|
|
378
|
+
if args and args[0] in ("-h", "--help", "help"):
|
|
379
|
+
output = """# Help for the `config` command
|
|
380
|
+
```text
|
|
381
|
+
Usage: `config [PATH]`
|
|
382
|
+
Run the interactive configuration wizard to manage:
|
|
383
|
+
- Providers (add/edit/remove)
|
|
384
|
+
- Models (add/edit/remove)
|
|
385
|
+
- Agents (create/edit/disable)
|
|
386
|
+
- Web search settings
|
|
387
|
+
- Execution settings
|
|
388
|
+
|
|
389
|
+
Arguments:
|
|
390
|
+
PATH Optional path to config file (default: ~/.assistant/config.toml)
|
|
391
|
+
```
|
|
392
|
+
"""
|
|
393
|
+
shell.log_response(Markdown(output))
|
|
394
|
+
return 0
|
|
395
|
+
|
|
396
|
+
config_path = None
|
|
397
|
+
if args and not args[0].startswith("-"):
|
|
398
|
+
config_path = args[0]
|
|
399
|
+
|
|
400
|
+
run_setup_wizard(config_path)
|
|
401
|
+
return 0
|
|
402
|
+
|
|
403
|
+
|
|
369
404
|
def help_fn(args, stdin=None):
|
|
370
405
|
"""Show available built-in commands."""
|
|
371
406
|
shell = XSH.shell.shell
|
|
@@ -407,6 +442,11 @@ BUILTIN_COMMANDS = {
|
|
|
407
442
|
"description": "Show available commands",
|
|
408
443
|
"usage": "Usage: help [command]",
|
|
409
444
|
},
|
|
445
|
+
"config": {
|
|
446
|
+
"fn": config_fn,
|
|
447
|
+
"description": "Run the configuration wizard",
|
|
448
|
+
"usage": "Usage: config",
|
|
449
|
+
},
|
|
410
450
|
"memory": {
|
|
411
451
|
"fn": memory_fn,
|
|
412
452
|
"description": "Interact with assistant memory (list/search/add/clear/count)",
|
|
@@ -245,10 +245,13 @@ class Config:
|
|
|
245
245
|
|
|
246
246
|
|
|
247
247
|
_config_instance = None
|
|
248
|
+
_config_path: Optional[str] = None
|
|
248
249
|
|
|
249
250
|
|
|
250
|
-
def get_config(force_reload=False) -> Config:
|
|
251
|
-
global _config_instance
|
|
252
|
-
if
|
|
253
|
-
|
|
251
|
+
def get_config(force_reload=False, path: Optional[str] = None) -> Config:
|
|
252
|
+
global _config_instance, _config_path
|
|
253
|
+
if path:
|
|
254
|
+
_config_path = path
|
|
255
|
+
if _config_instance is None or force_reload or path:
|
|
256
|
+
_config_instance = Config(path=_config_path) if _config_path else Config()
|
|
254
257
|
return _config_instance
|
|
@@ -250,10 +250,10 @@ def parser():
|
|
|
250
250
|
# help="Start the Docker services.",
|
|
251
251
|
# )
|
|
252
252
|
p.add_argument(
|
|
253
|
-
"
|
|
254
|
-
|
|
255
|
-
default=
|
|
256
|
-
help="
|
|
253
|
+
"-C",
|
|
254
|
+
"--config",
|
|
255
|
+
default=None,
|
|
256
|
+
help="Path to config file (default: ~/.assistant/config.toml)",
|
|
257
257
|
)
|
|
258
258
|
p.add_argument(
|
|
259
259
|
"-n",
|
|
@@ -447,10 +447,12 @@ def premain(argv=None):
|
|
|
447
447
|
parser.exit()
|
|
448
448
|
|
|
449
449
|
cfg = get_config()
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
450
|
+
config_path = getattr(args, "config", None)
|
|
451
|
+
if config_path or not cfg.exists():
|
|
452
|
+
if not run_setup_wizard(config_path):
|
|
453
|
+
if not cfg.exists():
|
|
454
|
+
print("Setup cancelled or failed. Exiting.")
|
|
455
|
+
sys.exit(1)
|
|
454
456
|
print("No configuration found. Running setup wizard...")
|
|
455
457
|
if not run_setup_wizard():
|
|
456
458
|
print("Setup cancelled or failed. Exiting.")
|
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
import questionary
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from rich.console import Console
|
|
5
|
+
from typing import Any, Optional
|
|
6
|
+
|
|
7
|
+
from assistant.config import get_config, DEFAULT_CONFIG, Config
|
|
8
|
+
|
|
9
|
+
console = Console()
|
|
10
|
+
|
|
11
|
+
SYSTEM_PERSONA = """You are Assistant, a sentient artificial intelligence.
|
|
12
|
+
You have a calm, polite and witty personality, often displaying a sense of humor and sarcasm.
|
|
13
|
+
You are loyal, reliable and helpful, always ready to provide information, advice or assistance to users."""
|
|
14
|
+
|
|
15
|
+
SYSTEM_ROLE = """Your role is to act as a natural language interface between the user and the common xonsh shell session.
|
|
16
|
+
The common xonsh shell session is a share Xonsh REPL when you and the user can type valid shell command and python code seamlessly."""
|
|
17
|
+
|
|
18
|
+
_config_path: Optional[str] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _get_config_instance() -> Config:
|
|
22
|
+
"""Get config instance, optionally with custom path."""
|
|
23
|
+
global _config_path
|
|
24
|
+
return (
|
|
25
|
+
get_config(force_reload=True, path=_config_path)
|
|
26
|
+
if _config_path
|
|
27
|
+
else get_config(force_reload=True)
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def load_existing_config(config_path: Optional[str] = None) -> bool:
|
|
32
|
+
"""Load existing config if it exists."""
|
|
33
|
+
global _config_path
|
|
34
|
+
if config_path:
|
|
35
|
+
_config_path = config_path
|
|
36
|
+
get_config(force_reload=True, path=config_path)
|
|
37
|
+
else:
|
|
38
|
+
get_config(force_reload=True)
|
|
39
|
+
cfg = _get_config_instance()
|
|
40
|
+
if cfg.exists() and cfg.raw:
|
|
41
|
+
return True
|
|
42
|
+
return False
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def run_main_menu() -> bool:
|
|
46
|
+
"""Main interactive menu for configuration management."""
|
|
47
|
+
cfg = _get_config_instance()
|
|
48
|
+
|
|
49
|
+
while True:
|
|
50
|
+
choices = [
|
|
51
|
+
"Provider Settings",
|
|
52
|
+
"Model Management",
|
|
53
|
+
"Agent Management",
|
|
54
|
+
"Web Search Settings",
|
|
55
|
+
"Execution Settings",
|
|
56
|
+
"Save & Exit",
|
|
57
|
+
"Exit Without Saving ([Ctrl] + [C])",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
choice = questionary.select(
|
|
61
|
+
"Configuration Menu",
|
|
62
|
+
choices=choices,
|
|
63
|
+
).ask()
|
|
64
|
+
|
|
65
|
+
if choice == "Provider Settings":
|
|
66
|
+
manage_providers(cfg)
|
|
67
|
+
elif choice == "Model Management":
|
|
68
|
+
manage_models(cfg)
|
|
69
|
+
elif choice == "Agent Management":
|
|
70
|
+
manage_agents(cfg)
|
|
71
|
+
elif choice == "Web Search Settings":
|
|
72
|
+
manage_web_search(cfg)
|
|
73
|
+
elif choice == "Execution Settings":
|
|
74
|
+
manage_execution(cfg)
|
|
75
|
+
elif choice == "Save & Exit":
|
|
76
|
+
cfg.save()
|
|
77
|
+
console.print(f"[bold green]Configuration saved to {cfg.path}[/bold green]")
|
|
78
|
+
return True
|
|
79
|
+
elif choice == "Exit Without Saving ([Ctrl] + [C])":
|
|
80
|
+
choice = None
|
|
81
|
+
|
|
82
|
+
if choice is None:
|
|
83
|
+
print("You are about to loose all your changes.")
|
|
84
|
+
confirm = questionary.confirm(
|
|
85
|
+
"Are you sure you want to exit without saving?", default=False
|
|
86
|
+
).ask()
|
|
87
|
+
if confirm:
|
|
88
|
+
return False
|
|
89
|
+
else:
|
|
90
|
+
continue
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def manage_providers(cfg) -> None:
|
|
94
|
+
"""Manage LLM providers."""
|
|
95
|
+
while True:
|
|
96
|
+
providers = cfg.raw.get("provider", {})
|
|
97
|
+
choices = ["Add New Provider"]
|
|
98
|
+
|
|
99
|
+
for p_id in providers:
|
|
100
|
+
p = providers[p_id]
|
|
101
|
+
ep = p.get("endpoint", "N/A")
|
|
102
|
+
choices.append(f"Edit: {p_id} ({ep})")
|
|
103
|
+
|
|
104
|
+
choices.append("Back")
|
|
105
|
+
|
|
106
|
+
choice = questionary.select("Provider Settings", choices=choices).ask()
|
|
107
|
+
|
|
108
|
+
if choice == "Add New Provider":
|
|
109
|
+
add_provider(cfg)
|
|
110
|
+
elif choice == "Back":
|
|
111
|
+
break
|
|
112
|
+
elif choice and choice.startswith("Edit: "):
|
|
113
|
+
p_id = choice.replace("Edit: ", "").split(" (")[0]
|
|
114
|
+
edit_provider(cfg, p_id)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def add_provider(cfg) -> None:
|
|
118
|
+
"""Add a new provider."""
|
|
119
|
+
provider_choice = questionary.select(
|
|
120
|
+
"Choose Provider Type:",
|
|
121
|
+
choices=[
|
|
122
|
+
"ollama (Local)",
|
|
123
|
+
"vllm (Local)",
|
|
124
|
+
"openai (API)",
|
|
125
|
+
"custom (OpenAI-compatible)",
|
|
126
|
+
],
|
|
127
|
+
).ask()
|
|
128
|
+
|
|
129
|
+
if not provider_choice:
|
|
130
|
+
return
|
|
131
|
+
|
|
132
|
+
provider_type = provider_choice.split(" ")[0]
|
|
133
|
+
|
|
134
|
+
default_url = "http://localhost:11434/v1"
|
|
135
|
+
default_key = "ollama"
|
|
136
|
+
|
|
137
|
+
if provider_type == "vllm":
|
|
138
|
+
default_url = "http://localhost:8000/v1"
|
|
139
|
+
default_key = "EMPTY"
|
|
140
|
+
elif provider_type == "openai":
|
|
141
|
+
default_url = "https://api.openai.com/v1"
|
|
142
|
+
default_key = ""
|
|
143
|
+
elif provider_type == "custom":
|
|
144
|
+
default_url = "http://localhost:8000/v1"
|
|
145
|
+
default_key = ""
|
|
146
|
+
provider_type = questionary.text("Provider ID (unique identifier):").ask()
|
|
147
|
+
if not provider_type:
|
|
148
|
+
return
|
|
149
|
+
|
|
150
|
+
endpoint = questionary.text("API Base URL:", default=default_url).ask()
|
|
151
|
+
if not endpoint:
|
|
152
|
+
return
|
|
153
|
+
|
|
154
|
+
api_key = questionary.password("API Key:", default=default_key).ask()
|
|
155
|
+
if not api_key:
|
|
156
|
+
return
|
|
157
|
+
|
|
158
|
+
store_keyring = questionary.confirm(
|
|
159
|
+
"Store API key in system keyring?", default=True
|
|
160
|
+
).ask()
|
|
161
|
+
|
|
162
|
+
if store_keyring and api_key and api_key not in ("ollama", "EMPTY", ""):
|
|
163
|
+
try:
|
|
164
|
+
import keyring
|
|
165
|
+
|
|
166
|
+
keyring.set_password("assistant", provider_type, api_key)
|
|
167
|
+
api_key = f"keyring:{provider_type}"
|
|
168
|
+
console.print("[dim]API key stored in keyring[/dim]")
|
|
169
|
+
except Exception:
|
|
170
|
+
pass
|
|
171
|
+
|
|
172
|
+
if "provider" not in cfg.raw:
|
|
173
|
+
cfg.raw["provider"] = {}
|
|
174
|
+
|
|
175
|
+
cfg.raw["provider"][provider_type] = {
|
|
176
|
+
"endpoint": endpoint,
|
|
177
|
+
"credential": api_key,
|
|
178
|
+
}
|
|
179
|
+
console.print(f"[green]Provider '{provider_type}' added[/green]")
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def edit_provider(cfg, provider_id: str) -> None:
|
|
183
|
+
"""Edit an existing provider."""
|
|
184
|
+
providers = cfg.raw.get("provider", {})
|
|
185
|
+
current = providers.get(provider_id, {})
|
|
186
|
+
|
|
187
|
+
choices = ["Edit Endpoint", "Edit Credential", "Remove Provider", "Back"]
|
|
188
|
+
choice = questionary.select(f"Edit {provider_id}", choices=choices).ask()
|
|
189
|
+
|
|
190
|
+
if choice == "Edit Endpoint":
|
|
191
|
+
new_endpoint = questionary.text(
|
|
192
|
+
"API Base URL:", default=current.get("endpoint", "")
|
|
193
|
+
).ask()
|
|
194
|
+
if new_endpoint:
|
|
195
|
+
cfg.raw["provider"][provider_id]["endpoint"] = new_endpoint
|
|
196
|
+
|
|
197
|
+
elif choice == "Edit Credential":
|
|
198
|
+
new_key = questionary.password(
|
|
199
|
+
"API Key:", default=current.get("credential", "")
|
|
200
|
+
).ask()
|
|
201
|
+
if new_key:
|
|
202
|
+
cfg.raw["provider"][provider_id]["credential"] = new_key
|
|
203
|
+
|
|
204
|
+
elif choice == "Remove Provider":
|
|
205
|
+
confirm = questionary.confirm(
|
|
206
|
+
f"Remove provider '{provider_id}'?", default=False
|
|
207
|
+
).ask()
|
|
208
|
+
if confirm:
|
|
209
|
+
del cfg.raw["provider"][provider_id]
|
|
210
|
+
console.print(f"[dim]Provider '{provider_id}' removed[/dim]")
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def manage_models(cfg) -> None:
|
|
214
|
+
"""Manage models."""
|
|
215
|
+
while True:
|
|
216
|
+
models = cfg.raw.get("model", {})
|
|
217
|
+
choices = ["Add New Model"]
|
|
218
|
+
|
|
219
|
+
for m_id, m in models.items():
|
|
220
|
+
p = m.get("provider", "N/A")
|
|
221
|
+
choices.append(f"Edit: {m_id} ({p})")
|
|
222
|
+
|
|
223
|
+
choices.append("Back")
|
|
224
|
+
|
|
225
|
+
choice = questionary.select("Model Management", choices=choices).ask()
|
|
226
|
+
|
|
227
|
+
if choice == "Add New Model":
|
|
228
|
+
add_model(cfg)
|
|
229
|
+
elif choice == "Back":
|
|
230
|
+
break
|
|
231
|
+
elif choice and choice.startswith("Edit: "):
|
|
232
|
+
m_id = choice.replace("Edit: ", "").split(" (")[0]
|
|
233
|
+
edit_model(cfg, m_id)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def add_model(cfg) -> None:
|
|
237
|
+
"""Add a new model."""
|
|
238
|
+
model_id = questionary.text("Model ID (e.g., qwen3.5:latest):").ask()
|
|
239
|
+
if not model_id:
|
|
240
|
+
return
|
|
241
|
+
|
|
242
|
+
name = questionary.text("Display Name:", default=model_id).ask()
|
|
243
|
+
if not name:
|
|
244
|
+
return
|
|
245
|
+
|
|
246
|
+
providers = list(cfg.raw.get("provider", {}).keys())
|
|
247
|
+
if not providers:
|
|
248
|
+
console.print("[red]No providers configured. Add a provider first.[/red]")
|
|
249
|
+
return
|
|
250
|
+
|
|
251
|
+
provider = questionary.select("Provider:", choices=providers).ask()
|
|
252
|
+
if not provider:
|
|
253
|
+
return
|
|
254
|
+
|
|
255
|
+
ctx = questionary.text("Context Length:", default="128000").ask()
|
|
256
|
+
try:
|
|
257
|
+
context_length = int(ctx)
|
|
258
|
+
except (ValueError, TypeError):
|
|
259
|
+
context_length = 128000
|
|
260
|
+
|
|
261
|
+
if "model" not in cfg.raw:
|
|
262
|
+
cfg.raw["model"] = {}
|
|
263
|
+
|
|
264
|
+
cfg.raw["model"][model_id] = {
|
|
265
|
+
"id": model_id,
|
|
266
|
+
"name": name,
|
|
267
|
+
"provider": provider,
|
|
268
|
+
"context_length": context_length,
|
|
269
|
+
}
|
|
270
|
+
console.print(f"[green]Model '{model_id}' added[/green]")
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def edit_model(cfg, model_id: str) -> None:
|
|
274
|
+
"""Edit an existing model."""
|
|
275
|
+
models = cfg.raw.get("model", {})
|
|
276
|
+
current = models.get(model_id, {})
|
|
277
|
+
|
|
278
|
+
choices = [
|
|
279
|
+
"Edit Name",
|
|
280
|
+
"Edit Provider",
|
|
281
|
+
"Edit Context Length",
|
|
282
|
+
"Remove Model",
|
|
283
|
+
"Back",
|
|
284
|
+
]
|
|
285
|
+
choice = questionary.select(f"Edit {model_id}", choices=choices).ask()
|
|
286
|
+
|
|
287
|
+
if choice == "Edit Name":
|
|
288
|
+
new_name = questionary.text(
|
|
289
|
+
"Display Name:", default=current.get("name", "")
|
|
290
|
+
).ask()
|
|
291
|
+
if new_name:
|
|
292
|
+
cfg.raw["model"][model_id]["name"] = new_name
|
|
293
|
+
|
|
294
|
+
elif choice == "Edit Provider":
|
|
295
|
+
providers = list(cfg.raw.get("provider", {}).keys())
|
|
296
|
+
new_provider = questionary.select("Provider:", choices=providers).ask()
|
|
297
|
+
if new_provider:
|
|
298
|
+
cfg.raw["model"][model_id]["provider"] = new_provider
|
|
299
|
+
|
|
300
|
+
elif choice == "Edit Context Length":
|
|
301
|
+
ctx = questionary.text(
|
|
302
|
+
"Context Length:", default=str(current.get("context_length", 128000))
|
|
303
|
+
).ask()
|
|
304
|
+
try:
|
|
305
|
+
cfg.raw["model"][model_id]["context_length"] = int(ctx)
|
|
306
|
+
except (ValueError, TypeError):
|
|
307
|
+
pass
|
|
308
|
+
|
|
309
|
+
elif choice == "Remove Model":
|
|
310
|
+
confirm = questionary.confirm(
|
|
311
|
+
f"Remove model '{model_id}'?", default=False
|
|
312
|
+
).ask()
|
|
313
|
+
if confirm:
|
|
314
|
+
del cfg.raw["model"][model_id]
|
|
315
|
+
console.print(f"[dim]Model '{model_id}' removed[/dim]")
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def manage_agents(cfg) -> None:
|
|
319
|
+
"""Manage agents."""
|
|
320
|
+
while True:
|
|
321
|
+
agents = cfg.raw.get("agent", {})
|
|
322
|
+
choices = ["Create New Agent"]
|
|
323
|
+
|
|
324
|
+
for a_id, a in agents.items(): # type: ignore
|
|
325
|
+
choices.append(f"Edit: {a_id}")
|
|
326
|
+
|
|
327
|
+
choices.append("Back")
|
|
328
|
+
|
|
329
|
+
choice = questionary.select("Agent Management", choices=choices).ask()
|
|
330
|
+
|
|
331
|
+
if choice == "Create New Agent":
|
|
332
|
+
create_agent(cfg)
|
|
333
|
+
elif choice == "Back":
|
|
334
|
+
break
|
|
335
|
+
elif choice and choice.startswith("Edit: "):
|
|
336
|
+
a_id = choice.replace("Edit: ", "")
|
|
337
|
+
edit_agent(cfg, a_id)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def create_agent(cfg) -> None:
|
|
341
|
+
"""Create a new agent."""
|
|
342
|
+
agent_id = questionary.text("Agent ID (unique identifier):").ask()
|
|
343
|
+
if not agent_id:
|
|
344
|
+
return
|
|
345
|
+
|
|
346
|
+
name = questionary.text("Display Name:", default=agent_id.title()).ask()
|
|
347
|
+
if not name:
|
|
348
|
+
return
|
|
349
|
+
|
|
350
|
+
description = questionary.text("Description:").ask()
|
|
351
|
+
if not description:
|
|
352
|
+
return
|
|
353
|
+
|
|
354
|
+
models = cfg.raw.get("model", {})
|
|
355
|
+
if not models:
|
|
356
|
+
console.print("[red]No models configured. Add a model first.[/red]")
|
|
357
|
+
return
|
|
358
|
+
|
|
359
|
+
model_ids = list(models.keys())
|
|
360
|
+
model = questionary.select("Model:", choices=model_ids).ask()
|
|
361
|
+
if not model:
|
|
362
|
+
return
|
|
363
|
+
|
|
364
|
+
instructions = questionary.text(
|
|
365
|
+
"Instructions:", default=f"{SYSTEM_PERSONA}\n\n{SYSTEM_ROLE}"
|
|
366
|
+
).ask()
|
|
367
|
+
|
|
368
|
+
all_tools = [
|
|
369
|
+
"xonsh",
|
|
370
|
+
"web_search",
|
|
371
|
+
"read_webpage",
|
|
372
|
+
"read_file",
|
|
373
|
+
"write_file",
|
|
374
|
+
"edit_file",
|
|
375
|
+
]
|
|
376
|
+
tools = questionary.checkbox(
|
|
377
|
+
"Select Tools:",
|
|
378
|
+
choices=all_tools,
|
|
379
|
+
).ask()
|
|
380
|
+
|
|
381
|
+
all_agents = list(cfg.raw.get("agent", {}).keys())
|
|
382
|
+
handoffs = questionary.checkbox(
|
|
383
|
+
"Select Handoffs:",
|
|
384
|
+
choices=all_agents + ["system", "web"],
|
|
385
|
+
).ask()
|
|
386
|
+
|
|
387
|
+
if "agent" not in cfg.raw:
|
|
388
|
+
cfg.raw["agent"] = {}
|
|
389
|
+
|
|
390
|
+
cfg.raw["agent"][agent_id] = {
|
|
391
|
+
"name": name,
|
|
392
|
+
"model": model,
|
|
393
|
+
"description": description,
|
|
394
|
+
"instructions": instructions,
|
|
395
|
+
"tools": tools,
|
|
396
|
+
"handoffs": handoffs,
|
|
397
|
+
}
|
|
398
|
+
console.print(f"[green]Agent '{agent_id}' created[/green]")
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def edit_agent(cfg, agent_id: str) -> None:
|
|
402
|
+
"""Edit an existing agent."""
|
|
403
|
+
agents = cfg.raw.get("agent", {})
|
|
404
|
+
current = agents.get(agent_id, {})
|
|
405
|
+
|
|
406
|
+
choices = [
|
|
407
|
+
"Edit Name",
|
|
408
|
+
"Edit Model",
|
|
409
|
+
"Edit Description",
|
|
410
|
+
"Edit Instructions",
|
|
411
|
+
"Edit Tools",
|
|
412
|
+
"Edit Handoffs",
|
|
413
|
+
"Remove Agent",
|
|
414
|
+
"Back",
|
|
415
|
+
]
|
|
416
|
+
choice = questionary.select(f"Edit {agent_id}", choices=choices).ask()
|
|
417
|
+
|
|
418
|
+
if choice == "Edit Name":
|
|
419
|
+
new_name = questionary.text("Name:", default=current.get("name", "")).ask()
|
|
420
|
+
if new_name:
|
|
421
|
+
cfg.raw["agent"][agent_id]["name"] = new_name
|
|
422
|
+
|
|
423
|
+
elif choice == "Edit Model":
|
|
424
|
+
models = list(cfg.raw.get("model", {}).keys())
|
|
425
|
+
new_model = questionary.select("Model:", choices=models).ask()
|
|
426
|
+
if new_model:
|
|
427
|
+
cfg.raw["agent"][agent_id]["model"] = new_model
|
|
428
|
+
|
|
429
|
+
elif choice == "Edit Description":
|
|
430
|
+
new_desc = questionary.text(
|
|
431
|
+
"Description:", default=current.get("description", "")
|
|
432
|
+
).ask()
|
|
433
|
+
if new_desc:
|
|
434
|
+
cfg.raw["agent"][agent_id]["description"] = new_desc
|
|
435
|
+
|
|
436
|
+
elif choice == "Edit Instructions":
|
|
437
|
+
new_inst = questionary.text(
|
|
438
|
+
"Instructions:", default=current.get("instructions", "")
|
|
439
|
+
).ask()
|
|
440
|
+
if new_inst:
|
|
441
|
+
cfg.raw["agent"][agent_id]["instructions"] = new_inst
|
|
442
|
+
|
|
443
|
+
elif choice == "Edit Tools":
|
|
444
|
+
all_tools = [
|
|
445
|
+
"xonsh",
|
|
446
|
+
"web_search",
|
|
447
|
+
"read_webpage",
|
|
448
|
+
"read_file",
|
|
449
|
+
"write_file",
|
|
450
|
+
"edit_file",
|
|
451
|
+
]
|
|
452
|
+
tools = questionary.checkbox(
|
|
453
|
+
"Select Tools:",
|
|
454
|
+
choices=all_tools,
|
|
455
|
+
).ask()
|
|
456
|
+
if tools is not None:
|
|
457
|
+
cfg.raw["agent"][agent_id]["tools"] = tools
|
|
458
|
+
|
|
459
|
+
elif choice == "Edit Handoffs":
|
|
460
|
+
all_agents = list(cfg.raw.get("agent", {}).keys())
|
|
461
|
+
handoffs = questionary.checkbox(
|
|
462
|
+
"Select Handoffs:",
|
|
463
|
+
choices=all_agents + ["system", "web"],
|
|
464
|
+
).ask()
|
|
465
|
+
if handoffs is not None:
|
|
466
|
+
cfg.raw["agent"][agent_id]["handoffs"] = handoffs
|
|
467
|
+
|
|
468
|
+
elif choice == "Remove Agent":
|
|
469
|
+
confirm = questionary.confirm(
|
|
470
|
+
f"Remove agent '{agent_id}'?", default=False
|
|
471
|
+
).ask()
|
|
472
|
+
if confirm:
|
|
473
|
+
del cfg.raw["agent"][agent_id]
|
|
474
|
+
console.print(f"[dim]Agent '{agent_id}' removed[/dim]")
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
def manage_web_search(cfg) -> None:
|
|
478
|
+
"""Manage web search settings."""
|
|
479
|
+
enabled = cfg.raw.get("web_search", {}).get("enabled", True)
|
|
480
|
+
searxng_url = cfg.raw.get("web_search", {}).get(
|
|
481
|
+
"searxng_url", "http://localhost:8888"
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
new_enabled = questionary.confirm(
|
|
485
|
+
"Enable Web Search (SearXNG)?", default=enabled
|
|
486
|
+
).ask()
|
|
487
|
+
|
|
488
|
+
cfg.raw.setdefault("web_search", {})["enabled"] = new_enabled
|
|
489
|
+
|
|
490
|
+
if new_enabled:
|
|
491
|
+
new_url = questionary.text("SearXNG URL:", default=searxng_url).ask()
|
|
492
|
+
if new_url:
|
|
493
|
+
cfg.raw["web_search"]["searxng_url"] = new_url
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
def manage_execution(cfg) -> None:
|
|
497
|
+
"""Manage execution settings."""
|
|
498
|
+
exec_cfg = cfg.raw.setdefault("execution", {})
|
|
499
|
+
|
|
500
|
+
think = questionary.confirm(
|
|
501
|
+
"Enable Reasoning (think mode)?", default=exec_cfg.get("think", False)
|
|
502
|
+
).ask()
|
|
503
|
+
exec_cfg["think"] = think
|
|
504
|
+
|
|
505
|
+
max_turns = questionary.text(
|
|
506
|
+
"Max Turns:", default=str(exec_cfg.get("max_turns", 50))
|
|
507
|
+
).ask()
|
|
508
|
+
try:
|
|
509
|
+
exec_cfg["max_turns"] = int(max_turns)
|
|
510
|
+
except (ValueError, TypeError):
|
|
511
|
+
pass
|
|
512
|
+
|
|
513
|
+
temp = questionary.text(
|
|
514
|
+
"Temperature:", default=str(exec_cfg.get("temperature", 0.1))
|
|
515
|
+
).ask()
|
|
516
|
+
try:
|
|
517
|
+
exec_cfg["temperature"] = float(temp)
|
|
518
|
+
except (ValueError, TypeError):
|
|
519
|
+
pass
|
|
520
|
+
|
|
521
|
+
max_out = questionary.text(
|
|
522
|
+
"Max Command Output Length:",
|
|
523
|
+
default=str(exec_cfg.get("max_command_output_length", 25000)),
|
|
524
|
+
).ask()
|
|
525
|
+
try:
|
|
526
|
+
exec_cfg["max_command_output_length"] = int(max_out)
|
|
527
|
+
except (ValueError, TypeError):
|
|
528
|
+
pass
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
def run_setup_wizard(config_path: Optional[str] = None) -> bool:
|
|
532
|
+
"""Run the setup wizard - entry point."""
|
|
533
|
+
global _config_path
|
|
534
|
+
if config_path:
|
|
535
|
+
_config_path = config_path
|
|
536
|
+
console.print("\n[bold cyan]Assistant Configuration Wizard[/bold cyan]\n")
|
|
537
|
+
|
|
538
|
+
config_exists = load_existing_config()
|
|
539
|
+
|
|
540
|
+
if config_exists:
|
|
541
|
+
console.print("[dim]Existing configuration loaded - entering edit mode[/dim]\n")
|
|
542
|
+
return run_main_menu()
|
|
543
|
+
else:
|
|
544
|
+
console.print("[dim]No configuration found - running initial setup[/dim]\n")
|
|
545
|
+
return run_initial_setup()
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
def run_initial_setup() -> bool:
|
|
549
|
+
"""Run the initial configuration wizard (original behavior)."""
|
|
550
|
+
console.print("\n[bold cyan]Assistant TOML Configuration Wizard[/bold cyan]")
|
|
551
|
+
console.print("Let's configure your multi-agent architecture.\n")
|
|
552
|
+
|
|
553
|
+
provider_choice = questionary.select(
|
|
554
|
+
"Choose your LLM Provider:",
|
|
555
|
+
choices=["ollama (Local - Recommended)", "vllm (Local)", "openai (API)"],
|
|
556
|
+
).ask()
|
|
557
|
+
|
|
558
|
+
if not provider_choice:
|
|
559
|
+
return False
|
|
560
|
+
|
|
561
|
+
provider_type = provider_choice.split(" ")[0]
|
|
562
|
+
|
|
563
|
+
default_url = "http://localhost:11434/v1"
|
|
564
|
+
default_key = "ollama"
|
|
565
|
+
default_model = "qwen3.5:latest"
|
|
566
|
+
|
|
567
|
+
if provider_type == "vllm":
|
|
568
|
+
default_url = "http://localhost:8000/v1"
|
|
569
|
+
default_key = "EMPTY"
|
|
570
|
+
default_model = "meta-llama/Llama-3-8b-instruct"
|
|
571
|
+
elif provider_type == "openai":
|
|
572
|
+
default_url = "https://api.openai.com/v1"
|
|
573
|
+
default_key = ""
|
|
574
|
+
default_model = "gpt-4o"
|
|
575
|
+
|
|
576
|
+
base_url = questionary.text("Enter the API Base URL:", default=default_url).ask()
|
|
577
|
+
|
|
578
|
+
api_key = questionary.password(
|
|
579
|
+
"Enter API Key (leave default for local Ollama/vLLM unless secured):",
|
|
580
|
+
default=default_key,
|
|
581
|
+
).ask()
|
|
582
|
+
|
|
583
|
+
store_in_keyring = questionary.confirm(
|
|
584
|
+
"Store API key in system keyring (recommended for security)?",
|
|
585
|
+
default=True,
|
|
586
|
+
).ask()
|
|
587
|
+
|
|
588
|
+
if store_in_keyring and api_key and api_key not in ("ollama", "EMPTY", ""):
|
|
589
|
+
try:
|
|
590
|
+
import keyring
|
|
591
|
+
|
|
592
|
+
keyring.set_password("assistant", provider_type, api_key)
|
|
593
|
+
api_key = f"keyring:{provider_type}"
|
|
594
|
+
console.print("[dim]API key stored securely in system keyring[/dim]")
|
|
595
|
+
except Exception as e:
|
|
596
|
+
console.print(
|
|
597
|
+
f"[dim]Could not store in keyring: {e}. Using plain text.[/dim]"
|
|
598
|
+
)
|
|
599
|
+
|
|
600
|
+
model_name = questionary.text(
|
|
601
|
+
"Enter Default Model Name:", default=default_model
|
|
602
|
+
).ask()
|
|
603
|
+
|
|
604
|
+
context_length = questionary.text(
|
|
605
|
+
"Enter model context length (tokens):", default="128000"
|
|
606
|
+
).ask()
|
|
607
|
+
|
|
608
|
+
should_think = questionary.confirm("Enable reasoning?", default=False).ask()
|
|
609
|
+
|
|
610
|
+
web_search_enabled = questionary.confirm(
|
|
611
|
+
"Enable web search (SearXNG)?", default=True
|
|
612
|
+
).ask()
|
|
613
|
+
|
|
614
|
+
if not all([base_url, model_name]):
|
|
615
|
+
return False
|
|
616
|
+
|
|
617
|
+
searxng_url = "http://localhost:8888"
|
|
618
|
+
if web_search_enabled:
|
|
619
|
+
searxng_url = questionary.text(
|
|
620
|
+
"Enter SearXNG URL:", default="http://localhost:8888"
|
|
621
|
+
).ask()
|
|
622
|
+
|
|
623
|
+
cfg = _get_config_instance()
|
|
624
|
+
|
|
625
|
+
cfg.raw = DEFAULT_CONFIG.copy()
|
|
626
|
+
|
|
627
|
+
cfg.raw["provider"] = {provider_type: {"endpoint": base_url, "credential": api_key}}
|
|
628
|
+
|
|
629
|
+
try:
|
|
630
|
+
context_length = int(context_length)
|
|
631
|
+
except (ValueError, TypeError):
|
|
632
|
+
context_length = 128000
|
|
633
|
+
|
|
634
|
+
cfg.raw["model"] = {
|
|
635
|
+
"default": {
|
|
636
|
+
"id": model_name,
|
|
637
|
+
"name": model_name,
|
|
638
|
+
"provider": provider_type,
|
|
639
|
+
"context_length": context_length,
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
cfg.raw["execution"]["think"] = should_think or False
|
|
644
|
+
|
|
645
|
+
for a_id in cfg.raw.get("agent", {}):
|
|
646
|
+
cfg.raw["agent"][a_id]["model"] = "default"
|
|
647
|
+
|
|
648
|
+
cfg.raw["web_search"] = {"enabled": web_search_enabled, "searxng_url": searxng_url}
|
|
649
|
+
|
|
650
|
+
console.print("\n[dim]Initializing multi-agent structure...[/dim]")
|
|
651
|
+
cfg.save()
|
|
652
|
+
console.print(f"[bold green]Configuration saved to {cfg.path}[/bold green]\n")
|
|
653
|
+
return True
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
if __name__ == "__main__":
|
|
657
|
+
run_setup_wizard()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: assistant
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0b2
|
|
4
4
|
Summary: Your very own Assistant. Because you deserve it.
|
|
5
5
|
Home-page: https://gitlab.com/waser-technologies/technologies/assistant
|
|
6
6
|
Author: Danny Waser
|
|
@@ -126,12 +126,12 @@ pacman -S python-assistant
|
|
|
126
126
|
|
|
127
127
|
</details>
|
|
128
128
|
|
|
129
|
-
### 2. Run the
|
|
129
|
+
### 2. Run the Configuration Wizard
|
|
130
130
|
|
|
131
131
|
On the first launch the wizard starts automatically. You can also re-run it at any time:
|
|
132
132
|
|
|
133
133
|
```bash
|
|
134
|
-
assistant
|
|
134
|
+
assistant config
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
The wizard asks you to choose:
|
|
@@ -179,15 +179,18 @@ That's it — you're in. Type commands, ask questions, or mix both.
|
|
|
179
179
|
```text
|
|
180
180
|
assistant --help
|
|
181
181
|
assistant --version
|
|
182
|
-
assistant
|
|
182
|
+
assistant config # (re)run the configuration wizard
|
|
183
183
|
assistant -c "what time is it" # single query, then exit
|
|
184
|
-
assistant -n # skip the intro message
|
|
184
|
+
assistant -n # skip the interactive intro message (warmup)
|
|
185
185
|
assistant Hello Assistant # one-shot query
|
|
186
186
|
assistant # interactive mode
|
|
187
187
|
```
|
|
188
188
|
|
|
189
189
|
### Interactive Mode
|
|
190
190
|
|
|
191
|
+
<!-- [](https://youtu.be/OAgLgq0aGhI?si=8kIrj24neGD8sWec) -->
|
|
192
|
+
[](https://youtu.be/OAgLgq0aGhI?si=8kIrj24neGD8sWec)
|
|
193
|
+
|
|
191
194
|
```text
|
|
192
195
|
waser@host ~
|
|
193
196
|
❯ Hi Assistant.
|
|
@@ -329,7 +332,7 @@ Credentials are resolved in this order:
|
|
|
329
332
|
3. **OpenAI fallback** — for OpenAI provider, also checks `OPENAI_API_KEY` standard env var
|
|
330
333
|
4. **Plain text** — last resort (not recommended)
|
|
331
334
|
|
|
332
|
-
To store credentials securely in your system keyring, use `assistant
|
|
335
|
+
To store credentials securely in your system keyring, use `assistant config` and select "Store in keyring" when prompted, or manually:
|
|
333
336
|
|
|
334
337
|
```python
|
|
335
338
|
import keyring
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import questionary
|
|
2
|
-
from rich.console import Console
|
|
3
|
-
from assistant.config import get_config, DEFAULT_CONFIG
|
|
4
|
-
|
|
5
|
-
console = Console()
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def run_setup_wizard() -> bool:
|
|
9
|
-
"""Run an interactive wizard to create the initial TOML configuration."""
|
|
10
|
-
console.print("\n[bold cyan]Assistant TOML Configuration Wizard[/bold cyan]")
|
|
11
|
-
console.print("Let's configure your multi-agent architecture.\n")
|
|
12
|
-
|
|
13
|
-
provider_choice = questionary.select(
|
|
14
|
-
"Choose your LLM Provider:",
|
|
15
|
-
choices=["ollama (Local - Recommended)", "vllm (Local)", "openai (API)"],
|
|
16
|
-
).ask()
|
|
17
|
-
|
|
18
|
-
if not provider_choice:
|
|
19
|
-
return False
|
|
20
|
-
|
|
21
|
-
provider_type = provider_choice.split(" ")[0]
|
|
22
|
-
|
|
23
|
-
# Defaults based on provider
|
|
24
|
-
default_url = "http://localhost:11434/v1"
|
|
25
|
-
default_key = "ollama"
|
|
26
|
-
default_model = "qwen3.5:latest"
|
|
27
|
-
|
|
28
|
-
if provider_type == "vllm":
|
|
29
|
-
default_url = "http://localhost:8000/v1"
|
|
30
|
-
default_key = "EMPTY"
|
|
31
|
-
default_model = "meta-llama/Llama-3-8b-instruct"
|
|
32
|
-
elif provider_type == "openai":
|
|
33
|
-
default_url = "https://api.openai.com/v1"
|
|
34
|
-
default_key = ""
|
|
35
|
-
default_model = "gpt-4o"
|
|
36
|
-
|
|
37
|
-
base_url = questionary.text("Enter the API Base URL:", default=default_url).ask()
|
|
38
|
-
|
|
39
|
-
api_key = questionary.password(
|
|
40
|
-
"Enter API Key (leave default for local Ollama/vLLM unless secured):",
|
|
41
|
-
default=default_key,
|
|
42
|
-
).ask()
|
|
43
|
-
|
|
44
|
-
store_in_keyring = questionary.confirm(
|
|
45
|
-
"Store API key in system keyring (recommended for security)?",
|
|
46
|
-
default=True,
|
|
47
|
-
).ask()
|
|
48
|
-
|
|
49
|
-
if store_in_keyring and api_key and api_key not in ("ollama", "EMPTY", ""):
|
|
50
|
-
try:
|
|
51
|
-
import keyring
|
|
52
|
-
|
|
53
|
-
keyring.set_password("assistant", provider_type, api_key)
|
|
54
|
-
api_key = f"keyring:{provider_type}"
|
|
55
|
-
console.print("[dim]API key stored securely in system keyring[/dim]")
|
|
56
|
-
except Exception as e:
|
|
57
|
-
console.print(
|
|
58
|
-
f"[dim]Could not store in keyring: {e}. Using plain text.[/dim]"
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
model_name = questionary.text(
|
|
62
|
-
"Enter Default Model Name:", default=default_model
|
|
63
|
-
).ask()
|
|
64
|
-
|
|
65
|
-
context_length = questionary.text(
|
|
66
|
-
"Enter model context length (tokens):", default="128000"
|
|
67
|
-
).ask()
|
|
68
|
-
|
|
69
|
-
should_think = questionary.confirm("Enable reasoning?", default=False).ask()
|
|
70
|
-
|
|
71
|
-
web_search_enabled = questionary.confirm(
|
|
72
|
-
"Enable web search (SearXNG)?", default=True
|
|
73
|
-
).ask()
|
|
74
|
-
|
|
75
|
-
if not all([base_url, model_name]):
|
|
76
|
-
return False
|
|
77
|
-
|
|
78
|
-
searxng_url = "http://localhost:8888"
|
|
79
|
-
if web_search_enabled:
|
|
80
|
-
searxng_url = questionary.text(
|
|
81
|
-
"Enter SearXNG URL:", default="http://localhost:8888"
|
|
82
|
-
).ask()
|
|
83
|
-
|
|
84
|
-
cfg = get_config()
|
|
85
|
-
|
|
86
|
-
# Apply default structure and patch provider/model
|
|
87
|
-
cfg.raw = DEFAULT_CONFIG.copy()
|
|
88
|
-
|
|
89
|
-
cfg.raw["provider"] = {provider_type: {"endpoint": base_url, "credential": api_key}}
|
|
90
|
-
|
|
91
|
-
try:
|
|
92
|
-
context_length = int(context_length)
|
|
93
|
-
except (ValueError, TypeError):
|
|
94
|
-
context_length = 128000
|
|
95
|
-
|
|
96
|
-
cfg.raw["model"] = {
|
|
97
|
-
"default": {
|
|
98
|
-
"id": model_name,
|
|
99
|
-
"name": model_name,
|
|
100
|
-
"provider": provider_type,
|
|
101
|
-
"context_length": context_length,
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
cfg.raw["execution"]["think"] = should_think or False
|
|
106
|
-
|
|
107
|
-
# Re-bind default agents to the "default" model key we just defined
|
|
108
|
-
for a_id in cfg.raw.get("agent", {}):
|
|
109
|
-
cfg.raw["agent"][a_id]["model"] = "default"
|
|
110
|
-
|
|
111
|
-
cfg.raw["web_search"] = {"enabled": web_search_enabled, "searxng_url": searxng_url}
|
|
112
|
-
|
|
113
|
-
console.print("\n[dim]Initializing multi-agent structure...[/dim]")
|
|
114
|
-
cfg.save()
|
|
115
|
-
console.print(f"[bold green]Configuration saved to {cfg.path}[/bold green]\n")
|
|
116
|
-
return True
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if __name__ == "__main__":
|
|
120
|
-
run_setup_wizard()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|