@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and
72 lines (71 loc) • 2.97 kB
TypeScript
import type { AIProviderName } from "../core/types.js";
import type { LanguageModelV1 } from "ai";
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
import type { ZodType, ZodTypeDef } from "zod";
import type { Schema } from "ai";
import { BaseProvider } from "../core/baseProvider.js";
/**
* Ollama Provider v2 - BaseProvider Implementation
*
* PHASE 3.7: BaseProvider wrap around existing custom Ollama implementation
*
* Features:
* - Extends BaseProvider for shared functionality
* - Preserves custom OllamaLanguageModel implementation
* - Local model management and health checking
* - Enhanced error handling with Ollama-specific guidance
*/
export declare class OllamaProvider extends BaseProvider {
private ollamaModel;
private baseUrl;
private timeout;
constructor(modelName?: string);
protected getProviderName(): AIProviderName;
protected getDefaultModel(): string;
/**
* Returns the Vercel AI SDK model instance for Ollama
* The OllamaLanguageModel implements LanguageModelV1 interface properly
*/
protected getAISDKModel(): LanguageModelV1;
/**
* Ollama tool/function calling support is currently disabled due to integration issues.
*
* **Current Issues:**
* 1. The OllamaLanguageModel from @ai-sdk/provider-utils doesn't properly integrate
* with BaseProvider's tool calling mechanism
* 2. Ollama models require specific prompt formatting for function calls that differs
* from the standardized AI SDK format
* 3. Tool response parsing and execution flow needs custom implementation
*
* **What's needed to enable tool support:**
* - Create a custom OllamaLanguageModel wrapper that handles tool schema formatting
* - Implement Ollama-specific tool calling prompt templates
* - Add proper response parsing for Ollama's function call format
* - Test with models that support function calling (llama3.1, mistral, etc.)
*
* **Tracking:**
* - See BaseProvider tool integration patterns in other providers
* - Monitor Ollama function calling documentation: https://ollama.com/blog/tool-support
* - Track AI SDK updates for better Ollama integration
*
* @returns false to disable tools by default
*/
supportsTools(): boolean;
protected executeStream(options: StreamOptions, analysisSchema?: ZodType<unknown, ZodTypeDef, unknown> | Schema<unknown>): Promise<StreamResult>;
private createOllamaStream;
protected handleProviderError(error: unknown): Error;
private validateStreamOptions;
/**
* Check if Ollama service is healthy and accessible
*/
private checkOllamaHealth;
/**
* Get available models from Ollama
*/
getAvailableModels(): Promise<string[]>;
/**
* Check if a specific model is available
*/
isModelAvailable(modelName: string): Promise<boolean>;
}
export default OllamaProvider;