Skip to content

Incomplete type annotations on public methods degrade generated API docs and expose undeclared internal API #1177

Open

Description

@planetf1

The generated API reference docs for several public classes are missing type
information because the underlying source lacks return-type and parameter
annotations. At the same time, the doc generator surfaces a number of
methods that appear to be internal backend-protocol details rather than
intentional user-facing API — raising a broader question about which symbols
are genuinely exported and which are implementation accidents.

Observed behaviour

Running the autogen pipeline (uv run python tooling/docs-autogen/build.py)
emits griffe warnings for every unannotated public member:

WARNING: No type or annotation for returned value  (mellea.stdlib.session.MelleaSession.reset)
WARNING: No type or annotation for returned value  (mellea.stdlib.session.MelleaSession.powerup)
WARNING: No type or annotation for returned value  (mellea.stdlib.components.instruction.Instruction.parts)
WARNING: No type or annotation for returned value  (mellea.stdlib.components.docs.richdocument.RichDocument.to_markdown)
WARNING: No type or annotation for returned value  (mellea.stdlib.components.docs.richdocument.Table.parts)

Backend protocol methods are also affected across all providers:

Module Affected members
mellea.backends.huggingface LocalHFBackend.processing (params: input_ids, seed), post_processing — 9 issues
mellea.backends.ollama OllamaModelBackend.is_model_available (param + return), processing, post_processing — 5 issues
mellea.backends.openai OpenAIBackend.processing, post_processing (params: thinking, seed) — 4 issues
mellea.backends.litellm LiteLLMBackend.processing, post_processing (param: thinking) — 3 issues
mellea.backends.watsonx WatsonxAIBackend.processing, post_processing (param: seed) — 3 issues
mellea.backends.adapters AdapterMixin.add_adapter, load_adapter, unload_adapter returns — 3 issues
mellea.backends.tools add_tools_from_model_options, add_tools_from_context_actions returns — 2 issues
mellea.formatters.granite ElasticsearchRetriever and related — 27 issues
mellea.telemetry.backend_instrumentation start_generate_span, instrument_generate_from_raw — 2 issues

Because griffe documents anything not prefixed with _, the published API
reference currently includes all of these, with incomplete type information.

Expected behaviour

The API reference accurately reflects the intended public contract:

  • Methods that are part of the user-facing surface (MelleaSession, component
    classes, public backend helpers) should have complete type annotations so the
    generated docs show full signatures.
  • Methods that are internal backend-protocol details (processing,
    post_processing) should either be annotated (if truly public) or excluded
    from the generated docs (if internal). __all__ declarations and/or a
    leading underscore convention would make the distinction machine-checkable.

Broader concern: what is the public API?

The project does not currently declare __all__ in most modules, so griffe
documents every non-underscore symbol it finds. This means the published API
reference includes implementation details that are not part of the stable
contract — processing() and post_processing() on backend classes are the
clearest example. Users reading the docs cannot tell which methods are safe to
call and which are framework-internal.

Deciding and encoding the public surface (via __all__, underscore prefixes, or
a similar mechanism) would:

  • shrink the generated docs to the intended contract
  • eliminate the griffe warnings as a side-effect
  • make it easier to apply the docstring quality gate (--fail-on-quality) to
    the right set of symbols

Reproduction

uv sync --all-extras --group dev
uv run python tooling/docs-autogen/build.py 2>&1 | grep "No type"

Activity

  1. added
    documentation
    area/backends
    area/stdlib
    on Jun 1, 2026
  2. yehorcallmedai-maker commented on Jun 11, 2026

    @yehorcallmedai-maker
    Contributor

    Would you accept a focused PR adding annotations to the mellea.stdlib layer only — the 5 warnings on MelleaSession and the component classes? That's a safe scope since those are clearly user-facing. The backend protocol methods and all question can stay as a follow-up once the public surface is decided.

  3. planetf1 commented on Jun 12, 2026

    @planetf1
    ContributorAuthor

    Thanks @yehorcallmedai-maker sure - Just don't use the 'Fixes #xxxx' in the PR so it doesn't autoclose and just mention as a partial fix. Or create a new issue with the followon changes - either is fine.

  4. added
    p2
    on Jun 18, 2026
  5. AngeloDanducci commented on Nov 18, 2026

    @AngeloDanducci
    Contributor

    Verify the list of items, however the intent is still valid. There is a related internal hardening issue, cc @ajbozarth just in case you remember what the related issue was.

  6. ajbozarth commented on Nov 18, 2026

    @ajbozarth
    Member

    I could not find the Issue for tracking hardening the public API, it may have been on a roadmap slide Nathan shared at some point rather than an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/backendsarea/stdlibdocumentationp2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions