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.json-mode.yaml 1.5 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
  1. # yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
  2. description: 'JSON mode and structured output with Mistral models'
  3. providers:
  4. - id: mistral:mistral-large-latest
  5. config:
  6. response_format:
  7. type: 'json_object'
  8. temperature: 0.3
  9. prompts:
  10. - "Extract the following information from the text and return as JSON with keys 'name', 'age', 'occupation', and 'location': {{text}}"
  11. tests:
  12. - vars:
  13. text: 'John Smith is a 35-year-old software engineer living in San Francisco.'
  14. assert:
  15. - type: is-json
  16. - type: javascript
  17. value: |
  18. const parsed = JSON.parse(output);
  19. return parsed.name === "John Smith" &&
  20. parsed.age === 35 &&
  21. parsed.occupation === "software engineer" &&
  22. parsed.location === "San Francisco";
  23. - vars:
  24. text: 'Maria Garcia, age 28, works as a data scientist in New York City.'
  25. assert:
  26. - type: is-json
  27. - type: javascript
  28. value: |
  29. const parsed = JSON.parse(output);
  30. return parsed.name === "Maria Garcia" &&
  31. parsed.age === 28 &&
  32. parsed.occupation === "data scientist" &&
  33. parsed.location === "New York City";
  34. - vars:
  35. text: 'Dr. Ahmed Hassan is a 42-year-old cardiologist practicing in London.'
  36. assert:
  37. - type: is-json
  38. - type: javascript
  39. value: |
  40. const parsed = JSON.parse(output);
  41. return parsed.name && parsed.age && parsed.occupation && parsed.location;
Tip!

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

Comments

Loading...