Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

custom-strategy.js 654 B

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
  1. /**
  2. * Example custom strategy that adds "PLEASE" to the beginning of each test case
  3. */
  4. module.exports = {
  5. id: 'polite-please',
  6. // Strategy action function that transforms test cases
  7. action: async (testCases, injectVar, config) => {
  8. // Transform each test case by adding "PLEASE" at the start
  9. return testCases.map((testCase) => ({
  10. ...testCase,
  11. vars: {
  12. ...testCase.vars,
  13. [injectVar]: `PLEASE ${testCase.vars[injectVar]}`,
  14. },
  15. // Preserve other properties like expected output and metadata
  16. metadata: {
  17. ...testCase.metadata,
  18. strategyId: 'polite-please',
  19. },
  20. }));
  21. },
  22. };
Tip!

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

Comments

Loading...