feat(adapters): extend prompt fallback to the OpenAI and Ollama backends
Maintainer thường phản hồi trong vòng 3 ngày
@ajbozarth đang làm issue này rồi.
Từ ngày 19/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
#1654 added prompt fallback for adapter functions on the LocalHF backend and closes #993 as that slice. Extend the same capability to the two served-adapter backends, OpenAI and Ollama, so an adapter function can fall back to a hand-authored prompt when no trained or embedded adapter exists for the model.
This is wanted on both backends; the implementation design is open. The LocalHF work was deliberately scoped to land first, with the served backends split out to this follow-up.
Firm constraint: a fallback must register at the resolve layer
The one thing already settled, because it follows from #1654's shipped design. The high-level helpers (rag.check_answerability, core.requirement_check, …) call backend.resolve_adapter(name) before generating, so a fallback is reachable through the documented API only if resolve_adapter registers it — hooking generation alone is not enough.
For OpenAI this is sharp: resolve_adapter takes the embedded-discovery branch (_uses_embedded_adapters = True), and for a model with no published embedded adapter, discovery registers nothing and resolve_adapter raises before generation runs. A generation-time-only fallback would be unreachable via the helpers — it would fire only on the low-level mfuncs.act(Intrinsic(...)) path.
Reusable pieces #1654 already provides:
PromptBinding(weightlessWeightsBinding),AdapterType.PROMPT, widenedIdentity.adapter_type—_core.py.resolve_prompt_io_yaml(...)and theadapter_typeparam onadapter_subpath/obtain_io_yaml—intrinsics/util.py(model-specific →any, with the sub-par warning).- The invocation-complete telemetry helpers — OpenAI's embedded path already uses them.
Current seams (for scoping)
Where a fallback would hook, as the code stands on this branch:
- OpenAI (
openai.py):add_adapteraccepts onlyEmbeddedBinding; resolution runs through the sharedAdapterMixin.resolve_adapterembedded branch (no availability walk);_generate_from_intrinsicdispatches embedded adapters by editing the request. A trainedLocalFileBindingcannot be loaded by a remote backend, so only the prompt path is relevant here. - Ollama (
ollama.py, adapter support added in #1634): overridesresolve_adapter/_resolve_adapter_uncoalesced, which raises when a capability has noadapter_modelstag;add_adapterrequiresServerMediatedBinding.
Design questions to settle
- Validity, per capability. A prompt fallback is base-model prompting, the same class as LLM-as-a-judge. On a served model with no trained adapter — the headline case — the comparison is "prompt fallback vs. nothing," so it is useful where it works; but for some capabilities a purpose-authored prompt with a constrained schema may not be reliable enough to present as an adapter-function result. Decide which capabilities clear that bar.
- Ollama feasibility. Unconfirmed whether the transform/rewriter path works for a plain Ollama base-model prompt (an earlier look flagged message-format support as a possible blocker). If it does not, Ollama is a larger effort than OpenAI and the two may want sequencing separately.
- OpenAI hook point. Extend the shared
AdapterMixin.resolve_adapterembedded branch, or anOpenAIBackend-local override (as Ollama does)? Either touches shared code. - Shared helper. Whether to extract a prompt-only resolve helper (
resolve_prompt_io_yaml→PromptBinding-composedAdapter→add_adapter(config=...)) shared across backends, or let each implement its own. - Ollama telemetry. Whether invocation-complete telemetry is wired for Ollama (its docstrings note that as outstanding) so a prompt path reports consistently with the other backends.
Docs / tests
docs/docs/advanced/intrinsics.mddescribes backend coverage in a prose backend note, and its prompt-fallback section is LocalHF-framed; both need updating once a backend gains support.- Mirror #1654's per-backend unit coverage (PromptBinding dispatch + resolve registration). For any e2e, reuse the access-guard pattern in
test/backends/test_adapters/test_adapter_resolution_e2e.pyand the public-repo retarget tracked in #1655.
Related
- #993 — the prompt-fallback feature (closed by #1654, LocalHF slice).
- #1654 — the LocalHF implementation this extends.
- #1634 — Ollama adapter-function support (prerequisite, merged).
- #1655 — retarget e2e off the temporary private fixture repo.
- Ngôn ngữ chính
- Python
- Star
- 1.8k
- Fork
- 161
- Merge trung bình
- 4 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 45
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của generative-computing/mellea
-
bug: `mellea.plugins.builtin_debug.generation.log_generation_post_call` shows model as unknownĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
generative-computing/mellea#1864 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug: instruct() and react() replay tool-call turns without tool_callsCó thể đã có người làm @simonyang08 đã nhận 21 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
generative-computing/mellea#1784 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Silently mangled docstrings: lone backslash line-continuations in non-raw docstrings collapse command examplesCó thể đã có người làm @madhusudhan1260 đã nhận 18 ngày trước. Đang mởgood first issue p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
generative-computing/mellea#1780 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 3 ngày
-
area/telemetry enhancement p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
generative-computing/mellea#1210 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Add requirement priorityĐang mởarea/requirement area/stdlib enhancement p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
generative-computing/mellea#31 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của generative-computing/mellea
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
OpenFreeEnergy/openfe#2371 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
HMDB's smiles file writes "None" for metabolites with an empty <smiles/> (file not currently used)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
NCATSTranslator/Babel#1269 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
404 on sample dataĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
bcgov/nr-hydrometric-rating-curve#443 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100