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
24 lines • 1.11 kB
TypeScript
import { BaseMessage, HumanMessage } from '@langchain/core/messages';
/**
* Adds a system message to the chat history.
*
* @param {BaseMessage[]} messages - The message array to extend.
* @param {string} message - The system message content.
*/
export declare function addSystemMessage(messages: BaseMessage[], message: string): BaseMessage[];
/**
* Returns the last human message from the chat history.
*
* @param {BaseMessage[]} messages - The message array to search.
* @returns {HumanMessage | undefined} - The last human message or undefined if not found.
*/
export declare function lastHumanMessage(messages: BaseMessage[]): HumanMessage | undefined;
/**
* Replaces the last human message in the chat history with a new one.
*
* @param {BaseMessage[]} messages - The message array to modify.
* @param {HumanMessage} newMessage - The new human message to replace the last one.
* @returns {BaseMessage[]} - The updated message array.
*/
export declare function replaceLastHumanMessage(messages: BaseMessage[], newMessage: HumanMessage): BaseMessage[];
//# sourceMappingURL=MessageUtils.d.ts.map