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

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

Comments

Loading...