feat(models): add minimax and moonshot providers
This commit is contained in:
@@ -185,6 +185,46 @@ describe('createClientFromConfig', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('creates OpenAIClient for minimax provider', async () => {
|
||||
const prev = process.env.MINIMAX_API_KEY;
|
||||
process.env.MINIMAX_API_KEY = 'test-key';
|
||||
|
||||
try {
|
||||
const { createClientFromConfig } = await loadFactory();
|
||||
const client = createClientFromConfig({
|
||||
provider: 'minimax',
|
||||
model: 'MiniMax-M1',
|
||||
});
|
||||
expect(client.constructor.name).toBe('OpenAIClient');
|
||||
} finally {
|
||||
if (prev === undefined) {
|
||||
delete process.env.MINIMAX_API_KEY;
|
||||
} else {
|
||||
process.env.MINIMAX_API_KEY = prev;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('creates OpenAIClient for moonshot provider', async () => {
|
||||
const prev = process.env.MOONSHOT_API_KEY;
|
||||
process.env.MOONSHOT_API_KEY = 'test-key';
|
||||
|
||||
try {
|
||||
const { createClientFromConfig } = await loadFactory();
|
||||
const client = createClientFromConfig({
|
||||
provider: 'moonshot',
|
||||
model: 'moonshot-v1-8k',
|
||||
});
|
||||
expect(client.constructor.name).toBe('OpenAIClient');
|
||||
} finally {
|
||||
if (prev === undefined) {
|
||||
delete process.env.MOONSHOT_API_KEY;
|
||||
} else {
|
||||
process.env.MOONSHOT_API_KEY = prev;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('creates BedrockClient for bedrock provider', async () => {
|
||||
const { createClientFromConfig } = await loadFactory();
|
||||
const client = createClientFromConfig({
|
||||
|
||||
@@ -223,6 +223,18 @@ export function createClientFromConfig(cfg: ModelConfig): ModelClient {
|
||||
apiKey: requireApiKey(cfg, 'XAI_API_KEY'),
|
||||
baseURL: cfg.endpoint ?? 'https://api.x.ai/v1',
|
||||
});
|
||||
case 'minimax':
|
||||
return new OpenAIClient({
|
||||
model: cfg.model,
|
||||
apiKey: requireApiKey(cfg, 'MINIMAX_API_KEY'),
|
||||
baseURL: cfg.endpoint ?? 'https://api.minimax.io/v1',
|
||||
});
|
||||
case 'moonshot':
|
||||
return new OpenAIClient({
|
||||
model: cfg.model,
|
||||
apiKey: requireApiKey(cfg, 'MOONSHOT_API_KEY'),
|
||||
baseURL: cfg.endpoint ?? 'https://api.moonshot.cn/v1',
|
||||
});
|
||||
case 'bedrock':
|
||||
return new BedrockClient({
|
||||
model: cfg.model,
|
||||
|
||||
Reference in New Issue
Block a user