MCPcopy Index your code
hub / github.com/promptfoo/promptfoo / validateClassificationResult

Function validateClassificationResult

src/providers/pythonCompletion.ts:143–154  ·  view source on GitHub ↗
(functionName: string, result: any)

Source from the content-addressed store, hash-verified

141}
142
143function validateClassificationResult(functionName: string, result: any): void {
144 if (
145 !hasPythonResultProperty(result, 'classification') &&
146 !hasPythonResultProperty(result, 'error')
147 ) {
148 throw new Error(
149 `The Python script \`${functionName}\` function must return a dict with an own \`classification\` object or \`error\` string (inherited prototype properties are rejected), instead of ${JSON.stringify(
150 result,
151 )}`,
152 );
153 }
154}
155
156function validatePythonScriptResult(
157 apiType: PythonApiType,

Callers 1

Calls 1

hasPythonResultPropertyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…