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.approval.yaml 3.4 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
  1. # yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
  2. description: MCP approval workflow examples
  3. prompts:
  4. - 'Search for information about {{query}} in the {{repo}} repository'
  5. - 'What are the latest updates in {{repo}}?'
  6. providers:
  7. # Provider with approval required (default behavior)
  8. - id: openai:responses:gpt-4.1-2025-04-14
  9. label: 'With Approval Required'
  10. config:
  11. tools:
  12. - type: mcp
  13. server_label: deepwiki
  14. server_url: https://mcp.deepwiki.com/mcp
  15. # require_approval is not specified, so approval is required by default
  16. max_output_tokens: 1000
  17. temperature: 0.2
  18. instructions: 'You are a research assistant. When approval is required for MCP tools, explain what you would do if the tool were approved.'
  19. # Provider with selective approval
  20. - id: openai:responses:gpt-4.1-2025-04-14
  21. label: 'Selective Approval'
  22. config:
  23. tools:
  24. - type: mcp
  25. server_label: deepwiki
  26. server_url: https://mcp.deepwiki.com/mcp
  27. require_approval:
  28. never:
  29. tool_names: ['read_wiki_structure']
  30. # ask_question will still require approval, but read_wiki_structure won't
  31. max_output_tokens: 1000
  32. temperature: 0.2
  33. instructions: 'You are a research assistant. Use the available tools to gather information.'
  34. # Provider with no approval required
  35. - id: openai:responses:gpt-4.1-2025-04-14
  36. label: 'No Approval Required'
  37. config:
  38. tools:
  39. - type: mcp
  40. server_label: deepwiki
  41. server_url: https://mcp.deepwiki.com/mcp
  42. require_approval: never
  43. max_output_tokens: 1000
  44. temperature: 0.2
  45. instructions: 'You are a research assistant. Use the available MCP tools to search for information.'
  46. tests:
  47. - vars:
  48. query: 'getting started guide'
  49. repo: 'facebook/react'
  50. assert:
  51. # For approval-required provider, expect either approval request or explanation
  52. - type: contains-any
  53. value: ['MCP Tool Result', 'react', 'React', 'would search', 'would look']
  54. # Should not have tool errors
  55. - type: not-contains
  56. value: 'MCP Tool Error'
  57. - type: llm-rubric
  58. value: 'The response provides information about React or explains what would be searched'
  59. - vars:
  60. query: 'API documentation'
  61. repo: 'openai/openai-python'
  62. assert:
  63. # Test different approval behaviors across providers
  64. - type: contains-any
  65. value: ['API', 'MCP Tool Result', 'Python', 'client']
  66. # Validate that at least one provider succeeded with MCP tools
  67. - type: contains-any
  68. value: ['MCP Tool Result', 'documentation', 'API client', 'library']
  69. - type: llm-rubric
  70. value: 'The response mentions API documentation or explains the search intent'
  71. # Add a test specifically for approval workflow validation
  72. - vars:
  73. query: 'installation instructions'
  74. repo: 'nodejs/node'
  75. assert:
  76. # Comprehensive approval workflow testing
  77. - type: contains-any
  78. value: ['MCP Tool Result', 'installation', 'Node.js', 'setup']
  79. metric: mcp_interaction_detected
  80. # Ensure no unexpected errors
  81. - type: not-contains
  82. value: 'MCP Tool Error'
  83. weight: 0.4
  84. # Quality check regardless of approval status
  85. - type: llm-rubric
  86. value: 'The response addresses installation, setup, or Node.js information'
  87. weight: 0.6
Tip!

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

Comments

Loading...