simonw / simonw/llm

IndexError on Windows for llm chat

Open
#474 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
12.5k
Forks
998
Avg merge
3d 13h
Merged PRs (30d)
10

Description

This is Python 3.12.0 on Windows 11 in a venv with "pip install llm llm-gpt4all".

llm -m Meta-Llama-3-8B-Instruct "What's a double dual?" works, but "llm chat -m Meta-Llama-3-8B-Instruct" results in:

(llm) C:\th\llm>llm chat -m Meta-Llama-3-8B-Instruct
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\th\llm\Scripts\llm.exe_main
.py", line 7, in
File "C:\th\llm\Lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\th\llm\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\th\llm\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\th\llm\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\th\llm\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\th\llm\Lib\site-packages\llm\cli.py", line 345, in chat
readline.parse_and_bind("\e[D: backward-char")
File "C:\th\llm\Lib\site-packages\pyreadline3\rlmain.py", line 112, in parse_and_bind
self.mode._bind_key(key, func)
File "C:\th\llm\Lib\site-packages\pyreadline3\modes\basemode.py", line 181, in _bind_key
keyinfo = make_KeyPress_from_keydescr(key.lower()).tuple()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\th\llm\Lib\site-packages\pyreadline3\keysyms\common.py", line 138, in make_KeyPress_from_keydescr
raise IndexError("Not a valid key: '%s'" % keydescr)
IndexError: Not a valid key: '\e[d'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the chat command in llm/cli.py, especially the readline.parse_and_bind call shown in the traceback. Reproduce the issue with llm chat -m Meta-Llama-3-8B-Instruct on Windows 11, then verify that the command starts without the IndexError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.