@fireaw.ai/sdk
Advanced tools
Comparing version 0.3.0 to 0.4.0
type Message = { | ||
/** | ||
* The internal id of the message | ||
*/ | ||
id: string; | ||
/** | ||
* The message text | ||
*/ | ||
content: string; | ||
role: string; | ||
/** | ||
* Whether the message was sent by the user or the assistant | ||
*/ | ||
role: "user" | "assistant"; | ||
/** | ||
* The utc timestamp when the message was created | ||
*/ | ||
created_at: string; | ||
/** | ||
* The number of tokens the message costs | ||
*/ | ||
tokens: number; | ||
/** | ||
* The estimated cost of the message in USD | ||
*/ | ||
cost: number; | ||
/** | ||
* True when all content has been received, otherwise false | ||
*/ | ||
finished: boolean; | ||
/** | ||
* The document chunks that were retreived and injected into the user prompt as "{{docs}}". | ||
* This is only present when the message is an assistant message, finished is true, and | ||
* the ChatChannel was created with the includeConyext option set to true. | ||
*/ | ||
context: string; | ||
}; | ||
@@ -14,2 +42,3 @@ type ChatChannelProps = { | ||
host?: string; | ||
includeContext?: boolean; | ||
}; | ||
@@ -22,6 +51,7 @@ export default class ChatChannel { | ||
private readonly host; | ||
private readonly includeContext; | ||
chat: any; | ||
private consumer?; | ||
private subscription?; | ||
constructor({ apiToken, chatbotId, onMessage, host, }: ChatChannelProps); | ||
constructor({ apiToken, chatbotId, onMessage, host, includeContext, }: ChatChannelProps); | ||
connect(): Promise<void>; | ||
@@ -28,0 +58,0 @@ get apiHost(): string; |
@@ -14,3 +14,3 @@ "use strict"; | ||
class ChatChannel { | ||
constructor({ apiToken, chatbotId, onMessage, host = "www.fireaw.ai", }) { | ||
constructor({ apiToken, chatbotId, onMessage, host = "www.fireaw.ai", includeContext = false, }) { | ||
this.apiToken = apiToken; | ||
@@ -21,2 +21,3 @@ this.chatbotId = chatbotId; | ||
this.host = host; | ||
this.includeContext = includeContext; | ||
} | ||
@@ -51,2 +52,3 @@ connect() { | ||
collection_id: this.chatbotId, | ||
include_context: this.includeContext, | ||
}, | ||
@@ -53,0 +55,0 @@ }), |
{ | ||
"name": "@fireaw.ai/sdk", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "build": "mkdir -p dist; tsc; cp package.json README.md LICENSE dist", |
8255
159