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

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

Comments

Loading...