@langchain/core
Advanced tools
Comparing version 0.1.27 to 0.1.28
@@ -19,8 +19,39 @@ import { Serializable } from "./load/serializable.js"; | ||
export declare abstract class BaseListChatMessageHistory extends Serializable { | ||
/** Returns a list of messages stored in the store. */ | ||
abstract getMessages(): Promise<BaseMessage[]>; | ||
/** | ||
* Add a message object to the store. | ||
*/ | ||
abstract addMessage(message: BaseMessage): Promise<void>; | ||
/** | ||
* This is a convenience method for adding a human message string to the store. | ||
* Please note that this is a convenience method. Code should favor the | ||
* bulk addMessages interface instead to save on round-trips to the underlying | ||
* persistence layer. | ||
* This method may be deprecated in a future release. | ||
*/ | ||
addUserMessage(message: string): Promise<void>; | ||
/** @deprecated Use addAIMessage instead */ | ||
addAIChatMessage(message: string): Promise<void>; | ||
/** | ||
* This is a convenience method for adding an AI message string to the store. | ||
* Please note that this is a convenience method. Code should favor the bulk | ||
* addMessages interface instead to save on round-trips to the underlying | ||
* persistence layer. | ||
* This method may be deprecated in a future release. | ||
*/ | ||
addAIMessage(message: string): Promise<void>; | ||
abstract getMessages(): Promise<BaseMessage[]>; | ||
/** | ||
* Add a list of messages. | ||
* | ||
* Implementations should override this method to handle bulk addition of messages | ||
* in an efficient manner to avoid unnecessary round-trips to the underlying store. | ||
* | ||
* @param messages - A list of BaseMessage objects to store. | ||
*/ | ||
addMessages(messages: BaseMessage[]): Promise<void>; | ||
/** | ||
* Remove all messages from the store. | ||
*/ | ||
clear(): Promise<void>; | ||
} |
@@ -14,2 +14,9 @@ import { Serializable } from "./load/serializable.js"; | ||
export class BaseListChatMessageHistory extends Serializable { | ||
/** | ||
* This is a convenience method for adding a human message string to the store. | ||
* Please note that this is a convenience method. Code should favor the | ||
* bulk addMessages interface instead to save on round-trips to the underlying | ||
* persistence layer. | ||
* This method may be deprecated in a future release. | ||
*/ | ||
addUserMessage(message) { | ||
@@ -22,5 +29,31 @@ return this.addMessage(new HumanMessage(message)); | ||
} | ||
/** | ||
* This is a convenience method for adding an AI message string to the store. | ||
* Please note that this is a convenience method. Code should favor the bulk | ||
* addMessages interface instead to save on round-trips to the underlying | ||
* persistence layer. | ||
* This method may be deprecated in a future release. | ||
*/ | ||
addAIMessage(message) { | ||
return this.addMessage(new AIMessage(message)); | ||
} | ||
/** | ||
* Add a list of messages. | ||
* | ||
* Implementations should override this method to handle bulk addition of messages | ||
* in an efficient manner to avoid unnecessary round-trips to the underlying store. | ||
* | ||
* @param messages - A list of BaseMessage objects to store. | ||
*/ | ||
async addMessages(messages) { | ||
for (const message of messages) { | ||
await this.addMessage(message); | ||
} | ||
} | ||
/** | ||
* Remove all messages from the store. | ||
*/ | ||
clear() { | ||
throw new Error("Not implemented."); | ||
} | ||
} |
@@ -51,3 +51,3 @@ import { type BaseMessage, BaseMessageChunk, type BaseMessageLike } from "../messages/index.js"; | ||
constructor(fields: BaseChatModelParams); | ||
abstract _combineLLMOutput?(...llmOutputs: LLMResult["llmOutput"][]): LLMResult["llmOutput"]; | ||
_combineLLMOutput?(...llmOutputs: LLMResult["llmOutput"][]): LLMResult["llmOutput"]; | ||
protected _separateRunnableConfigFromCallOptions(options?: Partial<CallOptions>): [RunnableConfig, this["ParsedCallOptions"]]; | ||
@@ -54,0 +54,0 @@ /** |
import type { OptionalImportMap, SecretMap } from "./import_type.js"; | ||
export declare function load<T>(text: string, { secretsMap, importMap, optionalImportsMap, optionalImportEntrypoints, }: { | ||
secretsMap: SecretMap; | ||
optionalImportsMap: OptionalImportMap; | ||
optionalImportEntrypoints: string[]; | ||
importMap: Record<string, unknown>; | ||
export declare function load<T>(text: string, mappings?: { | ||
secretsMap?: SecretMap; | ||
optionalImportsMap?: OptionalImportMap; | ||
optionalImportEntrypoints?: string[]; | ||
importMap?: Record<string, unknown>; | ||
}): Promise<T>; |
@@ -19,3 +19,3 @@ import { get_lc_unique_name, } from "./serializable.js"; | ||
async function reviver(value) { | ||
const { optionalImportsMap, optionalImportEntrypoints, importMap, secretsMap, path = ["$"], } = this; | ||
const { optionalImportsMap = {}, optionalImportEntrypoints = [], importMap = {}, secretsMap = {}, path = ["$"], } = this; | ||
const pathStr = path.join("."); | ||
@@ -160,5 +160,5 @@ if (typeof value === "object" && | ||
} | ||
export async function load(text, { secretsMap, importMap, optionalImportsMap, optionalImportEntrypoints, }) { | ||
export async function load(text, mappings) { | ||
const json = JSON.parse(text); | ||
return reviver.call({ secretsMap, optionalImportsMap, optionalImportEntrypoints, importMap }, json); | ||
return reviver.call({ ...mappings }, json); | ||
} |
@@ -104,3 +104,3 @@ import { type Operation as JSONPatchOperation } from "../utils/fast-json-patch/index.js"; | ||
* | ||
* Schema of a streaming event which is produced from the astream_events method. | ||
* Schema of a streaming event which is produced from the streamEvents method. | ||
*/ | ||
@@ -107,0 +107,0 @@ export type StreamEvent = { |
{ | ||
"name": "@langchain/core", | ||
"version": "0.1.27", | ||
"version": "0.1.28", | ||
"description": "Core LangChain.js abstractions and schemas", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1562031
38768