Skip to content

Commit a84e6f4

Browse files
Fix implicit string concat and skeleton 404 mapping
Address the review on PR #220. Wrap each retrieval-rag CORPUS passage in parentheses so the multi-line string is an explicit grouped expression, not adjacent string literals implicitly concatenated inside the list (a CodeQL missing-comma footgun in a copy-me example). Add the 404 -> ProviderInvalidModel branch and import to the authoring-guide skeleton's _classify(), which contradicted its own contract checklist.
1 parent 43a901a commit a84e6f4

2 files changed

Lines changed: 35 additions & 16 deletions

File tree

docs/retrieval-providers/authoring.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import httpx
2323

2424
from openarmature.llm import (
2525
ProviderAuthentication,
26+
ProviderInvalidModel,
2627
ProviderInvalidRequest,
2728
ProviderInvalidResponse,
2829
ProviderRateLimit,
@@ -99,6 +100,8 @@ def _classify(resp: httpx.Response) -> Exception:
99100
status = resp.status_code
100101
if status in (401, 403):
101102
return ProviderAuthentication(f"HTTP {status}")
103+
if status == 404:
104+
return ProviderInvalidModel("model not found")
102105
if status == 429:
103106
return ProviderRateLimit("HTTP 429")
104107
if status in (400, 413, 422):

examples/retrieval-rag/main.py

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,38 @@
8484
# self-contained. The passages deliberately overlap in topic so reranking
8585
# has something to disambiguate.
8686
CORPUS: list[str] = [
87-
"The Moon's south pole holds water ice in permanently shadowed crater floors "
88-
"that never see sunlight, a candidate resource for future crews.",
89-
"Apollo 11 landed in the Sea of Tranquility in July 1969; Armstrong and Aldrin "
90-
"spent about two and a half hours walking on the surface.",
91-
"The lunar maria are vast basaltic plains that formed when ancient impact basins "
92-
"flooded with lava, giving the near side its dark patches.",
93-
"A lunar day lasts about 29.5 Earth days, so any point on the surface sees roughly "
94-
"two weeks of sunlight followed by two weeks of night.",
95-
"The Moon is slowly receding from Earth at about 3.8 centimeters per year, measured "
96-
"by bouncing lasers off the retroreflectors Apollo crews left behind.",
97-
"Regolith, the layer of loose dust and broken rock covering the Moon, is abrasive "
98-
"and clings to everything, a persistent hazard for equipment and spacesuits.",
99-
"Apollo 13 aborted its landing after an oxygen tank ruptured; the crew looped around "
100-
"the Moon and returned safely using the lunar module as a lifeboat.",
101-
"Permanently shadowed regions near the poles are among the coldest places in the "
102-
"solar system, cold enough to trap water ice for billions of years.",
87+
(
88+
"The Moon's south pole holds water ice in permanently shadowed crater floors "
89+
"that never see sunlight, a candidate resource for future crews."
90+
),
91+
(
92+
"Apollo 11 landed in the Sea of Tranquility in July 1969; Armstrong and Aldrin "
93+
"spent about two and a half hours walking on the surface."
94+
),
95+
(
96+
"The lunar maria are vast basaltic plains that formed when ancient impact basins "
97+
"flooded with lava, giving the near side its dark patches."
98+
),
99+
(
100+
"A lunar day lasts about 29.5 Earth days, so any point on the surface sees roughly "
101+
"two weeks of sunlight followed by two weeks of night."
102+
),
103+
(
104+
"The Moon is slowly receding from Earth at about 3.8 centimeters per year, measured "
105+
"by bouncing lasers off the retroreflectors Apollo crews left behind."
106+
),
107+
(
108+
"Regolith, the layer of loose dust and broken rock covering the Moon, is abrasive "
109+
"and clings to everything, a persistent hazard for equipment and spacesuits."
110+
),
111+
(
112+
"Apollo 13 aborted its landing after an oxygen tank ruptured; the crew looped around "
113+
"the Moon and returned safely using the lunar module as a lifeboat."
114+
),
115+
(
116+
"Permanently shadowed regions near the poles are among the coldest places in the "
117+
"solar system, cold enough to trap water ice for billions of years."
118+
),
103119
]
104120

105121
# How many candidates cosine retrieval hands to the reranker, and how many

0 commit comments

Comments
 (0)