LLM returns a flat array instead of dict — treated as all create.
(self, tmp_path)
| 2042 | |
| 2043 | @pytest.mark.asyncio |
| 2044 | async def test_fallback_list_format(self, tmp_path): |
| 2045 | """LLM returns a flat array instead of dict — treated as all create.""" |
| 2046 | wiki = self._setup_wiki(tmp_path) |
| 2047 | |
| 2048 | plan_response = json.dumps( |
| 2049 | [ |
| 2050 | {"name": "attention", "title": "Attention"}, |
| 2051 | ] |
| 2052 | ) |
| 2053 | concept_page_response = json.dumps( |
| 2054 | { |
| 2055 | "brief": "A mechanism for focusing", |
| 2056 | "content": "# Attention\n\nA mechanism for focusing.", |
| 2057 | } |
| 2058 | ) |
| 2059 | |
| 2060 | system_msg = {"role": "system", "content": "You are a wiki agent."} |
| 2061 | doc_msg = {"role": "user", "content": "Document content."} |
| 2062 | summary = "Summary." |
| 2063 | |
| 2064 | with patch("openkb.agent.compiler.litellm") as mock_litellm: |
| 2065 | mock_litellm.completion = MagicMock(side_effect=_mock_completion([plan_response])) |
| 2066 | mock_litellm.acompletion = AsyncMock( |
| 2067 | side_effect=_mock_acompletion([concept_page_response]) |
| 2068 | ) |
| 2069 | await _compile_concepts( |
| 2070 | wiki, |
| 2071 | tmp_path, |
| 2072 | "gpt-4o-mini", |
| 2073 | system_msg, |
| 2074 | doc_msg, |
| 2075 | summary, |
| 2076 | "test-doc", |
| 2077 | 5, |
| 2078 | ) |
| 2079 | |
| 2080 | # Verify concept was created (not updated) |
| 2081 | att_path = wiki / "concepts" / "attention.md" |
| 2082 | assert att_path.exists() |
| 2083 | att_text = att_path.read_text() |
| 2084 | assert 'sources: ["summaries/test-doc.md"]' in att_text |
| 2085 | assert "Attention" in att_text |
| 2086 | |
| 2087 | |
| 2088 | class TestBriefIntegration: |
nothing calls this directly
no test coverage detected