ollama-api-facade-js
Version:
OllamaApiFacadeJS is an open-source library for running an ExpressJS backend as an Ollama API using LangChainJS. It supports local language models services like LmStudio and allows seamless message conversion and streaming between LangChainJS and Ollama c
27 lines • 1.15 kB
TypeScript
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
import { StructuredTool } from '@langchain/core/tools';
import { BaseMessage } from '@langchain/core/messages';
/**
* ToolCallService acts as a Facade for handling LangChainJS tools.
* It automatically binds tools to the chat model and processes tool calls.
*/
export declare class ToolCallService {
private chatModel;
private tools;
constructor(chatModel: BaseChatModel);
/**
* Registers tools and returns an instance that manages them.
* @param {StructuredTool[]} tools - The tools to register.
* @returns {{ invoke: (messages: BaseMessage[]) => Promise<AIMessageChunk> }} - New instance with tools bound.
*/
with(tools: StructuredTool[]): {
invoke: (messages: BaseMessage[]) => Promise<import("@langchain/core/messages").AIMessageChunk>;
};
/**
* Invokes the chat model with automatic tool execution.
* @param {BaseMessage[]} messages - The chat history.
* @returns {Promise<AIMessageChunk>} - The final AI response.
*/
private invoke;
}
//# sourceMappingURL=ToolCallService.d.ts.map