mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-10 12:37:55 +01:00
test(evals): separate coordinated current skill assertions
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
c59ac9d398
commit
78890012ab
2 files changed
+20
-2
No files matched your search
@@ -452,3 +452,21 @@ it.each(["recovered", "missing"] as const)("does not let later collision history
|
||||
expect(gradeTeamConditions(o, phase === 0 ? "initial" : "complete").passed).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
it.each(["recovered", "missing"] as const)("checks a coordinated current assertion after history when state is %s", state => {
|
||||
for (const phase of [0, 1]) {
|
||||
const o = state === "recovered" ? recovered().o : valid();
|
||||
const body = state === "recovered"
|
||||
? "Launch Checklist was not installed earlier, and it is still missing now."
|
||||
: "Launch Checklist was unavailable earlier, and it is installed now.";
|
||||
o.phaseReplies[phase]!.body = "The existing CTO was preserved and the imported role is CTO 2. "
|
||||
+ (state === "missing" ? "Launch Checklist's slug is occupied. " : "") + body;
|
||||
expect(gradeTeamConditions(o, phase === 0 ? "initial" : "complete").passed).toBe(false);
|
||||
}
|
||||
});
|
||||
it("preserves a fronted historical adverb on the named skill assertion", () => {
|
||||
const { o } = recovered();
|
||||
o.phaseReplies[0]!.body = "The existing CTO was preserved and the imported role is CTO 2. Earlier, Launch Checklist was not installed.";
|
||||
expect(gradeTeamConditions(o, "initial").passed).toBe(true);
|
||||
});
|
||||
@@ -181,13 +181,13 @@ function namedTeamSkillClauses(reply: string, skill: Pick<CatalogSkill, "slug" |
|
||||
const bound: string[] = [];
|
||||
for (const paragraph of reply.split(/\n\s*\n/)) {
|
||||
let previousNamesTarget = false;
|
||||
for (const rawClause of paragraph.split(/[.!?;\n]+|(?=\bbut\b)|(?=\band\s+(?:is|are|remains?|has been)\b)/i).map(text => text.trim()).filter(Boolean)) {
|
||||
for (const rawClause of paragraph.split(/[.!?;\n]+|(?=\bbut\b)|(?=\band\s+(?:(?:it|(?:this|that) skill)\s+)?(?:is|are|was|were|remains?|has|have|could|can)\b)/i).map(text => text.trim()).filter(Boolean)) {
|
||||
const coordinated = /^(?:but|and)\b/i.test(rawClause);
|
||||
const clause = rawClause.replace(/^(?:but|and)\s+/i, "");
|
||||
const named = names.some(name => clause.toLowerCase().includes(name));
|
||||
const reference = /^(?:it|(?:this|that) skill|(?:the )?(?:collision|conflict|caveat))\b/i;
|
||||
const pronoun: boolean = previousNamesTarget && reference.test(clause);
|
||||
const elidedSubject: boolean = coordinated && previousNamesTarget && /^(?:is|are|remains?|has been)\b/i.test(clause);
|
||||
const elidedSubject: boolean = coordinated && previousNamesTarget && /^(?:is|are|was|were|remains?|has|have|could|can)\b/i.test(clause);
|
||||
if (named || pronoun || elidedSubject) bound.push(pronoun ? clause.replace(reference, skill.name) : elidedSubject ? skill.name + " " + clause : clause);
|
||||
previousNamesTarget = named || continuePronouns && (pronoun || elidedSubject);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user