@nlux/core
Advanced tools
Comparing version 2.0.12-alpha to 2.1.0-beta
type ChatItem<AiMsg> = { | ||
role: 'ai'; | ||
message: AiMsg; | ||
serverResponse?: string | object | undefined; | ||
} | { | ||
@@ -68,3 +69,3 @@ role: 'user'; | ||
*/ | ||
streamText?: (message: string, observer: StreamingAdapterObserver, extras: ChatAdapterExtras<AiMsg>) => void; | ||
streamText?: (message: string, observer: StreamingAdapterObserver<AiMsg>, extras: ChatAdapterExtras<AiMsg>) => void; | ||
} | ||
@@ -75,3 +76,3 @@ /** | ||
*/ | ||
interface StreamingAdapterObserver { | ||
interface StreamingAdapterObserver<ChunkType = string> { | ||
/** | ||
@@ -96,5 +97,5 @@ * This method should be called by the adapter when it has completed sending data to the AiChat user interface. | ||
* This method should be called by the adapter when it has new data to send to the AiChat user interface. | ||
* @param {string} message | ||
* @param {ChunkType} chunk being sent as part of the stream. | ||
*/ | ||
next(message: string): void; | ||
next(chunk: ChunkType): void; | ||
} | ||
@@ -125,6 +126,8 @@ | ||
get dataTransferMode(): DataTransferMode; | ||
fetchText(message: string, extras: ChatAdapterExtras<AiMsg>): Promise<AiMsg>; | ||
fetchText(message: string, extras: ChatAdapterExtras<AiMsg>): Promise<string | object | undefined>; | ||
get id(): string; | ||
get info(): StandardAdapterInfo; | ||
streamText(message: string, observer: StreamingAdapterObserver, extras: ChatAdapterExtras<AiMsg>): void; | ||
preProcessAiStreamedChunk(chunk: string | object | undefined, extras: ChatAdapterExtras<AiMsg>): AiMsg | undefined; | ||
preProcessAiUnifiedMessage(message: string | object | undefined, extras: ChatAdapterExtras<AiMsg>): AiMsg | undefined; | ||
streamText(message: string, observer: StreamingAdapterObserver<string | object | undefined>, extras: ChatAdapterExtras<AiMsg>): void; | ||
} | ||
@@ -281,3 +284,3 @@ | ||
type AnyAiMsg = any; | ||
type AnyAiMsg = unknown; | ||
@@ -567,4 +570,4 @@ declare const NLErrors: { | ||
declare class AiChat<AiMsg = string> implements IAiChat<AiMsg> { | ||
protected theAdapter: ChatAdapter<AiMsg> | null; | ||
protected theAdapterBuilder: StandardChatAdapter<AiMsg> | null; | ||
protected theAdapter: ChatAdapter<AiMsg> | StandardChatAdapter<AiMsg> | null; | ||
protected theAdapterBuilder: ChatAdapterBuilder<AiMsg> | null; | ||
protected theAdapterType: 'builder' | 'instance' | null; | ||
@@ -679,5 +682,8 @@ protected theClassName: string | null; | ||
type CallbackArgType = object | string | number | boolean | symbol | null | undefined | void; | ||
type CallbackFunction = (...args: CallbackArgType[]) => CallbackArgType; | ||
type StreamParser = (root: HTMLElement, syntaxHighlighter?: HighlighterExtension) => IObserver<string>; | ||
type StandardStreamParserOutput = IObserver<string> & { | ||
onComplete(completeCallback: Function): void; | ||
onComplete(completeCallback: CallbackFunction): void; | ||
}; | ||
@@ -962,3 +968,3 @@ type StandardStreamParser = (root: HTMLElement, syntaxHighlighter?: HighlighterExtension, options?: { | ||
discard(): void; | ||
setCallback(callback: Function): void; | ||
setCallback(callback: CallbackFunction): void; | ||
setDescription(description: string): void; | ||
@@ -1084,3 +1090,3 @@ setParamDescriptions(paramDescriptions: string[]): void; | ||
*/ | ||
registerTask(taskId: string, description: string, callback: Function, paramDescriptions?: string[]): ContextTaskHandler | undefined; | ||
registerTask(taskId: string, description: string, callback: CallbackFunction, paramDescriptions?: string[]): ContextTaskHandler | undefined; | ||
/** | ||
@@ -1114,3 +1120,3 @@ * Resets the context instance and sets the provided data. The contextId will not change after the reset operation | ||
*/ | ||
runTask(taskId: string, parameters?: Array<any>): Promise<RunTaskResult>; | ||
runTask(taskId: string, parameters?: Array<CallbackArgType>): Promise<RunTaskResult>; | ||
/** | ||
@@ -1117,0 +1123,0 @@ * Get the status of the context. |
{ | ||
"name": "@nlux/core", | ||
"version": "2.0.12-alpha", | ||
"version": "2.1.0-beta", | ||
"description": "nlux is Javascript and React library for building conversational AI interfaces, with support for OpenAI, Hugging Face, and more.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
497365
2811
0