@wabot-dev/framework 0.1.0-beta.5 → 0.1.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,10 +8,12 @@ import { ChatBotAdapter } from '../../chatbot/ChatBotAdapter.js';
|
|
|
8
8
|
import 'reflect-metadata';
|
|
9
9
|
import '../../mindset/metadata/MindsetMetadataStore.js';
|
|
10
10
|
import { MindsetOperator } from '../../mindset/MindsetOperator.js';
|
|
11
|
+
import { Logger } from '../../logger/Logger.js';
|
|
11
12
|
|
|
12
13
|
let OpenaiChatBotAdapter = class OpenaiChatBotAdapter extends ChatBotAdapter {
|
|
13
14
|
openai = new OpenAI();
|
|
14
15
|
model;
|
|
16
|
+
logger = new Logger('wabot:openai-chat-bot-adapter');
|
|
15
17
|
constructor(mindset) {
|
|
16
18
|
super(mindset);
|
|
17
19
|
const model = process.env.OPENAI_CHAT_MODEL;
|
|
@@ -26,11 +28,13 @@ let OpenaiChatBotAdapter = class OpenaiChatBotAdapter extends ChatBotAdapter {
|
|
|
26
28
|
const parameters = { ...fn.parameters, additionalProperties: false, type: 'object' };
|
|
27
29
|
return { ...fn, type: 'function', parameters, strict: true };
|
|
28
30
|
});
|
|
29
|
-
const
|
|
31
|
+
const request = {
|
|
30
32
|
model: this.model,
|
|
31
33
|
input: [{ role: 'system', content: systemPrompt }, ...this.mapChatItems(chatItems)],
|
|
32
34
|
tools,
|
|
33
|
-
}
|
|
35
|
+
};
|
|
36
|
+
this.logger.debug(`Call Api with Request: ${JSON.stringify(request)}`);
|
|
37
|
+
const response = await this.openai.responses.create(request);
|
|
34
38
|
let newChatItem;
|
|
35
39
|
if (response.output_text) {
|
|
36
40
|
newChatItem = await this.buildBotMessageItem(response.output_text);
|
package/dist/src/index.d.ts
CHANGED
|
@@ -379,6 +379,7 @@ declare class DeepSeekChatBotAdapter extends ChatBotAdapter {
|
|
|
379
379
|
declare class OpenaiChatBotAdapter extends ChatBotAdapter {
|
|
380
380
|
private openai;
|
|
381
381
|
private model;
|
|
382
|
+
private logger;
|
|
382
383
|
constructor(mindset: MindsetOperator);
|
|
383
384
|
generateNextChatItem(chatItems: ChatItem[]): Promise<ChatItem>;
|
|
384
385
|
private mapChatItems;
|