import { OpenAIClient } from '@langchain/openai'; import { AIModelEntity, ICopilotModel } from '@metad/contracts'; import { ChatOAICompatReasoningModel, LargeLanguageModel, TChatModelOptions } from '@xpert-ai/plugin-sdk'; import { AIMessage, AIMessageChunk, BaseMessage } from '@langchain/core/messages'; import { ChatGenerationChunk } from '@langchain/core/outputs'; import { VLLMProviderStrategy } from '../provider.strategy.js'; import { VLLMModelCredentials } from '../types.js'; /** * vLLM-specific chat model that extracts reasoning content from redacted_reasoning tags * and sets it in additional_kwargs.reasoning_content for proper display * Key fix: Override _convertCompletionsDeltaToBaseMessageChunk to handle tags in delta content * This ensures reasoning chunks have empty content, so platform code can recognize reasoning type */ declare class VLLMChatOAICompatReasoningModel extends ChatOAICompatReasoningModel { private accumulatedReasoning; private finalReasoningContent; private inReasoningMode; private reasoningComplete; private readonly thinkingEnabled; constructor(fields: any); /** * Override _convertCompletionsDeltaToBaseMessageChunk to handle vLLM's tag format * This is the key fix: process tags at delta conversion stage, not in streaming * vLLM format: "推理内容正常回复" (tag mixed with content) * Platform logic: if content exists, return type: "text" (only checks reasoning_content if content is empty) * Solution: set content to empty for reasoning chunks, populate reasoning_content */ protected _convertCompletionsDeltaToBaseMessageChunk(delta: Record, rawResponse: OpenAIClient.ChatCompletionChunk, defaultRole?: 'function' | 'user' | 'system' | 'developer' | 'assistant' | 'tool'): AIMessageChunk; /** * Override _convertCompletionsMessageToBaseMessage for non-streaming case * Handle reasoning content from tags in final message */ protected _convertCompletionsMessageToBaseMessage(message: OpenAIClient.ChatCompletionMessage, rawResponse: OpenAIClient.ChatCompletion): AIMessage; /** * Override _generate to extract reasoning content from tags after generation * This handles non-streaming case */ _generate(messages: BaseMessage[], options?: Parameters[1], runManager?: Parameters[2]): Promise; /** * Override streaming to reset state for each new stream * The actual tag processing is done in _convertCompletionsDeltaToBaseMessageChunk */ _streamResponseChunks(messages: BaseMessage[], options?: Parameters[1], runManager?: Parameters[2]): AsyncGenerator; } export declare class VLLMLargeLanguageModel extends LargeLanguageModel { #private; constructor(modelProvider: VLLMProviderStrategy); validateCredentials(model: string, credentials: VLLMModelCredentials): Promise; getChatModel(copilotModel: ICopilotModel, options?: TChatModelOptions): VLLMChatOAICompatReasoningModel; /** * Generate model schema from credentials for customizable models * This method dynamically generates parameter rules including thinking mode * Merges parent class parameter rules (streaming, temperature, etc.) with thinking mode */ getCustomizableModelSchemaFromCredentials(model: string, credentials: Record): AIModelEntity | null; } export {}; //# sourceMappingURL=llm.d.ts.map