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.kb.yaml 2.2 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
  1. # yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
  2. description: Knowledge Base RAG with contextTransform evaluation
  3. prompts:
  4. - |
  5. Answer the following question in a concise manner:
  6. {{query}}
  7. providers:
  8. # Knowledge Base provider with Claude 4 (cross-region inference profile)
  9. - id: bedrock:kb:us.anthropic.claude-sonnet-4-20250514-v1:0
  10. label: Claude 4 KB
  11. config:
  12. region: us-east-2
  13. knowledgeBaseId: '0VMCLLCVGB' # knowledge-base-quick-start-kjmvw
  14. temperature: 0.0
  15. max_tokens: 1000
  16. # Compare with regular Bedrock Claude 4 (without KB)
  17. - id: bedrock:us.anthropic.claude-sonnet-4-20250514-v1:0
  18. label: Claude 4 Direct
  19. config:
  20. region: us-east-2
  21. temperature: 0.0
  22. max_tokens: 1000
  23. tests:
  24. - vars:
  25. query: 'How do I set up my first promptfoo configuration file?'
  26. - vars:
  27. query: 'What authentication is required for OpenAI and Anthropic providers?'
  28. - vars:
  29. query: 'How can I compare GPT-4 vs Claude performance?'
  30. - vars:
  31. query: 'What types of assertions can I use to automatically grade LLM outputs?'
  32. - vars:
  33. query: 'How do I evaluate RAG systems with context-based assertions?'
  34. # Example using contextTransform to extract context from Knowledge Base citations
  35. - vars:
  36. # `context-faithfulness` and `context-relevance` require the `query` variable to be defined.
  37. query: 'How do I set up my first promptfoo configuration file?'
  38. assert:
  39. # Basic content assertions
  40. - type: contains
  41. value: 'yaml'
  42. - type: contains
  43. value: 'prompts'
  44. # Context-based assertions using contextTransform to extract from citations
  45. # This demonstrates the key contextTransform feature: extracting context from provider responses
  46. - type: context-faithfulness
  47. contextTransform: 'context?.metadata?.citations?.flatMap(c => c.retrievedReferences || []).map(r => r.content?.text || "").filter(t => t.length > 0).join("\\n\\n") || "No citations found"'
  48. threshold: 0.1
  49. - type: context-relevance
  50. contextTransform: 'context?.metadata?.citations?.[0]?.retrievedReferences?.[0]?.content?.text || "No context found"'
  51. threshold: 0.1
Tip!

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

Comments

Loading...