All files / src/providers/ollama index.ts

100% Statements 8/8
100% Branches 4/4
100% Functions 2/2
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27            63x             3x   2x 4x 4x         2x     63x  
import { config as globalConfig } from "../../config.js";
import { providerRegistry } from "../registry.js";
import { OllamaProvider } from "./OllamaProvider.js";
 
export { OllamaProvider };
 
let registered = false;
 
/**
 * Idempotent registration of the Ollama provider.
 * Automatically called when using createLLM({ provider: 'ollama' })
 */
export function registerOllamaProvider() {
  if (registered) return;
 
  providerRegistry.register("ollama", (config) => {
    const cfg = config || globalConfig;
    return new OllamaProvider({
      baseUrl: cfg.ollamaApiBase
    });
  });
 
  registered = true;
}
 
export const ensureOllamaRegistered = registerOllamaProvider;