mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 23:50:08 +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
1013 B
TypeScript
25 lines
1013 B
TypeScript
import { AnthropicClient } from './clients/anthropic.client';
|
|
import { OpenAiCompatibleClient } from './clients/openai-compatible.client';
|
|
import type { ResolvedLlmConfig } from './llm-config';
|
|
import type { LlmExtractionClient } from './llm-provider.interface';
|
|
|
|
/**
|
|
* Pick the provider client for a resolved config.
|
|
* - 'anthropic' → Anthropic Messages API client
|
|
* - 'openai' | 'local' → OpenAI-compatible client (cloud or local base URL)
|
|
*/
|
|
export function createLlmClient(config: ResolvedLlmConfig): LlmExtractionClient {
|
|
switch (config.provider) {
|
|
case 'anthropic':
|
|
return new AnthropicClient();
|
|
case 'openai':
|
|
case 'local':
|
|
return new OpenAiCompatibleClient();
|
|
// TODO(nuextract): add a NuExtract template adapter here (local vision model
|
|
// with its own template-fill API) once the OpenAI-compatible path proves
|
|
// insufficient for small local models — see the design seam in the plan.
|
|
default:
|
|
return new OpenAiCompatibleClient();
|
|
}
|
|
}
|