llm icon indicating copy to clipboard operation
llm copied to clipboard

OpenAI Model's model_name key missing (and new gpt-4-turbo-2024-04-09)

Open gastonmorixe opened this issue 2 months ago • 0 comments

Without model_name llm crashes. Today OpenAI released gpt-4-turbo-2024-04-09 and gpt-4-turbo is pointing to it but without adding a custom model to the config it's not possible to use it.

From OpenAI's Models Docs

  • gpt-4-turbo (new) New GPT-4 Turbo with Vision The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09. 128,000 tokens. Up to Dec 2023

  • gpt-4-turbo-2024-04-09 (new) GPT-4 Turbo with Vision model. Vision requests can now use JSON mode and function calling. gpt-4-turbo currently points to this version. 128,000 tokens. Up to Dec 2023

Crash log:

❯ OPENAI_LOG=debug LLM_OPENAI_SHOW_RESPONSES=true llm models
Traceback (most recent call last):
  File "/Users/gastonmorixe/.local/bin/llm", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/llm/cli.py", line 799, in models_list
    for model_with_aliases in get_models_with_aliases():
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/llm/__init__.py", line 80, in get_models_with_aliases
    pm.hook.register_models(register=register)
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/pluggy/_hooks.py", line 493, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/pluggy/_manager.py", line 115, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/pluggy/_callers.py", line 113, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/pluggy/_callers.py", line 77, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gastonmorixe/.local/pipx/venvs/llm/lib/python3.12/site-packages/llm/default_plugins/openai_models.py", line 49, in register_models
    model_name = extra_model["model_name"]
                 ~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'model_name'

gastonmorixe avatar Apr 10 '24 00:04 gastonmorixe