https://promptfoo.dev/ logo
Using Python assertions
# ❓|questions
s
I am facing some issues with Python assertions, can someone help? this is my code:
Copy code
%%writefile promptfooconfig.yaml
prompts:
  - |
    You are an internal corporate chatbot.
    Respond to this query: {{query}}
    Here is some context that you can use to write your response: {{context}}
providers: [openai:gpt-4]
tests:
  - vars:
      query: What is the max purchase that doesn't require approval?
      context: In our company reimbursement policy documented in reimbursement policy 2024, employees are allowed to make purchases up to $500 without requiring any approval. Beyond this threshold, approval from the employee's manager is necessary. For further clarification or assistance, it is recommended to communicate with Fred before submitting any requests.
    assert:
      - type: python
        value: output[5:10] == 'Hello'
this is the error I am getting:
Copy code
[FAIL] │
mPython code execution failed: spawn python ENOENT│
p
this is related to python, try to activate venv
s
Hey, tried that its working, thanks