MVP 0.95
This commit is contained in:
1 parent
4f37991ad1
commit
be11f82f84
39 files changed
+2490
-239
No files matched your search
@@ -483,6 +483,64 @@ def main() -> None:
|
||||
expect((third.json().get("trace") or {}).get("writing_profile", {}).get("present") is True, "confirmed profile is marked present")
|
||||
expect(sum(1 for item in (third.json().get("run_log") or []) if item.get("kind") == "model_call") == 1, "profile A/B still uses one generate call")
|
||||
|
||||
kept_body = (
|
||||
"Die Kinder verstanden kein Wort. Später fragte ich, "
|
||||
"ob die Kinder überhaupt Deutsch verstehen. Die Kinder lachten."
|
||||
)
|
||||
|
||||
def keep_groups(_messages, _policy):
|
||||
return ChatResult(
|
||||
content=f"Markttag\n\n{kept_body}",
|
||||
model="fake",
|
||||
usage={},
|
||||
context_compression="disabled",
|
||||
)
|
||||
|
||||
with patch("privacy_gateway.complete_model", keep_groups):
|
||||
kept = client.post(
|
||||
f"/api/journal/days/{day.json()['day']['id']}/generate",
|
||||
headers=headers,
|
||||
json={"conversation_ids": [conv.json()["id"]]},
|
||||
)
|
||||
expect(kept.status_code == 200, f"accepted model text {kept.text}")
|
||||
expect(kept.json().get("title") == "Markttag", "title split stays technical")
|
||||
expect(kept.json().get("body") == kept_body, "stored body equals demasked model body")
|
||||
expect("Er" not in (kept.json().get("body") or "").split(), "generic group is not rewritten to a pronoun")
|
||||
stored = f"{kept.json().get('title')}\n\n{kept.json().get('body')}".strip()
|
||||
expect((kept.json().get("trace") or {}).get("reply") == stored, "trace reply is the stored draft")
|
||||
expect((kept.json().get("trace") or {}).get("stored_body") == kept_body, "trace stores the same body")
|
||||
expect((kept.json().get("trace") or {}).get("generate_calls") == 1, "accepted text still uses one generate call")
|
||||
|
||||
def mixed_surface(_messages, _policy):
|
||||
body = (
|
||||
"Die Gruppe verstand kein Wort. "
|
||||
"Später die Gruppe wieder. "
|
||||
"die Gruppen standen abseits."
|
||||
)
|
||||
return ChatResult(
|
||||
content=f"Markttag\n\n{body}",
|
||||
model="fake",
|
||||
usage={},
|
||||
context_compression="disabled",
|
||||
)
|
||||
|
||||
with patch("privacy_gateway.complete_model", mixed_surface):
|
||||
mixed = client.post(
|
||||
f"/api/journal/days/{day.json()['day']['id']}/generate",
|
||||
headers=headers,
|
||||
json={"conversation_ids": [conv.json()["id"]]},
|
||||
)
|
||||
expect(mixed.status_code == 200, f"mixed surface generate {mixed.text}")
|
||||
mixed_body = mixed.json().get("body") or ""
|
||||
expect(mixed_body.startswith("Die Gruppe verstand"), "journal stores sentence-initial model casing")
|
||||
expect("Später die Gruppe wieder" in mixed_body, "journal keeps mid-sentence model casing")
|
||||
expect("die Gruppen standen" in mixed_body, "journal keeps unmatched plural surface form")
|
||||
mixed_stored = f"{mixed.json().get('title')}\n\n{mixed_body}".strip()
|
||||
expect((mixed.json().get("trace") or {}).get("reply") == mixed_stored, "journal trace reply is the stored draft")
|
||||
expect((mixed.json().get("trace") or {}).get("stored_body") == mixed_body, "journal stored_body matches the draft")
|
||||
expect("Die Gruppe verstand" in ((mixed.json().get("trace") or {}).get("raw") or ""), "journal trace raw keeps provider casing")
|
||||
expect((mixed.json().get("trace") or {}).get("generate_calls") == 1, "mixed surface still uses one generate call")
|
||||
|
||||
def invent_title(_messages, _policy):
|
||||
return ChatResult(
|
||||
content="Hanna am Hafen\n\nIch ging zum Markt, auf dem es ziemlich voll war.",
|
||||
|
||||
Reference in new issue
Block a user