Improved generator.py

This commit is contained in:
2026-05-02 17:18:40 +02:00
parent 8194ca3586
commit cbb52a44bb
3 changed files with 67 additions and 7 deletions

View File

@@ -103,16 +103,21 @@ class CandidateGraphGenerator:
capabilities.append(
self._interface_capability(interfaces, tests, examples, docs, chunks)
)
promotable_llm_facts = self._promotable_llm_facts(
llm_providers + provider_registries + fallback_policies
promotable_llm_providers = self._promotable_llm_facts(llm_providers)
promotable_provider_registries = self._promotable_llm_facts(provider_registries)
promotable_fallback_policies = self._promotable_llm_facts(fallback_policies)
promotable_llm_facts = (
promotable_llm_providers
+ promotable_provider_registries
+ promotable_fallback_policies
)
if promotable_llm_facts:
capabilities.append(
self._llm_provider_capability(
llm_providers,
promotable_llm_providers,
credential_configs,
provider_registries,
fallback_policies,
promotable_provider_registries,
promotable_fallback_policies,
tests,
examples,
docs,

View File

@@ -403,3 +403,58 @@ def test_candidate_generator_does_not_promote_llm_provider_mentions_to_capabilit
for capability in graph[0].capabilities
if capability.name == "Route LLM Requests Across Providers"
] == []
def test_candidate_generator_excludes_mention_only_providers_from_promoted_capability():
repository = Repository(
id=1,
name="MixedSignals",
url="/tmp/mixed-signals",
description=None,
branch="main",
status="analyzed",
)
facts = [
fact(1, "documentation", "README", "README.md"),
fact(
2,
"llm_provider",
"OpenRouter",
"src/providers.py",
"openrouter",
{"source_role": "implementation_source", "utility_relationship": "adapter"},
),
fact(
3,
"llm_provider",
"Claude",
"README.md",
"claude",
{"source_role": "product_documentation", "utility_relationship": "mention"},
),
fact(
4,
"provider_registry",
"LLM provider registry",
"src/providers.py",
metadata={"source_role": "implementation_source", "utility_relationship": "adapter"},
),
]
graph = CandidateGraphGenerator().generate(repository, facts)
capability = next(
capability
for capability in graph[0].capabilities
if capability.name == "Route LLM Requests Across Providers"
)
assert "OpenRouter" in capability.description
assert "Claude" not in capability.description
assert {feature.name for feature in capability.features} == {
"Use OpenRouter Models",
"Maintain LLM Provider Registry",
}
assert [ref.path for ref in capability.source_refs] == [
"src/providers.py",
"src/providers.py",
]

View File

@@ -8,7 +8,7 @@ status: active
owner: codex
topic_slug: foerster-capabilities
created: "2026-05-01"
updated: "2026-05-01"
updated: "2026-05-02"
state_hub_workstream_id: "d8f304b3-a30c-4172-99de-19ab84bf330e"
---
@@ -76,7 +76,7 @@ Acceptance criteria:
```task
id: RREG-WP-0009-T02
status: in_progress
status: done
priority: high
state_hub_task_id: "3ef728a0-832f-4441-9ece-16888ef68c47"
```