(config: LLMConfig, systemPrompt: string, userMessage: string)
| 390 | }; |
| 391 | |
| 392 | async function callLLM(config: LLMConfig, systemPrompt: string, userMessage: string): Promise<string> { |
| 393 | const response = await fetch(config.apiEndpoint, { |
| 394 | method: "POST", |
| 395 | headers: { |
| 396 | "Content-Type": "application/json", |
| 397 | "x-api-key": config.apiKey, |
| 398 | "anthropic-version": "2023-06-01", |
| 399 | }, |
| 400 | body: JSON.stringify({ |
| 401 | model: config.model, |
| 402 | max_tokens: 16384, |
| 403 | system: systemPrompt, |
| 404 | messages: [{ role: "user", content: userMessage }], |
| 405 | }), |
| 406 | }); |
| 407 | |
| 408 | if (!response.ok) { |
| 409 | const err = await response.text(); |
| 410 | throw new Error(`LLM API error ${response.status}: ${err}`); |
| 411 | } |
| 412 | |
| 413 | const result = await response.json() as { content: Array<{ text: string }> }; |
| 414 | return result.content[0].text; |
| 415 | } |
| 416 | |
| 417 | const LANGUAGE_NOTES: Record<string, string> = { |
| 418 | de: "Use informal 'du' (not formal 'Sie') throughout. This matches the voice used on the Obsidian main website. Use 'du/dir/dein/deine' for second-person address, and informal verb conjugations (e.g. 'kannst du', 'klicke', 'wähle', 'öffne'). Never use 'Sie/Ihnen/Ihr/Ihre'. Target register: calm, practical documentation voice — direct and clear, not chatty or formal.", |
no outgoing calls
no test coverage detected