Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions nbs/00_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
]
},
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions shell_sage/core.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down