Skip to content

Graphorin API reference v0.4.0


Graphorin API reference / @graphorin/memory / / parseGrade

Function: parseGrade()

ts
function parseGrade(text): RetrievalGrade;

Defined in: packages/memory/src/search/iterative.ts:266

Parse a grader model output into a RetrievalGrade. Tolerates a bare JSON object, a fenced block, and chatty text around the object.

Fail-safe = stop. When the verdict can't be read (undefined / empty / unparseable / missing sufficient), returns { sufficient: true, confidence: 0, reformulation: null } so a broken grader degrades to a single pass rather than looping or falsely abstaining. A parsed sufficient: false (a real insufficiency verdict) is preserved.

Parameters

ParameterType
textstring | undefined

Returns

RetrievalGrade

Stable