https://promptfoo.dev/ logo
Python assertion error: module cannot find get_var
# ❓|questions
j
Hey folks! I have a __expected1 column in test cases CSV file which calls a python, say "assert_logic.py" And come across the following error when running promptfoo eval using LOG_LEVEL=DEBUG:
Copy code
Importing module assert_logic from /path/to/module ...
Traceback (most recent call last):
  File "/home/user/.nvm/versions/node/v18.20.4/lib/node_modules/promptfoo/dist/src/python/wrapper.py", line 39, in <module>
    result = call_method(script_path, method_name, *data)
  File "/home/user/.nvm/versions/node/v18.20.4/lib/node_modules/promptfoo/dist/src/python/wrapper.py", line 24, in call_method
    method_to_call = getattr(script_module, method_name)
AttributeError: module 'assert_logic' has no attribute 'get_var'
Can somebody help me on how I can resolve this "get_var" issue?
Okies, I am getting a different error now vs. above I just trimmed down my CSV to one test case with an __expected assertion column pointing towards a python assertion module (runAssert.py). This file is in the same directory as my promptfoo yaml, which just defines to call a prompt file and test case csv file Promptfoo eval gives me this error:
Copy code
Importing module temp-python-code-1731555063279-3f68695751231 from /tmp ...
Traceback (most recent call last):
  File "/home/jas/.nvm/versions/node/v18.20.4/lib/node_modules/promptfoo/dist/src/python/wrapper.py", line 39, in <module>
    result = call_method(script_path, method_name, *data)
  File "/home/jas/.nvm/versions/node/v18.20.4/lib/node_modules/promptfoo/dist/src/python/wrapper.py", line 28, in call_method
    return method_to_call(*args)
  File "/tmp/temp-python-code-1731555063279-3f68695751231.py", line 4, in main
    return runAssert.py
NameError: name 'runAssert' is not defined
Error running Python script: NameError: name 'runAssert' is not defined
Stack Trace: Error: NameError: name 'runAssert' is not defined
Screenshots for directory + CSV column pasted