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

Function getPythonTransformFunction

src/util/transform.ts:100–107  ·  view source on GitHub ↗

* Creates a function that runs a Python transform function. * @param filePath - The path to the Python file. * @param functionName - The name of the function to run (defaults to 'get_transform'). * @returns A function that executes the Python transform.

(
  filePath: string,
  functionName: string = 'get_transform',
)

Source from the content-addressed store, hash-verified

98 * @returns A function that executes the Python transform.
99 */
100function getPythonTransformFunction(
101 filePath: string,
102 functionName: string = 'get_transform',
103): Function {
104 return async (output: string, context: { vars: Vars }) => {
105 return runPython(filePath, functionName, [output, context]);
106 };
107}
108
109/**
110 * Retrieves a transform function from a file, supporting both JavaScript and Python.

Callers 1

getFileTransformFunctionFunction · 0.85

Calls 1

runPythonFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…