mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
724c88c201
A mechanical prettier --write over server/src, server/tests, server/scripts and shared/src with the workspaces' .prettierrc; nothing but layout and import order changes, and every file keeps the same set of imports. shared is formatted throughout and its format baseline is empty. The server baseline keeps the 35 files that Prettier would grow past their lint:size limit (they need a split first, which is not a formatting change), and the generated entity files stay as their generator writes them.
25 lines
1.2 KiB
TypeScript
25 lines
1.2 KiB
TypeScript
import { AnthropicClient } from '../../../../src/nest/llm-parse/clients/anthropic.client';
|
|
import { OpenAiCompatibleClient } from '../../../../src/nest/llm-parse/clients/openai-compatible.client';
|
|
import { createLlmClient } from '../../../../src/nest/llm-parse/llm-client.factory';
|
|
import type { ResolvedLlmConfig } from '../../../../src/nest/llm-parse/llm-config';
|
|
|
|
import { describe, it, expect } from 'vitest';
|
|
|
|
const cfg = (provider: string): ResolvedLlmConfig =>
|
|
({ provider, model: 'm', baseUrl: 'http://x', multimodal: false }) as unknown as ResolvedLlmConfig;
|
|
|
|
describe('createLlmClient', () => {
|
|
it('returns the Anthropic client for the anthropic provider', () => {
|
|
expect(createLlmClient(cfg('anthropic'))).toBeInstanceOf(AnthropicClient);
|
|
});
|
|
|
|
it('returns the OpenAI-compatible client for openai and local', () => {
|
|
expect(createLlmClient(cfg('openai'))).toBeInstanceOf(OpenAiCompatibleClient);
|
|
expect(createLlmClient(cfg('local'))).toBeInstanceOf(OpenAiCompatibleClient);
|
|
});
|
|
|
|
it('falls back to the OpenAI-compatible client for an unknown provider', () => {
|
|
expect(createLlmClient(cfg('something-else'))).toBeInstanceOf(OpenAiCompatibleClient);
|
|
});
|
|
});
|