Skip to content

docs: fix stale ModelAPI docstrings (nonexistent api_key_vars / ChatUserMessage) - #1634

Merged
Yunnglin merged 1 commit into
modelscope:mainfrom
BingH225:fix/modelapi-docstring
Aug 26, 2026
Merged

docs: fix stale ModelAPI docstrings (nonexistent api_key_vars / ChatUserMessage)#1634
Yunnglin merged 1 commit into
modelscope:mainfrom
BingH225:fix/modelapi-docstring

Conversation

@BingH225

Copy link
Copy Markdown
Contributor

Description

Two stale docstrings in the ModelAPI base class describe an API that does not exist:

  1. ModelAPI.__init__ documents an api_key_vars parameter that is not in the
    signature. grep -rn "api_key_vars" matches only this docstring — the
    parameter does not exist anywhere in the codebase.
  2. ModelAPI.generate documents input as str | list[ChatMessage] and claims a
    str is converted to a ChatUserMessage. But:
    • the signature is input: List[ChatMessage] and does not accept str;
    • str -> message conversion happens one layer up in Model._preprocess_input,
      not in this base class;
    • ChatUserMessage does not exist; the actual class is ChatMessageUser
      (433 occurrences), so the name in the docstring is wrong as well.

Both appear to be leftovers from the upstream inspect-ai API.

Test

Docstring only, no behavior change.

  • make lint equivalents pass: ruff check evalscope/api/model/model.py reports no new
    findings vs. the unmodified baseline; yapf --diff -> empty
  • python -m py_compile passes
  • No auto-generated files touched (docs/{zh,en}/benchmarks/, evalscope/benchmarks/_meta/)

- ModelAPI.__init__ documented an `api_key_vars` parameter that does not
  exist in the signature or anywhere else in the codebase
- ModelAPI.generate documented `input` as `str | list[ChatMessage]`, but the
  signature only accepts `list[ChatMessage]`; the str conversion happens in
  Model._preprocess_input, and the referenced `ChatUserMessage` class does
  not exist (the actual class is `ChatMessageUser`)

Co-authored-by: Claude <noreply@anthropic.com>

@Yunnglin Yunnglin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Yunnglin
Yunnglin merged commit bca26a4 into modelscope:main Aug 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants