()
| 96 | let ollamaClient: OllamaEmbedClient | null = null; |
| 97 | |
| 98 | async function getOllamaClient(): Promise<OllamaEmbedClient> { |
| 99 | if (!ollamaClient) { |
| 100 | const { Ollama } = await import("ollama"); |
| 101 | ollamaClient = new Ollama({ host: process.env.OLLAMA_HOST }) as unknown as OllamaEmbedClient; |
| 102 | } |
| 103 | return ollamaClient; |
| 104 | } |
| 105 | |
| 106 | async function callOllamaEmbed(input: string[], signal: AbortSignal): Promise<number[][]> { |
| 107 | const client = await getOllamaClient(); |