Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

promptfooconfig-advanced.yaml 992 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  1. # yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
  2. description: Advanced BERTScore with multiple references
  3. prompts:
  4. - 'Explain: {{topic}}'
  5. providers:
  6. - openai:gpt-4.1-nano
  7. tests:
  8. - vars:
  9. topic: 'gradient descent'
  10. reference: 'An optimization algorithm that adjusts parameters to minimize error'
  11. assert:
  12. - type: python
  13. value: |
  14. # Compare against multiple valid answers
  15. from bert_score import score
  16. references = [
  17. context['vars']['reference'],
  18. "A method for finding the minimum of a function by moving in the direction of steepest descent",
  19. "Like rolling a ball down a hill to find the lowest point"
  20. ]
  21. # Get best score across all references
  22. scores = []
  23. for ref in references:
  24. _, _, F1 = score([output], [ref], lang='en', verbose=False)
  25. scores.append(F1.item())
  26. return max(scores)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...