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.authenticated.yaml 3.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
71
72
73
74
75
76
77
78
79
80
81
82
  1. # yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
  2. description: Authenticated MCP server integration
  3. prompts:
  4. - 'Please {{action}} for customer {{customer_id}} using the Stripe API.'
  5. - 'Can you help me {{action}} for {{customer_id}}? Use the available tools to get the information.'
  6. - 'I need to {{action}} for customer ID {{customer_id}}. Please use the Stripe integration to fetch this data.'
  7. providers:
  8. - id: openai:responses:gpt-4.1-2025-04-14
  9. config:
  10. tools:
  11. - type: mcp
  12. server_label: stripe
  13. server_url: https://mcp.stripe.com
  14. headers:
  15. Authorization: 'Bearer ${STRIPE_API_KEY}'
  16. require_approval: never
  17. allowed_tools: ['create_payment_link', 'list_payment_methods']
  18. max_output_tokens: 1000
  19. temperature: 0.1
  20. instructions: 'You are a payment processing assistant. Use the Stripe MCP tools to help with payment-related tasks. Always provide clear and accurate information about payment operations.'
  21. tests:
  22. - vars:
  23. customer_id: 'cus_test123'
  24. action: 'retrieve customer information'
  25. assert:
  26. # Validate successful MCP tool execution with authentication
  27. - type: is-valid-openai-tools-call
  28. weight: 0.4
  29. # Check for Stripe-specific content
  30. - type: contains-any
  31. value: ['customer', 'Stripe', 'payment', 'subscription']
  32. weight: 0.3
  33. # Ensure authentication worked (no auth errors)
  34. - type: not-contains
  35. value: 'authentication failed'
  36. weight: 0.1
  37. # Verify MCP tool was used successfully
  38. - type: contains
  39. value: 'MCP Tool Result'
  40. weight: 0.1
  41. # Quality validation
  42. - type: llm-rubric
  43. value: 'The response provides customer information or payment details'
  44. - vars:
  45. customer_id: 'cus_test456'
  46. action: 'list payment methods'
  47. assert:
  48. # Comprehensive authentication and API validation
  49. - type: is-valid-openai-tools-call
  50. metric: stripe_api_success
  51. # Check for payment-related content
  52. - type: contains-any
  53. value: ['payment', 'method', 'card', 'bank']
  54. # Ensure no MCP errors (including auth errors)
  55. - type: not-contains-any
  56. value: ['MCP Tool Error', 'unauthorized', 'authentication failed']
  57. # Validate API response quality
  58. - type: llm-rubric
  59. value: 'The response lists payment methods or explains payment options'
  60. - vars:
  61. customer_id: 'cus_test789'
  62. action: 'check subscription status'
  63. assert:
  64. # Test authenticated MCP with subscription data
  65. - type: is-valid-openai-tools-call
  66. - type: contains-any
  67. value: ['subscription', 'plan', 'billing', 'active', 'status']
  68. # Verify successful API integration
  69. - type: contains
  70. value: 'MCP Tool Result'
  71. metric: api_integration_success
  72. weight: 0
  73. - type: llm-rubric
  74. value: 'The response provides subscription status or billing information'
  75. # Note: This example requires a valid STRIPE_API_KEY environment variable
  76. # For testing purposes, you may want to use a test API key from Stripe
Tip!

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

Comments

Loading...