simonw / simonw/llm

Error handling extra-openai-models.yaml

Open Beginner friendly
#333 3 comments 0 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

The documentation for adding additional OpenAI models gives this example of adding a model by its ID to extra-openai-models.yaml:

- model_id: gpt-3.5-turbo-0613
  aliases: ["0613"]

But if you try to use that llm will get an error, because there it has no model_name.

The real problem is that line 50 of openai_models.py is model_name = extra_model["model_name"] which tries to directly access the "model_name" key, instead of model_name = extra_model.get("model_name") which safely handles failure.

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 at line 50 of openai_models.py and compare the direct model_name lookup with the documented entry in extra-openai-models.yaml. Verify that the example containing only model_id and aliases can be used without the current error, and that missing model_name is handled safely.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.