diff --git a/nbs/00_core.ipynb b/nbs/00_core.ipynb index 882e9a3..2e51568 100644 --- a/nbs/00_core.ipynb +++ b/nbs/00_core.ipynb @@ -618,10 +618,11 @@ "outputs": [], "source": [ "#| export\n", + "default_cfg = asdict(ShellSageConfig())\n", "def get_opts(**opts):\n", " cfg = get_cfg()\n", " for k, v in opts.items():\n", - " if v is None: opts[k] = cfg[k]\n", + " if v is None: opts[k] = cfg.get(k, default_cfg.get(k))\n", " return AttrDict(opts)" ] }, @@ -635,11 +636,11 @@ "data": { "text/markdown": [ "```json\n", - "{'model': 'deepseek-chat', 'provider': 'openai'}\n", + "{'model': 'claude-3-5-sonnet-20241022', 'provider': 'anthropic'}\n", "```" ], "text/plain": [ - "{'provider': 'openai', 'model': 'deepseek-chat'}" + "{'provider': 'anthropic', 'model': 'claude-3-5-sonnet-20241022'}" ] }, "execution_count": null, @@ -1072,6 +1073,14 @@ "main('Teach me about rsync', history_lines=0, s=True)" ] }, + { + "cell_type": "markdown", + "id": "1b4e66a1", + "metadata": {}, + "source": [ + "Here is an example of using a local LLM provider via Ollama:" + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/shell_sage/core.py b/shell_sage/core.py index ea28fc7..d068287 100644 --- a/shell_sage/core.py +++ b/shell_sage/core.py @@ -1,8 +1,8 @@ # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb. # %% auto 0 -__all__ = ['print', 'sp', 'csp', 'ssp', 'clis', 'sps', 'conts', 'p', 'get_pane', 'get_panes', 'tmux_history_lim', 'get_history', - 'get_opts', 'get_sage', 'get_res', 'main'] +__all__ = ['print', 'sp', 'csp', 'ssp', 'default_cfg', 'clis', 'sps', 'conts', 'p', 'get_pane', 'get_panes', 'tmux_history_lim', + 'get_history', 'get_opts', 'get_sage', 'get_res', 'main'] # %% ../nbs/00_core.ipynb 3 from datetime import datetime @@ -164,10 +164,11 @@ def get_history(n, pid='current'): except subprocess.CalledProcessError: return None # %% ../nbs/00_core.ipynb 24 +default_cfg = asdict(ShellSageConfig()) def get_opts(**opts): cfg = get_cfg() for k, v in opts.items(): - if v is None: opts[k] = cfg[k] + if v is None: opts[k] = cfg.get(k, default_cfg.get(k)) return AttrDict(opts) # %% ../nbs/00_core.ipynb 26