Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
perf(embedding): skip provider calls when queries have no candidates (#720)
Afloat7637e1f614d6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 45ae1604..1bc1e917 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,10 @@ All notable changes to SkillEvaluator are documented in this file.scanning earlier tool calls, reducing reconstruction time for long trajectories.- Tier 3 lift intervals compute faster when every case has the same lift;results are unchanged.+- `EmbeddingRegistry.query` and `query_entry` no longer call the embedding provider+ when the catalog has no eligible entries to compare against.+ These queries return an empty result without constructing the provider+ client, including when that provider is missing or unreachable.### Documentationdiff --git a/src/skillevaluator/embedding/registry.py b/src/skillevaluator/embedding/registry.pyindex 30a35f3c..e256bd27 100644--- a/src/skillevaluator/embedding/registry.py+++ b/src/skillevaluator/embedding/registry.py@@ -417,6 +417,8 @@ class EmbeddingRegistry:_validate_scalar_work(len(entries), vector_dimension, self._max_scalar_comparisons)unit_vectors = _normalized_registry_vectors(entries, vector_dimension)_validate_embedding_text(text, full_body=self._full_body)+ if not entries:+ return []vector = self._client.embed_chunked(text) if self._full_body else self._client.embed_single(text)query_vector = _normalized_vector(vector, vector_dimension or self._vector_dimension)@@ -533,6 +535,8 @@ class EmbeddingRegistry:unit_vectors = _normalized_registry_vectors(catalog_entries, vector_dimension)text = entry.full_text if self._full_body else entry.embedding_text_validate_embedding_text(text, full_body=self._full_body)+ if not any(catalog_entry.entry_id != exclude_entry_id for catalog_entry in catalog_entries):+ return []vector = self._client.embed_chunked(text) if self._full_body else self._client.embed_single(text)query_vector = _normalized_vector(vector, vector_dimension or self._vector_dimension)target_path = Path(entry.path).name or "."diff --git a/tests/embedding/test_registry.py b/tests/embedding/test_registry.pyindex 2a67ddae..8798f04f 100644--- a/tests/embedding/test_registry.py+++ b/tests/embedding/test_registry.py@@ -582,6 +582,73 @@ class TestCachePersistence:class TestQuery:+ @pytest.mark.parametrize("full_body", [False, True])+ @pytest.mark.parametrize("query_method", ["query", "query_entry"])+ def test_empty_registry_does_not_request_embeddings(self, full_body: bool, query_method: str) -> None:+ client = _make_mock_client([[1.0, 0.0]])+ client.embed_single.side_effect = None+ client.embed_single.return_value = [1.0, 0.0]+ client.embed_chunked.return_value = [1.0, 0.0]+ registry = EmbeddingRegistry(client, full_body=full_body)++ if query_method == "query":+ matches = registry.query("Candidate text", threshold=0.75)+ else:+ entry = ContentEntry(+ name="candidate",+ description="Candidate text",+ path="candidate",+ content_type="skill",+ full_text="# Candidate\nCandidate text",+ )+ matches = registry.query_entry(entry, threshold=0.75)++ assert matches == []+ client.embed_single.assert_not_called()+ client.embed_chunked.assert_not_called()++ @pytest.mark.parametrize("full_body", [False, True])+ def test_self_only_catalog_does_not_request_embeddings(self, full_body: bool) -> None:+ client = _make_mock_client([[1.0, 0.0]])+ client.embed_single.side_effect = None+ client.embed_single.return_value = [1.0, 0.0]+ client.embed_chunked.return_value = [1.0, 0.0]+ registry = EmbeddingRegistry(client, full_body=full_body)+ registry._entries["skill:candidate"] = RegistryEntry(+ name="candidate",+ description="Candidate text",+ path="candidate",+ content_type="skill",+ entry_id="skill:candidate",+ embedding=[1.0, 0.0],+ )+ entry = ContentEntry(+ name="candidate",+ description="Candidate text",+ path="candidate",+ content_type="skill",+ full_text="# Candidate\nCandidate text",+ )++ assert registry.query_entry(entry, threshold=0.75, exclude_entry_id="skill:candidate") == []+ client.embed_single.assert_not_called()+ client.embed_chunked.assert_not_called()++ @pytest.mark.parametrize("query_method", ["query", "query_entry"])+ @pytest.mark.parametrize("threshold,text", [(float("nan"), "valid"), (0.75, "x" * 16_385)])+ def test_empty_registry_still_validates_query(self, query_method: str, threshold: float, text: str) -> None:+ client = _make_mock_client([])+ registry = EmbeddingRegistry(client)++ with pytest.raises(ValueError, match=r"threshold|character limit"):+ if query_method == "query":+ registry.query(text, threshold=threshold)+ else:+ entry = ContentEntry(name="candidate", description=text, path="candidate", content_type="skill")+ registry.query_entry(entry, threshold=threshold)++ client.embed_single.assert_not_called()+def test_query_returns_matches_above_threshold(self) -> None:mock_client = _make_mock_client([[1.0, 0.0]])mock_client.embed_single.side_effect = None