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

Function hasPythonResultError

src/providers/pythonCompletion.ts:99–111  ·  view source on GitHub ↗
(result: any)

Source from the content-addressed store, hash-verified

97}
98
99function hasPythonResultError(result: any): boolean {
100 // Must stay consistent with validateCallApiResult's own-property check:
101 // loosening this to `'error' in result` without also loosening validation
102 // would let a script return an error on the prototype chain, pass validation
103 // via an own `output`, and then be cached as a successful result — a
104 // cache-poisoning vector.
105 return (
106 hasPythonResultProperty(result, 'error') &&
107 result.error !== null &&
108 result.error !== undefined &&
109 result.error !== ''
110 );
111}
112
113function validateCallApiResult(functionName: string, result: any): void {
114 // Log result structure for debugging

Callers 1

executePythonScriptMethod · 0.85

Calls 1

hasPythonResultPropertyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…