UNPKG

@sap-ai-sdk/langchain

Version:

SAP Cloud SDK for AI is the official Software Development Kit (SDK) for **SAP AI Core**, **SAP Generative AI Hub**, and **Orchestration Service**.

61 lines 3.22 kB
import { AIMessageChunk } from '@langchain/core/messages'; import type { AzureOpenAiFunctionObject, AzureOpenAiChatCompletionTool, AzureOpenAiCreateChatCompletionResponse } from '@sap-ai-sdk/foundation-models/internal.js'; import type { AzureOpenAiChatCompletionParameters, AzureOpenAiChatCompletionStreamChunkResponse } from '@sap-ai-sdk/foundation-models'; import type { BaseMessage } from '@langchain/core/messages'; import type { ChatResult } from '@langchain/core/outputs'; import type { AzureOpenAiChatClient } from './chat.js'; import type { AzureOpenAiChatCallOptions, ChatAzureOpenAIToolType } from './types.js'; import type { ToolDefinition } from '@langchain/core/language_models/base'; /** * Determines if the model is a reasoning model. * @param modelName - The name of the model. * @returns True if the model is a reasoning model, false otherwise. * @internal */ export declare function isReasoningModel(modelName: string): boolean; /** * Maps a {@link ChatAzureOpenAIToolType} to {@link AzureOpenAiFunctionObject}. * @param tool - Base class for tools that accept input of any shape defined by a Zod schema. * @param strict - Whether to enforce strict mode for the function call. * @returns The OpenAI chat completion function. * @internal */ export declare function mapToolToOpenAiFunction(tool: ChatAzureOpenAIToolType, strict?: boolean): AzureOpenAiFunctionObject; /** * Maps a LangChain {@link ChatAzureOpenAIToolType} to {@link AzureOpenAiChatCompletionTool}. * @param tool - Base class for tools that accept input of any shape defined by a Zod schema. * @param strict - Whether to enforce strict mode for the function call. * @returns The OpenAI chat completion tool. * @internal */ export declare function mapToolToOpenAiTool(tool: ChatAzureOpenAIToolType, strict?: boolean): AzureOpenAiChatCompletionTool; /** * Maps {@link AzureOpenAiCreateChatCompletionResponse} to LangChain's {@link ChatResult}. * @param completionResponse - The {@link AzureOpenAiCreateChatCompletionResponse} response. * @returns The LangChain {@link ChatResult} * @internal */ export declare function mapOutputToChatResult(completionResponse: AzureOpenAiCreateChatCompletionResponse): ChatResult; /** * Maps LangChain's input interface to the AI SDK client's input interface * @param client The LangChain Azure OpenAI client * @param options The {@link AzureOpenAiChatCallOptions} * @param messages The messages to be send * @returns An AI SDK compatibile request * @internal */ export declare function mapLangChainToAiClient(client: AzureOpenAiChatClient, messages: BaseMessage[], options?: AzureOpenAiChatCallOptions & { promptIndex?: number; }): AzureOpenAiChatCompletionParameters; /** * Converts Azure OpenAI stream chunk to a LangChain message chunk. * @param chunk - The Azure OpenAI stream chunk. * @returns An {@link AIMessageChunk} * @internal */ export declare function mapAzureOpenAiChunkToLangChainMessageChunk(chunk: AzureOpenAiChatCompletionStreamChunkResponse): AIMessageChunk; /** * @internal */ export declare function isToolDefinitionLike(tool: ChatAzureOpenAIToolType): tool is AzureOpenAiChatCompletionTool | ToolDefinition; //# sourceMappingURL=util.d.ts.map