UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

80 lines (79 loc) 3.36 kB
import { type LanguageModel, type Schema } from "ai"; import type { ZodType } from "zod"; import type { AIProviderName } from "../constants/enums.js"; import { BaseProvider } from "../core/baseProvider.js"; import type { NeurolinkCredentials, StreamOptions, StreamResult } from "../types/index.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, _sdk?: unknown, credentials?: NeurolinkCredentials["huggingFace"]); /** * 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 | 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 */ formatProviderError(error: unknown): Error; getProviderName(): AIProviderName; getDefaultModel(): string; /** * Returns the Vercel AI SDK model instance for HuggingFace */ getAISDKModel(): LanguageModel; } export default HuggingFaceProvider;