model-mux 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/eslint.config.d.ts +3 -0
- package/dist/eslint.config.d.ts.map +1 -0
- package/dist/eslint.config.js +52 -0
- package/dist/eslint.config.js.map +1 -0
- package/dist/src/adapter-factory.d.ts +5 -0
- package/dist/src/adapter-factory.d.ts.map +1 -0
- package/dist/src/adapter-factory.js +11 -0
- package/dist/src/adapter-factory.js.map +1 -0
- package/dist/src/adapter.d.ts +19 -0
- package/dist/src/adapter.d.ts.map +1 -0
- package/dist/src/adapter.js +19 -0
- package/dist/src/adapter.js.map +1 -0
- package/dist/src/anthropic/anthropic-adapter.d.ts +8 -0
- package/dist/src/anthropic/anthropic-adapter.d.ts.map +1 -0
- package/dist/src/anthropic/anthropic-adapter.js +17 -0
- package/dist/src/anthropic/anthropic-adapter.js.map +1 -0
- package/dist/src/index.d.ts +15 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +22 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/openai/openai-adapter.d.ts +10 -0
- package/dist/src/openai/openai-adapter.d.ts.map +1 -0
- package/dist/src/openai/openai-adapter.js +75 -0
- package/dist/src/openai/openai-adapter.js.map +1 -0
- package/dist/test/integration/openai/openai.it.spec.d.ts +2 -0
- package/dist/test/integration/openai/openai.it.spec.d.ts.map +1 -0
- package/dist/test/integration/openai/openai.it.spec.js +91 -0
- package/dist/test/integration/openai/openai.it.spec.js.map +1 -0
- package/dist/test/unit/adapter-factory.spec.d.ts +2 -0
- package/dist/test/unit/adapter-factory.spec.d.ts.map +1 -0
- package/dist/test/unit/adapter-factory.spec.js +89 -0
- package/dist/test/unit/adapter-factory.spec.js.map +1 -0
- package/dist/test/unit/adapter.spec.d.ts +2 -0
- package/dist/test/unit/adapter.spec.d.ts.map +1 -0
- package/dist/test/unit/adapter.spec.js +136 -0
- package/dist/test/unit/adapter.spec.js.map +1 -0
- package/dist/test/unit/index.spec.d.ts +2 -0
- package/dist/test/unit/index.spec.d.ts.map +1 -0
- package/dist/test/unit/index.spec.js +193 -0
- package/dist/test/unit/index.spec.js.map +1 -0
- package/dist/test/unit/openai/openai-adapter.spec.d.ts +2 -0
- package/dist/test/unit/openai/openai-adapter.spec.d.ts.map +1 -0
- package/dist/test/unit/openai/openai-adapter.spec.js +314 -0
- package/dist/test/unit/openai/openai-adapter.spec.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import Chance from 'chance';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import { BaseAdapter } from '../../src/adapter.js';
|
|
4
|
+
// Concrete subclass to test the abstract BaseAdapter
|
|
5
|
+
class TestAdapter extends BaseAdapter {
|
|
6
|
+
constructor(model, baseUrl, headers, apiKey) {
|
|
7
|
+
super(model, baseUrl, headers, apiKey);
|
|
8
|
+
}
|
|
9
|
+
// Expose protected members for testing
|
|
10
|
+
get exposedModel() {
|
|
11
|
+
return this.model;
|
|
12
|
+
}
|
|
13
|
+
get exposedBaseUrl() {
|
|
14
|
+
return this.baseUrl;
|
|
15
|
+
}
|
|
16
|
+
get exposedHeaders() {
|
|
17
|
+
return this.headers;
|
|
18
|
+
}
|
|
19
|
+
get exposedApiKey() {
|
|
20
|
+
return this.apiKey;
|
|
21
|
+
}
|
|
22
|
+
exposedMapInput(req) {
|
|
23
|
+
return this.mapInput(req);
|
|
24
|
+
}
|
|
25
|
+
async *stream(_llmRequest) {
|
|
26
|
+
// stub
|
|
27
|
+
}
|
|
28
|
+
async generate(_llmRequest) {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
async connect(_llmRequest) {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
describe('BaseAdapter', () => {
|
|
36
|
+
const chance = new Chance();
|
|
37
|
+
let model;
|
|
38
|
+
let baseUrl;
|
|
39
|
+
let headers;
|
|
40
|
+
let apiKey;
|
|
41
|
+
let adapter;
|
|
42
|
+
beforeEach(() => {
|
|
43
|
+
model = chance.word();
|
|
44
|
+
baseUrl = chance.url();
|
|
45
|
+
headers = { [chance.word()]: chance.string(), [chance.word()]: chance.string() };
|
|
46
|
+
apiKey = chance.string();
|
|
47
|
+
adapter = new TestAdapter(model, baseUrl, headers, apiKey);
|
|
48
|
+
});
|
|
49
|
+
describe('constructor', () => {
|
|
50
|
+
it('should store model', () => {
|
|
51
|
+
// Assert
|
|
52
|
+
expect(adapter.exposedModel).toBe(model);
|
|
53
|
+
});
|
|
54
|
+
it('should store baseUrl', () => {
|
|
55
|
+
// Assert
|
|
56
|
+
expect(adapter.exposedBaseUrl).toBe(baseUrl);
|
|
57
|
+
});
|
|
58
|
+
it('should store headers', () => {
|
|
59
|
+
// Assert
|
|
60
|
+
expect(adapter.exposedHeaders).toBe(headers);
|
|
61
|
+
});
|
|
62
|
+
it('should store apiKey', () => {
|
|
63
|
+
// Assert
|
|
64
|
+
expect(adapter.exposedApiKey).toBe(apiKey);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
describe('mapInput', () => {
|
|
68
|
+
it('should extract text from contents with parts', () => {
|
|
69
|
+
// Arrange
|
|
70
|
+
const text1 = chance.sentence();
|
|
71
|
+
const text2 = chance.sentence();
|
|
72
|
+
const req = {
|
|
73
|
+
contents: [{ parts: [{ text: text1 }] }, { parts: [{ text: text2 }] }],
|
|
74
|
+
};
|
|
75
|
+
// Act
|
|
76
|
+
const result = adapter.exposedMapInput(req);
|
|
77
|
+
// Assert
|
|
78
|
+
expect(result).toBe(text1 + text2);
|
|
79
|
+
});
|
|
80
|
+
it('should handle contents with multiple parts in a single content', () => {
|
|
81
|
+
// Arrange
|
|
82
|
+
const text1 = chance.sentence();
|
|
83
|
+
const text2 = chance.sentence();
|
|
84
|
+
const req = {
|
|
85
|
+
contents: [{ parts: [{ text: text1 }, { text: text2 }] }],
|
|
86
|
+
};
|
|
87
|
+
// Act
|
|
88
|
+
const result = adapter.exposedMapInput(req);
|
|
89
|
+
// Assert
|
|
90
|
+
expect(result).toBe(text1 + text2);
|
|
91
|
+
});
|
|
92
|
+
it('should handle parts with missing text by using empty string', () => {
|
|
93
|
+
// Arrange
|
|
94
|
+
const text1 = chance.sentence();
|
|
95
|
+
const req = {
|
|
96
|
+
contents: [{ parts: [{ text: text1 }, { notText: chance.word() }] }],
|
|
97
|
+
};
|
|
98
|
+
// Act
|
|
99
|
+
const result = adapter.exposedMapInput(req);
|
|
100
|
+
// Assert
|
|
101
|
+
expect(result).toBe(text1);
|
|
102
|
+
});
|
|
103
|
+
it('should handle contents with missing parts by flatMapping to empty', () => {
|
|
104
|
+
// Arrange
|
|
105
|
+
const text1 = chance.sentence();
|
|
106
|
+
const req = {
|
|
107
|
+
contents: [{ parts: [{ text: text1 }] }, {}],
|
|
108
|
+
};
|
|
109
|
+
// Act
|
|
110
|
+
const result = adapter.exposedMapInput(req);
|
|
111
|
+
// Assert
|
|
112
|
+
expect(result).toBe(text1);
|
|
113
|
+
});
|
|
114
|
+
it('should return empty string when contents has no text parts', () => {
|
|
115
|
+
// Arrange
|
|
116
|
+
const req = {
|
|
117
|
+
contents: [{ parts: [{ notText: chance.word() }] }],
|
|
118
|
+
};
|
|
119
|
+
// Act
|
|
120
|
+
const result = adapter.exposedMapInput(req);
|
|
121
|
+
// Assert
|
|
122
|
+
expect(result).toBe('');
|
|
123
|
+
});
|
|
124
|
+
it('should return empty string when contents is empty', () => {
|
|
125
|
+
// Arrange
|
|
126
|
+
const req = {
|
|
127
|
+
contents: [],
|
|
128
|
+
};
|
|
129
|
+
// Act
|
|
130
|
+
const result = adapter.exposedMapInput(req);
|
|
131
|
+
// Assert
|
|
132
|
+
expect(result).toBe('');
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
//# sourceMappingURL=adapter.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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V,QAAQ,EAAE,EAAE;aACY,CAAC;YAE3B,MAAM;YACN,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YAE5C,SAAS;YACT,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../../test/unit/index.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import Chance from 'chance';
|
|
2
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
3
|
+
import { AdapterFactory } from '../../src/adapter-factory.js';
|
|
4
|
+
import { ModelMux } from '../../src/index.js';
|
|
5
|
+
vi.mock('../../src/adapter-factory.js', () => ({
|
|
6
|
+
AdapterFactory: { createAdapter: vi.fn() },
|
|
7
|
+
}));
|
|
8
|
+
describe('ModelMux', () => {
|
|
9
|
+
const chance = new Chance();
|
|
10
|
+
const fakeAdapter = {
|
|
11
|
+
generate: vi.fn(),
|
|
12
|
+
stream: vi.fn(),
|
|
13
|
+
connect: vi.fn(),
|
|
14
|
+
};
|
|
15
|
+
let options;
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
vi.clearAllMocks();
|
|
18
|
+
vi.mocked(AdapterFactory.createAdapter).mockReturnValue(fakeAdapter);
|
|
19
|
+
options = {
|
|
20
|
+
model: chance.word(),
|
|
21
|
+
baseUrl: chance.url(),
|
|
22
|
+
headers: { [chance.word()]: chance.string(), [chance.word()]: chance.string() },
|
|
23
|
+
apiKey: chance.string(),
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
describe('constructor', () => {
|
|
27
|
+
it('should pass model, baseUrl, headers, and apiKey to AdapterFactory.createAdapter', () => {
|
|
28
|
+
// Act
|
|
29
|
+
new ModelMux(options);
|
|
30
|
+
// Assert
|
|
31
|
+
expect(AdapterFactory.createAdapter).toHaveBeenCalledOnce();
|
|
32
|
+
expect(AdapterFactory.createAdapter).toHaveBeenCalledWith(options.model, options.baseUrl, options.headers, options.apiKey);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
describe('generateContentAsync', () => {
|
|
36
|
+
it('should yield a single response when stream is false', async () => {
|
|
37
|
+
// Arrange
|
|
38
|
+
const mockResponse = { text: chance.sentence() };
|
|
39
|
+
vi.mocked(fakeAdapter.generate).mockResolvedValue(mockResponse);
|
|
40
|
+
const mux = new ModelMux(options);
|
|
41
|
+
const results = [];
|
|
42
|
+
// Act
|
|
43
|
+
for await (const chunk of mux.generateContentAsync({}, false)) {
|
|
44
|
+
results.push(chunk);
|
|
45
|
+
}
|
|
46
|
+
// Assert
|
|
47
|
+
expect(fakeAdapter.generate).toHaveBeenCalledOnce();
|
|
48
|
+
expect(results).toEqual([mockResponse]);
|
|
49
|
+
});
|
|
50
|
+
it('should yield a single response when stream is undefined', async () => {
|
|
51
|
+
// Arrange
|
|
52
|
+
const mockResponse = { text: chance.sentence() };
|
|
53
|
+
vi.mocked(fakeAdapter.generate).mockResolvedValue(mockResponse);
|
|
54
|
+
const mux = new ModelMux(options);
|
|
55
|
+
const results = [];
|
|
56
|
+
// Act
|
|
57
|
+
for await (const chunk of mux.generateContentAsync({})) {
|
|
58
|
+
results.push(chunk);
|
|
59
|
+
}
|
|
60
|
+
// Assert
|
|
61
|
+
expect(fakeAdapter.generate).toHaveBeenCalledOnce();
|
|
62
|
+
expect(results).toEqual([mockResponse]);
|
|
63
|
+
});
|
|
64
|
+
it('should pass llmRequest to adapter.generate when stream is false', async () => {
|
|
65
|
+
// Arrange
|
|
66
|
+
const llmRequest = { prompt: chance.sentence() };
|
|
67
|
+
const mockResponse = { text: chance.sentence() };
|
|
68
|
+
vi.mocked(fakeAdapter.generate).mockResolvedValue(mockResponse);
|
|
69
|
+
const mux = new ModelMux(options);
|
|
70
|
+
// Act
|
|
71
|
+
for await (const _ of mux.generateContentAsync(llmRequest, false)) {
|
|
72
|
+
// consume
|
|
73
|
+
}
|
|
74
|
+
// Assert
|
|
75
|
+
expect(fakeAdapter.generate).toHaveBeenCalledWith(llmRequest);
|
|
76
|
+
});
|
|
77
|
+
it('should delegate to adapter.stream when stream is true', async () => {
|
|
78
|
+
// Arrange
|
|
79
|
+
const chunk1 = { text: chance.sentence() };
|
|
80
|
+
const chunk2 = { text: chance.sentence() };
|
|
81
|
+
async function* fakeStream() {
|
|
82
|
+
yield chunk1;
|
|
83
|
+
yield chunk2;
|
|
84
|
+
}
|
|
85
|
+
vi.mocked(fakeAdapter.stream).mockReturnValue(fakeStream());
|
|
86
|
+
const mux = new ModelMux(options);
|
|
87
|
+
const results = [];
|
|
88
|
+
// Act
|
|
89
|
+
for await (const chunk of mux.generateContentAsync({}, true)) {
|
|
90
|
+
results.push(chunk);
|
|
91
|
+
}
|
|
92
|
+
// Assert
|
|
93
|
+
expect(fakeAdapter.stream).toHaveBeenCalledOnce();
|
|
94
|
+
expect(fakeAdapter.generate).not.toHaveBeenCalled();
|
|
95
|
+
expect(results).toEqual([chunk1, chunk2]);
|
|
96
|
+
});
|
|
97
|
+
it('should pass llmRequest to adapter.stream when stream is true', async () => {
|
|
98
|
+
// Arrange
|
|
99
|
+
const llmRequest = { prompt: chance.sentence() };
|
|
100
|
+
async function* fakeStream() {
|
|
101
|
+
// empty
|
|
102
|
+
}
|
|
103
|
+
vi.mocked(fakeAdapter.stream).mockReturnValue(fakeStream());
|
|
104
|
+
const mux = new ModelMux(options);
|
|
105
|
+
// Act
|
|
106
|
+
for await (const _ of mux.generateContentAsync(llmRequest, true)) {
|
|
107
|
+
// consume
|
|
108
|
+
}
|
|
109
|
+
// Assert
|
|
110
|
+
expect(fakeAdapter.stream).toHaveBeenCalledWith(llmRequest);
|
|
111
|
+
});
|
|
112
|
+
it('should yield no results when stream returns nothing', async () => {
|
|
113
|
+
// Arrange
|
|
114
|
+
async function* emptyStream() {
|
|
115
|
+
// yields nothing
|
|
116
|
+
}
|
|
117
|
+
vi.mocked(fakeAdapter.stream).mockReturnValue(emptyStream());
|
|
118
|
+
const mux = new ModelMux(options);
|
|
119
|
+
const results = [];
|
|
120
|
+
// Act
|
|
121
|
+
for await (const chunk of mux.generateContentAsync({}, true)) {
|
|
122
|
+
results.push(chunk);
|
|
123
|
+
}
|
|
124
|
+
// Assert
|
|
125
|
+
expect(results).toEqual([]);
|
|
126
|
+
});
|
|
127
|
+
it('should propagate errors from adapter.generate', async () => {
|
|
128
|
+
// Arrange
|
|
129
|
+
const errorMessage = chance.sentence();
|
|
130
|
+
vi.mocked(fakeAdapter.generate).mockRejectedValue(new Error(errorMessage));
|
|
131
|
+
const mux = new ModelMux(options);
|
|
132
|
+
// Act & Assert
|
|
133
|
+
await expect(async () => {
|
|
134
|
+
for await (const _ of mux.generateContentAsync({}, false)) {
|
|
135
|
+
// consume
|
|
136
|
+
}
|
|
137
|
+
}).rejects.toThrow(errorMessage);
|
|
138
|
+
});
|
|
139
|
+
it('should propagate errors from adapter.stream', async () => {
|
|
140
|
+
// Arrange
|
|
141
|
+
const errorMessage = chance.sentence();
|
|
142
|
+
// eslint-disable-next-line require-yield
|
|
143
|
+
async function* errorStream() {
|
|
144
|
+
throw new Error(errorMessage);
|
|
145
|
+
}
|
|
146
|
+
vi.mocked(fakeAdapter.stream).mockReturnValue(errorStream());
|
|
147
|
+
const mux = new ModelMux(options);
|
|
148
|
+
// Act & Assert
|
|
149
|
+
await expect(async () => {
|
|
150
|
+
for await (const _ of mux.generateContentAsync({}, true)) {
|
|
151
|
+
// consume
|
|
152
|
+
}
|
|
153
|
+
}).rejects.toThrow(errorMessage);
|
|
154
|
+
});
|
|
155
|
+
it('should not call adapter.stream when stream is false', async () => {
|
|
156
|
+
// Arrange
|
|
157
|
+
const mockResponse = { text: chance.sentence() };
|
|
158
|
+
vi.mocked(fakeAdapter.generate).mockResolvedValue(mockResponse);
|
|
159
|
+
const mux = new ModelMux(options);
|
|
160
|
+
// Act
|
|
161
|
+
for await (const _ of mux.generateContentAsync({}, false)) {
|
|
162
|
+
// consume
|
|
163
|
+
}
|
|
164
|
+
// Assert
|
|
165
|
+
expect(fakeAdapter.stream).not.toHaveBeenCalled();
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
describe('connect', () => {
|
|
169
|
+
it('should delegate to adapter.connect and return the connection', async () => {
|
|
170
|
+
// Arrange
|
|
171
|
+
const llmRequest = { prompt: chance.sentence() };
|
|
172
|
+
const mockConnection = { id: chance.guid() };
|
|
173
|
+
vi.mocked(fakeAdapter.connect).mockResolvedValue(mockConnection);
|
|
174
|
+
const mux = new ModelMux(options);
|
|
175
|
+
// Act
|
|
176
|
+
const result = await mux.connect(llmRequest);
|
|
177
|
+
// Assert
|
|
178
|
+
expect(fakeAdapter.connect).toHaveBeenCalledOnce();
|
|
179
|
+
expect(fakeAdapter.connect).toHaveBeenCalledWith(llmRequest);
|
|
180
|
+
expect(result).toBe(mockConnection);
|
|
181
|
+
});
|
|
182
|
+
it('should propagate errors from adapter.connect', async () => {
|
|
183
|
+
// Arrange
|
|
184
|
+
const errorMessage = chance.sentence();
|
|
185
|
+
const llmRequest = { prompt: chance.sentence() };
|
|
186
|
+
vi.mocked(fakeAdapter.connect).mockRejectedValue(new Error(errorMessage));
|
|
187
|
+
const mux = new ModelMux(options);
|
|
188
|
+
// Act & Assert
|
|
189
|
+
await expect(mux.connect(llmRequest)).rejects.toThrow(errorMessage);
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
//# sourceMappingURL=index.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../test/unit/index.spec.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE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