courses icon indicating copy to clipboard operation
courses copied to clipboard

I want some help in writing prompt function!

Open jaybfn opened this issue 1 year ago • 0 comments
trafficstars

I created a function called simple_prompt(review, rating) and better_prompt(review, rating), but when I run this function from my prompts.py script I am landing with an error. Can anyone help me here?

"Traceback (most recent call last):░░░░░░░] 0% | ETA: 0s | 0/3 | "" File "C:\Users\JB06216\AppData\Local\npm-cache\_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\python\wrapper.py", line 39, in <module> result = call_method(script_path, method_name, *data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\JB06216\AppData\Local\npm-cache\_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\python\wrapper.py", line 28, in call_method return method_to_call(*args) ^^^^^^^^^^^^^^^^^^^^^ TypeError: better_prompt() missing 1 required positional argument: 'rating' Traceback (most recent call last): File "C:\Users\JB06216\AppData\Local\npm-cache\_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\python\wrapper.py", line 39, in <module> result = call_method(script_path, method_name, *data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\JB06216\AppData\Local\npm-cache\_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\python\wrapper.py", line 28, in call_method return method_to_call(*args) ^^^^^^^^^^^^^^^^^^^^^ TypeError: simple_prompt() missing 1 required positional argument: 'rating' Traceback (most recent call last): File "C:\Users\JB06216\AppData\Local\npm-cache\_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\python\wrapper.py", line 39, in <module> result = call_method(script_path, method_name, *data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\JB06216\AppData\Local\npm-cache\_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\python\wrapper.py", line 28, in call_method return method_to_call(*args) ^^^^^^^^^^^^^^^^^^^^^ TypeError: simple_prompt() missing 1 required positional argument: 'rating' Error running Python script: TypeError: better_prompt() missing 1 required positional argument: 'rating' Stack Trace: Error: TypeError: better_prompt() missing 1 required positional argument: 'rating' at PythonShell.parseError (C:\Users\JB06216\AppData\Local\npm-cache\_npx\81bbc6515d992ace\node_modules\python-shell\index.js:303:21) at terminateIfNeeded (C:\Users\JB06216\AppData\Local\npm-cache\_npx\81bbc6515d992ace\node_modules\python-shell\index.js:193:32) at ChildProcess.<anonymous> (C:\Users\JB06216\AppData\Local\npm-cache\_npx\81bbc6515d992ace\node_modules\python-shell\index.js:185:13) at ChildProcess.emit (node:events:519:28) at ChildProcess._handle.onexit (node:internal/child_process:294:12) --Python Traceback: -- File "C:\Users\JB06216\AppData\Local\npm-cache\_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\python\wrapper.py", line 39, in <module> result = call_method(script_path, method_name, *data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\JB06216\AppData\Local\npm-cache\_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\python\wrapper.py", line 28, in call_method return method_to_call(*args) ^^^^^^^^^^^^^^^^^^^^^ Error removing C:\Users\JB06216\AppData\Local\Temp\promptfoo-python-output-json-1729168652278-f414fd688d28b.json: Error: ENOENT: no such file or directory, unlink 'C:\Users\JB06216\AppData\Local\Temp\promptfoo-python-output-json-1729168652278-f414fd688d28b.json' C:\Users\JB06216\AppData\Local\npm-cache\_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\python\pythonUtils.js:139 throw new Error(Error running Python script: ${error.message}\nStack Trace: ${error.stack?.replace('--- Python Traceback ---', 'Python Traceback: ') || ^

Error: Error running Python script: TypeError: better_prompt() missing 1 required positional argument: 'rating' Stack Trace: Error: TypeError: better_prompt() missing 1 required positional argument: 'rating' at PythonShell.parseError (C:\Users\JB06216\AppData\Local\npm-cache_npx\81bbc6515d992ace\node_modules\python-shell\index.js:303:21) at terminateIfNeeded (C:\Users\JB06216\AppData\Local\npm-cache_npx\81bbc6515d992ace\node_modules\python-shell\index.js:193:32) at ChildProcess. (C:\Users\JB06216\AppData\Local\npm-cache_npx\81bbc6515d992ace\node_modules\python-shell\index.js:185:13) at ChildProcess.emit (node:events:519:28) at ChildProcess._handle.onexit (node:internal/child_process:294:12) --Python Traceback: -- File "C:\Users\JB06216\AppData\Local\npm-cache_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\python\wrapper.py", line 39, in result = call_method(script_path, method_name, *data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\JB06216\AppData\Local\npm-cache_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\python\wrapper.py", line 28, in call_method return method_to_call(*args) ^^^^^^^^^^^^^^^^^^^^^ at runPython (C:\Users\JB06216\AppData\Local\npm-cache_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\python\pythonUtils.js:139:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async renderPrompt (C:\Users\JB06216\AppData\Local\npm-cache_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\evaluatorHelpers.js:118:24) at async Evaluator.runEval (C:\Users\JB06216\AppData\Local\npm-cache_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\evaluator.js:140:32) at async processEvalStep (C:\Users\JB06216\AppData\Local\npm-cache_npx\81bbc6515d992ace\node_modules\promptfoo\dist\src\evaluator.js:536:25)

Node.js v20.18.0"`

jaybfn avatar Oct 17 '24 12:10 jaybfn