2e7860637e
- Restructured server layer with 5 domains: shared, screener, portfolio, calls, finance - Migrated 58 TypeScript files to domain-driven structure - Updated CLAUDE.md with new architecture documentation - Added .gitignore rules for .md files (except CLAUDE.md) - Removed unused CatalystAnalyst import from app.ts - Fixed lint errors: removed unused imports, fixed regex escape, added console suppressions - Verified no sensitive data in git history - Server code compiles cleanly with TypeScript strict mode
32 lines
907 B
TypeScript
32 lines
907 B
TypeScript
import Anthropic from '@anthropic-ai/sdk';
|
|
|
|
/**
|
|
* Thin wrapper around the Anthropic SDK.
|
|
* Handles initialisation and raw message completion only —
|
|
* prompt construction and response parsing stay in LLMAnalyst (service layer).
|
|
*/
|
|
export class AnthropicClient {
|
|
private client: Anthropic | null;
|
|
|
|
constructor() {
|
|
this.client = process.env.ANTHROPIC_API_KEY
|
|
? new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY })
|
|
: null;
|
|
}
|
|
|
|
get isAvailable(): boolean {
|
|
return this.client !== null;
|
|
}
|
|
|
|
async complete(system: string, userMessage: string): Promise<string | null> {
|
|
if (!this.client) return null;
|
|
const response = await this.client.messages.create({
|
|
model: 'claude-haiku-4-5',
|
|
max_tokens: 1024,
|
|
system,
|
|
messages: [{ role: 'user', content: userMessage }],
|
|
});
|
|
return (response.content[0] as { text?: string })?.text ?? null;
|
|
}
|
|
}
|