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-structured.yaml 2.1 KB

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
  1. # yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
  2. description: Schema-enforced JSON recipe generation with Llama 4
  3. prompts:
  4. - file://structured_prompts.txt
  5. providers:
  6. - id: cerebras:llama-4-scout-17b-16e-instruct
  7. config:
  8. temperature: 0.7
  9. max_completion_tokens: 1024
  10. response_format:
  11. type: 'json_schema'
  12. json_schema:
  13. name: 'recipe_schema'
  14. strict: true
  15. schema:
  16. type: 'object'
  17. properties:
  18. name: { 'type': 'string' }
  19. cuisine: { 'type': 'string' }
  20. difficulty:
  21. type: 'string'
  22. enum: ['easy', 'medium', 'hard']
  23. prepTime: { 'type': 'integer' }
  24. cookTime: { 'type': 'integer' }
  25. ingredients:
  26. type: 'array'
  27. items:
  28. type: 'object'
  29. properties:
  30. name: { 'type': 'string' }
  31. amount: { 'type': 'string' }
  32. required: ['name', 'amount']
  33. instructions:
  34. type: 'array'
  35. items: { 'type': 'string' }
  36. required: ['name', 'cuisine', 'difficulty', 'ingredients', 'instructions']
  37. additionalProperties: false
  38. tests:
  39. - vars:
  40. cuisine: Italian
  41. dish: Cacio e Pepe
  42. assert:
  43. - type: json-schema-valid
  44. value: |
  45. {
  46. "type": "object",
  47. "required": ["name", "cuisine", "difficulty", "ingredients", "instructions"]
  48. }
  49. - vars:
  50. cuisine: Japanese
  51. dish: Okonomiyaki
  52. assert:
  53. - type: contains-json-property
  54. value: ['ingredients', 'instructions']
  55. - type: javascript
  56. value: |
  57. return output.ingredients.length >= 5 ? 'pass' : 'fail: needs at least 5 ingredients'
  58. - vars:
  59. cuisine: Mexican
  60. dish: Chiles en Nogada
  61. assert:
  62. - type: contains-json-property
  63. value: ['difficulty']
  64. - type: javascript
  65. value: |
  66. return output.instructions.length >= 3 ? 'pass' : 'fail: needs detailed instructions'
  67. outputs:
  68. - type: json
Tip!

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

Comments

Loading...