generated from coulomb/repo-seed
Ability naming builds on INTENT.md
This commit is contained in:
@@ -268,9 +268,50 @@ class RegistryService:
|
||||
extracted = self.llm_extractor.extract(repository, chunks)
|
||||
if extracted:
|
||||
llm_candidates = self.llm_mapper.map(extracted, facts, chunks)
|
||||
return llm_candidates + deterministic, "llm+deterministic"
|
||||
return (
|
||||
self._merge_llm_candidates(llm_candidates, deterministic),
|
||||
"llm+deterministic",
|
||||
)
|
||||
return deterministic, "deterministic"
|
||||
|
||||
def _merge_llm_candidates(
|
||||
self,
|
||||
llm_candidates: list,
|
||||
deterministic: list,
|
||||
) -> list:
|
||||
if not deterministic:
|
||||
return [
|
||||
ability
|
||||
for ability in llm_candidates
|
||||
if self._candidate_ability_has_trusted_sources(ability)
|
||||
]
|
||||
|
||||
merged_deterministic = list(deterministic)
|
||||
trusted_llm = []
|
||||
folded_capabilities = []
|
||||
for ability in llm_candidates:
|
||||
if self._candidate_ability_has_trusted_sources(ability):
|
||||
trusted_llm.append(ability)
|
||||
else:
|
||||
folded_capabilities.extend(ability.capabilities)
|
||||
|
||||
if folded_capabilities:
|
||||
target = merged_deterministic[0]
|
||||
merged_deterministic[0] = replace(
|
||||
target,
|
||||
capabilities=[*target.capabilities, *folded_capabilities],
|
||||
)
|
||||
return [*trusted_llm, *merged_deterministic]
|
||||
|
||||
def _candidate_ability_has_trusted_sources(self, ability) -> bool:
|
||||
if not ability.source_refs:
|
||||
return False
|
||||
return any(
|
||||
ref.kind in {"intent", "documentation", "interface", "test", "example"}
|
||||
and not ref.path.lower().endswith("scope.md")
|
||||
for ref in ability.source_refs
|
||||
)
|
||||
|
||||
def list_analysis_runs(self, repository_id: int) -> list[AnalysisRun]:
|
||||
return self.store.list_analysis_runs(repository_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user