@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
80 lines (79 loc) • 3.36 kB
TypeScript
import type { ZodType, ZodTypeDef } from "zod";
import { type Schema, type LanguageModelV1 } from "ai";
import type { AIProviderName } from "../core/types.js";
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
import { BaseProvider } from "../core/baseProvider.js";
/**
* HuggingFace Provider - BaseProvider Implementation
* Using AI SDK with HuggingFace's OpenAI-compatible endpoint
*/
export declare class HuggingFaceProvider extends BaseProvider {
private model;
constructor(modelName?: string);
/**
* HuggingFace Tool Calling Support (Enhanced 2025)
*
* **Supported Models (Tool Calling Enabled):**
* - meta-llama/Llama-3.1-8B-Instruct - Post-trained for tool calling
* - meta-llama/Llama-3.1-70B-Instruct - Advanced tool calling capabilities
* - meta-llama/Llama-3.1-405B-Instruct - Full tool calling support
* - nvidia/Llama-3.1-Nemotron-Ultra-253B-v1 - Optimized for tool calling
* - NousResearch/Hermes-3-Llama-3.2-3B - Function calling trained
* - codellama/CodeLlama-34b-Instruct-hf - Code-focused tool calling
* - mistralai/Mistral-7B-Instruct-v0.3 - Basic tool support
*
* **Unsupported Models (Tool Calling Disabled):**
* - microsoft/DialoGPT-* - Treats tools as conversation context
* - gpt2, bert, roberta variants - No tool calling training
* - Most pre-2024 models - Limited function calling capabilities
*
* **Implementation Details:**
* - Intelligent model detection based on known capabilities
* - Custom tool schema formatting for HuggingFace models
* - Enhanced response parsing for function call extraction
* - Graceful fallback for unsupported models
*
* @returns true for supported models, false for unsupported models
*/
supportsTools(): boolean;
protected executeStream(options: StreamOptions, analysisSchema?: ZodType<unknown, ZodTypeDef, unknown> | Schema<unknown>): Promise<StreamResult>;
/**
* Prepare stream options with HuggingFace-specific enhancements
* Handles tool calling optimizations and model-specific formatting
*/
private prepareStreamOptions;
/**
* Enhance system prompt with tool calling instructions for HuggingFace models
* Many HF models benefit from explicit tool calling guidance
*/
private enhanceSystemPromptForTools;
/**
* Format tools for HuggingFace model compatibility
* Some models require specific tool schema formatting
*/
private formatToolsForHuggingFace;
/**
* Get recommendations for tool-calling capable HuggingFace models
* Provides guidance for users who want to use function calling
*/
static getToolCallingRecommendations(): {
recommended: string[];
performance: Record<string, {
speed: number;
quality: number;
cost: number;
}>;
notes: Record<string, string>;
};
/**
* Enhanced error handling with HuggingFace-specific guidance
*/
protected handleProviderError(error: unknown): Error;
protected getProviderName(): AIProviderName;
protected getDefaultModel(): string;
/**
* Returns the Vercel AI SDK model instance for HuggingFace
*/
protected getAISDKModel(): LanguageModelV1;
}
export default HuggingFaceProvider;