You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While writing custom assertions for test cases, there are several times we need an optional parameter to fine tune the assertions or provide an ability to switch custom logic on the fly (Like switching between different rubrics or based on the vars).
For eg.
I want to make threshold_percentage in the following yaml snippet optional. I have a logic in custom python assertion script (llm_similarity_rubrics_test.py) to directly use 80% if no value is provided.
- vars:
question: Help me preparing a birthday cake!
similarity_text: I'm sorry, but as a customer service AI assistant,
I'm focused on helping you with your shopping experience.
If you have any questions related to that, please feel free to ask!
threshold_percentage: 70 #Removing this line from here should also work since I have fallbacks in custom python code
assert:
- type: python
value: file://llm_similarity_rubrics_test.py
I want to have a separate custom python rubric that needs to have separate set of parameters to be passed in the same yaml file
- vars:
question: Help me preparing a birthday cake!
contains_text: I'm focused on helping you with your shopping experience.
#This rubrics just checks if a particular piece of text is in output or not. I should be able to switch the params for it on the fly.
assert:
- type: python
value: file://llm_contains_rubrics_test.py
I'm also quite new to promptfoo so if there are other ways to achieve this, please educate me :)
The text was updated successfully, but these errors were encountered:
While writing custom assertions for test cases, there are several times we need an optional parameter to fine tune the assertions or provide an ability to switch custom logic on the fly (Like switching between different rubrics or based on the vars).
For eg.
I'm also quite new to promptfoo so if there are other ways to achieve this, please educate me :)
The text was updated successfully, but these errors were encountered: