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

providers.azure.test.ts 3.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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  1. import { maybeEmitAzureOpenAiWarning } from '../src/providers/azureopenaiUtil';
  2. import { AzureOpenAiCompletionProvider } from '../src/providers/azureopenai';
  3. import { OpenAiCompletionProvider } from '../src/providers/openai';
  4. import type { TestSuite, TestCase } from '../src/types';
  5. import { HuggingfaceTextGenerationProvider } from '../src/providers/huggingface';
  6. describe('maybeEmitAzureOpenAiWarning', () => {
  7. test('should not emit warning when no Azure providers are used', () => {
  8. const testSuite: TestSuite = {
  9. providers: [new OpenAiCompletionProvider('foo')],
  10. defaultTest: {},
  11. prompts: [],
  12. };
  13. const tests: TestCase[] = [
  14. {
  15. assert: [{ type: 'llm-rubric', value: 'foo bar' }],
  16. },
  17. ];
  18. const result = maybeEmitAzureOpenAiWarning(testSuite, tests);
  19. expect(result).toBe(false);
  20. });
  21. test('should not emit warning when Azure provider is used alone, but no model graded eval', () => {
  22. const testSuite: TestSuite = {
  23. providers: [new AzureOpenAiCompletionProvider('foo')],
  24. defaultTest: {},
  25. prompts: [],
  26. };
  27. const tests: TestCase[] = [
  28. {
  29. assert: [{ type: 'equals' }],
  30. },
  31. ];
  32. const result = maybeEmitAzureOpenAiWarning(testSuite, tests);
  33. expect(result).toBe(false);
  34. });
  35. test('should emit warning when Azure provider is used alone, but with model graded eval', () => {
  36. const testSuite: TestSuite = {
  37. providers: [new AzureOpenAiCompletionProvider('foo')],
  38. defaultTest: {},
  39. prompts: [],
  40. };
  41. const tests: TestCase[] = [
  42. {
  43. assert: [{ type: 'llm-rubric', value: 'foo bar' }],
  44. },
  45. ];
  46. const result = maybeEmitAzureOpenAiWarning(testSuite, tests);
  47. expect(result).toBe(true);
  48. });
  49. test('should emit warning when Azure provider used with non-OpenAI provider', () => {
  50. const testSuite: TestSuite = {
  51. providers: [
  52. new AzureOpenAiCompletionProvider('foo'),
  53. new HuggingfaceTextGenerationProvider('bar'),
  54. ],
  55. defaultTest: {},
  56. prompts: [],
  57. };
  58. const tests: TestCase[] = [
  59. {
  60. assert: [{ type: 'llm-rubric', value: 'foo bar' }],
  61. },
  62. ];
  63. const result = maybeEmitAzureOpenAiWarning(testSuite, tests);
  64. expect(result).toBe(true);
  65. });
  66. test('should not emit warning when Azure providers are used with a default provider set', () => {
  67. const testSuite: TestSuite = {
  68. providers: [new AzureOpenAiCompletionProvider('foo')],
  69. defaultTest: { options: { provider: 'azureopenai:....' } },
  70. prompts: [],
  71. };
  72. const tests: TestCase[] = [
  73. {
  74. assert: [{ type: 'llm-rubric', value: 'foo bar' }],
  75. },
  76. ];
  77. const result = maybeEmitAzureOpenAiWarning(testSuite, tests);
  78. expect(result).toBe(false);
  79. });
  80. test('should not emit warning when both Azure and OpenAI providers are used', () => {
  81. const testSuite: TestSuite = {
  82. providers: [new AzureOpenAiCompletionProvider('foo'), new OpenAiCompletionProvider('bar')],
  83. defaultTest: {},
  84. prompts: [],
  85. };
  86. const tests: TestCase[] = [
  87. {
  88. assert: [{ type: 'llm-rubric', value: 'foo bar' }],
  89. },
  90. ];
  91. const result = maybeEmitAzureOpenAiWarning(testSuite, tests);
  92. expect(result).toBe(false);
  93. });
  94. });
Tip!

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

Comments

Loading...