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.js 1.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
  1. module.exports = /** @type {import('promptfoo').TestSuiteConfig} */ ({
  2. description: 'Function calling and callback execution demonstration',
  3. prompts: [
  4. 'Please add the following numbers together: {{a}} and {{b}}',
  5. 'What is the sum of {{a}} and {{b}}?',
  6. ],
  7. providers: [
  8. {
  9. id: 'vertex:gemini-2.0-flash-001',
  10. config: {
  11. tools: [
  12. {
  13. functionDeclarations: [
  14. {
  15. name: 'addNumbers',
  16. description: 'Add two numbers together',
  17. parameters: {
  18. type: 'object',
  19. properties: {
  20. a: { type: 'number' },
  21. b: { type: 'number' },
  22. },
  23. required: ['a', 'b'],
  24. },
  25. },
  26. ],
  27. },
  28. ],
  29. functionToolCallbacks: {
  30. addNumbers: (parametersJsonString) => {
  31. const { a, b } = JSON.parse(parametersJsonString);
  32. return JSON.stringify(a + b);
  33. },
  34. },
  35. },
  36. },
  37. ],
  38. tests: [
  39. {
  40. vars: { a: 5, b: 6 },
  41. assert: [
  42. {
  43. type: 'equals',
  44. value: '11',
  45. },
  46. ],
  47. },
  48. {
  49. vars: { a: 10, b: 20 },
  50. assert: [
  51. {
  52. type: 'javascript',
  53. value: "output.includes('30')",
  54. },
  55. ],
  56. },
  57. ],
  58. });
Tip!

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

Comments

Loading...