design(adapters): IOContract.build_prompt is unimplemented and uncalled everywhere — decide whether to finish it or remove it

オープン
#1,644 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

Start with mellea/stdlib/components/intrinsic/_core.py and inspect the IOContract interface, then trace the generation paths and concrete contract implementations named in the issue, including mellea/backends/huggingface.py. First establish whether any prompt-building call sites exist; done means making and documenting a decision to implement build_prompt consistently or remove it from the interface. This requires maintainer agreement on scope.

索引モデルが issue の本文から書いたものです。

説明

area/adapter-functions area/backends needs-design p2 refactor
Problem

Epic #929 migrated several capabilities onto IOContract (rag.py, guardian.py, requirement_check — Phase 1, #1136–#1139, #1332), but only the output side of the contract actually got wired through. parse() is called from real code:

# mellea/stdlib/components/intrinsic/_util.py:252
return adapter.io_contract.parse(result_str)

and its own follow-up issue (#1516) formalised that path properly.

build_prompt() never got the matching treatment. It's abstract on IOContract (_core.py:141), and every concrete subclass either raises NotImplementedError (_DictContract/_ListContract) or is a placeholder that says outright it isn't used:

# mellea/backends/huggingface.py:3234, on _UnusedIOContract
def build_prompt(self, **kwargs: object) -> Component:
    raise NotImplementedError(
        "not used on the intrinsic generation path: "
        "_generate_from_intrinsic builds prompts via IntrinsicsRewriter."
    )

A repo-wide search for .build_prompt( finds zero call sites — not just for intrinsics, for any capability. So the epic went half-way: the output side got unified, the input side didn't, and nothing ever decided whether it should be.

Why this matters now

Three independent pieces of adapter work have each run into this and each deliberately routed around it rather than resolve it:

  • Discussion #1486 rejects folding activation/reformatting into build_prompt.
  • Issue #1633 (ServerMediatedBinding semantics) explicitly says its work "does not migrate raw io.yaml execution into IOContract."
  • Issue #993 (prompt-based fallback adapters) is reusing IntrinsicsRewriter rather than implementing build_prompt, for the same reason the other two gave.

Three in a row correctly declining to touch it means the gap itself needs a decision, not another workaround.

Ask

Decide one of:

  1. Finish it. File the input-side equivalent of #1516: _generate_from_intrinsic (and the other generation paths) would call adapter.io_contract.build_prompt(**kwargs) instead of instantiating IntrinsicsRewriter directly, and every IOContract subclass gets a real implementation instead of a stub or a raise.
  2. Remove it. Drop build_prompt from the IOContract abstract interface and document that prompt construction is intentionally out of scope for it — IOContract becomes an output-parsing contract only, closing the asymmetry the other way.

No urgency — not blocking #993 or #1633. Filed so the gap is tracked rather than rediscovered by the next person who bumps into it.

主要言語
Python
スター
1.8k
フォーク
161
平均マージ
4日 3時間
マージ済み PR(30日)
45

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

generative-computing/mellea のほかの issue

generative-computing/mellea の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。