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.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
69
70
  1. # yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
  2. prompts:
  3. - 'What is the weather like in {{city}}?'
  4. providers:
  5. - id: openai:chat:gpt-4o-mini
  6. config:
  7. tools:
  8. [
  9. {
  10. 'type': 'function',
  11. 'function':
  12. {
  13. 'name': 'get_current_weather',
  14. 'description': 'Get the current weather in a given location',
  15. 'parameters':
  16. {
  17. 'type': 'object',
  18. 'properties':
  19. {
  20. 'location':
  21. {
  22. 'type': 'string',
  23. 'description': 'The city and state, e.g. San Francisco, CA',
  24. },
  25. 'unit': { 'type': 'string', 'enum': ['celsius', 'fahrenheit'] },
  26. },
  27. 'required': ['location'],
  28. },
  29. },
  30. },
  31. ]
  32. tests:
  33. - vars:
  34. city: Boston
  35. assert:
  36. - type: is-json
  37. - type: is-valid-openai-tools-call
  38. - type: javascript
  39. value: output[0].function.name === 'get_current_weather'
  40. - type: javascript
  41. value: JSON.parse(output[0].function.arguments).location === 'Boston, MA'
  42. - vars:
  43. city: New York
  44. options:
  45. # Transform is a cleaner way to pick out specific properties.
  46. # This transform returns only the 'name' property
  47. transform: output[0].function.name
  48. assert:
  49. - type: equals
  50. value: get_current_weather
  51. - vars:
  52. city: Paris
  53. assert:
  54. - type: equals
  55. value: get_current_weather
  56. # Transform is a cleaner way to pick out specific properties.
  57. # This transform returns only the 'name' property
  58. transform: output[0].function.name
  59. - type: similar
  60. value: Paris, France
  61. threshold: 0.5
  62. # This transform returns only the parsed location argument.
  63. transform: JSON.parse(output[0].function.arguments).location
  64. - vars:
  65. city: Mars
Tip!

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

Comments

Loading...