@futdevpro/nts-dynamo 1.11.16 → 1.11.17

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.
Files changed (37) hide show
  1. package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts +1 -1
  2. package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts.map +1 -1
  3. package/build/_modules/discord-assistant/_services/dias-chunk.data-service.js +31 -13
  4. package/build/_modules/discord-assistant/_services/dias-chunk.data-service.js.map +1 -1
  5. package/build/_modules/discord-assistant/_services/dias-io.control-service.js +6 -2
  6. package/build/_modules/discord-assistant/_services/dias-io.control-service.js.map +1 -1
  7. package/build/_modules/discord-bot/_collections/dibo-global-settings.conts.d.ts +1 -1
  8. package/build/_modules/discord-bot/_collections/dibo-global-settings.conts.d.ts.map +1 -1
  9. package/build/_modules/discord-bot/_models/dibo-global-settings.interface.d.ts +88 -0
  10. package/build/_modules/discord-bot/_models/dibo-global-settings.interface.d.ts.map +1 -0
  11. package/build/_modules/discord-bot/_models/dibo-global-settings.interface.js +3 -0
  12. package/build/_modules/discord-bot/_models/dibo-global-settings.interface.js.map +1 -0
  13. package/build/_modules/discord-bot/_services/dibo-routines.control-service.d.ts +0 -1
  14. package/build/_modules/discord-bot/_services/dibo-routines.control-service.d.ts.map +1 -1
  15. package/build/_modules/discord-bot/_services/dibo-routines.control-service.js +0 -3
  16. package/build/_modules/discord-bot/_services/dibo-routines.control-service.js.map +1 -1
  17. package/build/_modules/discord-bot/index.d.ts +1 -1
  18. package/build/_modules/discord-bot/index.d.ts.map +1 -1
  19. package/build/_modules/discord-bot/index.js +1 -1
  20. package/build/_modules/discord-bot/index.js.map +1 -1
  21. package/build/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts +284 -58
  22. package/build/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts.map +1 -1
  23. package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js +91 -104
  24. package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js.map +1 -1
  25. package/build/_modules/open-ai/_services/oai-llm.service-base.d.ts +246 -53
  26. package/build/_modules/open-ai/_services/oai-llm.service-base.d.ts.map +1 -1
  27. package/build/_modules/open-ai/_services/oai-llm.service-base.js +86 -96
  28. package/build/_modules/open-ai/_services/oai-llm.service-base.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/_modules/discord-assistant/_services/dias-chunk.data-service.ts +26 -25
  31. package/src/_modules/discord-assistant/_services/dias-io.control-service.ts +6 -6
  32. package/src/_modules/discord-bot/_collections/dibo-global-settings.conts.ts +1 -1
  33. package/src/_modules/discord-bot/_services/dibo-routines.control-service.ts +2 -2
  34. package/src/_modules/discord-bot/index.ts +1 -1
  35. package/src/_modules/open-ai/_services/oai-llm-chat.service-base.ts +233 -249
  36. package/src/_modules/open-ai/_services/oai-llm.service-base.ts +189 -147
  37. /package/src/_modules/discord-bot/_models/{global-bot-log-settings.interface.ts → dibo-global-settings.interface.ts} +0 -0
@@ -21,12 +21,10 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
21
21
  * Uses the {@link DyNTS_OAI_LLM_Predefined_Requests.yesNo.request} to ask the question,
22
22
  * and the {@link DyNTS_OAI_LLM_Predefined_Requests.yesNo.upperCaseYes} to check the answer
23
23
  */
24
- async yesNoQuestionInConversation(conversation, question, issuer, debugLog, settings,
25
- /** this is used to readably replace too long contents to eg '...' in logs */
26
- replaceThisInLog) {
27
- question += this.predefinedRequests.yesNo.request;
28
- this.logQuestion(question, replaceThisInLog, debugLog);
29
- const answer = await this.getAnswerInConversation(conversation, question, issuer, settings, debugLog, replaceThisInLog);
24
+ async yesNoQuestionInConversation(set) {
25
+ set.question += this.predefinedRequests.yesNo.request;
26
+ this.logQuestion(set);
27
+ const answer = await this.getQuestionAnswerInConversation(set);
30
28
  return answer.toUpperCase().includes(this.predefinedRequests.yesNo.upperCaseYes);
31
29
  }
32
30
  askYesNoQuestionInConversation = this.yesNoQuestionInConversation;
@@ -35,11 +33,9 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
35
33
  *
36
34
  * Uses the {@link DyNTS_OAI_LLM_Predefined_Requests.simpleQuestion} to ask the question
37
35
  */
38
- async simpleQuestionInConversation(conversation, question, issuer, settings, debugLog,
39
- /** this is used to readably replace too long contents to eg '...' in logs */
40
- replaceThisInLog) {
41
- this.logQuestion(question, replaceThisInLog, debugLog);
42
- return await this.getAnswerInConversation(conversation, question, issuer, settings, debugLog, replaceThisInLog);
36
+ async simpleQuestionInConversation(set) {
37
+ this.logQuestion(set);
38
+ return await this.getQuestionAnswerInConversation(set);
43
39
  }
44
40
  askSimpleQuestionInConversation = this.simpleQuestionInConversation;
45
41
  /**
@@ -47,15 +43,13 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
47
43
  *
48
44
  * Uses the {@link DyNTS_OAI_LLM_Predefined_Requests.percentageOnly} to ask the question
49
45
  */
50
- async percentageQuestionInConversation(conversation, question, issuer, settings, debugLog,
51
- /** this is used to readably replace too long contents to eg '...' in logs */
52
- replaceThisInLog) {
53
- question += this.predefinedRequests.percentageOnly;
54
- this.logQuestion(question, replaceThisInLog, debugLog);
55
- const answer = await this.getAnswerInConversation(conversation, question, issuer, settings, debugLog, replaceThisInLog);
46
+ async percentageQuestionInConversation(set) {
47
+ set.question += this.predefinedRequests.percentageOnly;
48
+ this.logQuestion(set);
49
+ const answer = await this.getQuestionAnswerInConversation(set);
56
50
  if (isNaN(+answer)) {
57
51
  fsm_dynamo_1.DyFM_Log.error('GPT_ServiceBase', 'asykPercentageQuestion', 'Invalid answer', {
58
- question,
52
+ question: set.question,
59
53
  answer,
60
54
  });
61
55
  return null;
@@ -68,16 +62,14 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
68
62
  *
69
63
  * Uses the {@link DyNTS_OAI_LLM_Predefined_Requests.selectRequest} to ask the question
70
64
  */
71
- async selectQuestionInConversation(conversation, question, selectFrom, issuer, settings, debugLog,
72
- /** this is used to readably replace too long contents to eg '...' in logs */
73
- replaceThisInLog) {
65
+ async selectQuestionInConversation(set) {
74
66
  // replace the {{DyNTS_selectOptions}} with the list of options
75
- const selectQuestionAddition = this.predefinedRequests.selectRequest.replace('{{DyNTS_selectOptions}}', this.getTextListAsText(selectFrom));
76
- question += selectQuestionAddition;
77
- this.logQuestion(question, replaceThisInLog, debugLog);
78
- let answer = await this.getAnswerInConversation(conversation, question, issuer, settings, debugLog, replaceThisInLog);
67
+ const selectQuestionAddition = this.predefinedRequests.selectRequest.replace('{{DyNTS_selectOptions}}', this.getTextListAsText(set.selectFrom));
68
+ set.question += selectQuestionAddition;
69
+ this.logQuestion(set);
70
+ let answer = await this.getQuestionAnswerInConversation(set);
79
71
  answer = answer.toLocaleUpperCase();
80
- for (const item of selectFrom) {
72
+ for (const item of set.selectFrom) {
81
73
  if (answer.includes(item.toLocaleUpperCase()))
82
74
  return item;
83
75
  }
@@ -91,13 +83,11 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
91
83
  *
92
84
  * Uses the {@link DyNTS_OAI_LLM_Predefined_Requests.selectRequest} to ask the question
93
85
  */
94
- async requestSelectInConversation(conversation, question, selectFrom, issuer, settings, debugLog,
95
- /** this is used to readably replace too long contents to eg '...' in logs */
96
- replaceThisInLog) {
97
- const selectQuestionAddition = this.predefinedRequests.selectRequest.replace('{{DyNTS_selectOptions}}', this.getTextListAsText(selectFrom.map(item => `"${JSON.stringify(item)}"`)));
98
- question += selectQuestionAddition;
99
- this.logQuestion(question, null, debugLog);
100
- const answer = await this.getAnswerInConversation(conversation, question, issuer, settings, debugLog, replaceThisInLog);
86
+ async requestSelectInConversation(set) {
87
+ const selectQuestionAddition = this.predefinedRequests.selectRequest.replace('{{DyNTS_selectOptions}}', this.getTextListAsText(set.selectFrom.map(item => `"${JSON.stringify(item)}"`)));
88
+ set.question += selectQuestionAddition;
89
+ this.logQuestion(set);
90
+ const answer = await this.getQuestionAnswerInConversation(set);
101
91
  return (0, oai_llm_service_base_1.DyFM_safeParseJSON)(answer);
102
92
  }
103
93
  askRequestSelectInConversation = this.requestSelectInConversation;
@@ -106,15 +96,13 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
106
96
  *
107
97
  * Uses the {@link DyNTS_OAI_LLM_Predefined_Requests.multiselect} to ask the question
108
98
  */
109
- async multipleSelectQuestionWithOptionsInConversation(conversation, question, options, issuer, settings, debugLog,
110
- /** this is used to readably replace too long contents to eg '...' in logs */
111
- replaceThisInLog) {
112
- const selectQuestionAddition = this.predefinedRequests.multiselect.replace('{{DyNTS_selectOptions}}', this.getTextListAsText(options));
113
- question += selectQuestionAddition;
114
- let answer = await this.getAnswerInConversation(conversation, question, issuer, settings, debugLog, replaceThisInLog);
99
+ async multipleSelectQuestionWithOptionsInConversation(set) {
100
+ const selectQuestionAddition = this.predefinedRequests.multiselect.replace('{{DyNTS_selectOptions}}', this.getTextListAsText(set.options));
101
+ set.question += selectQuestionAddition;
102
+ let answer = await this.getQuestionAnswerInConversation(set);
115
103
  answer = answer.toLocaleUpperCase();
116
104
  const result = [];
117
- for (const item of options) {
105
+ for (const item of set.options) {
118
106
  if (answer.includes(item.toLocaleUpperCase())) {
119
107
  result.push(item);
120
108
  }
@@ -129,13 +117,11 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
129
117
  *
130
118
  * Uses the {@link DyNTS_OAI_LLM_Predefined_Requests.multiselect} to ask the question
131
119
  */
132
- async requestMultipleSelectInConversation(conversation, question, options, issuer, settings, debugLog,
133
- /** this is used to readably replace too long contents to eg '...' in logs */
134
- replaceThisInLog) {
135
- const selectQuestionAddition = this.predefinedRequests.multiselect.replace('{{DyNTS_selectOptions}}', this.getTextListAsText(options.map(item => `"${JSON.stringify(item)}"`)));
136
- question += selectQuestionAddition;
137
- this.logQuestion(question, null, debugLog);
138
- const answer = await this.getAnswerInConversation(conversation, question, issuer, settings, debugLog, replaceThisInLog);
120
+ async requestMultipleSelectInConversation(set) {
121
+ const selectQuestionAddition = this.predefinedRequests.multiselect.replace('{{DyNTS_selectOptions}}', this.getTextListAsText(set.options.map(item => `"${JSON.stringify(item)}"`)));
122
+ set.question += selectQuestionAddition;
123
+ this.logQuestion(set);
124
+ const answer = await this.getQuestionAnswerInConversation(set);
139
125
  return (0, oai_llm_service_base_1.DyFM_safeParseList)(answer);
140
126
  }
141
127
  askRequestMultipleSelectInConversation = this.requestMultipleSelectInConversation;
@@ -148,12 +134,10 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
148
134
  *
149
135
  * (uses {@link DyFM_safeParseJSON})
150
136
  */
151
- async jsonQuestionInConversation(conversation, question, issuer, settings, debugLog,
152
- /** this is used to readably replace too long contents to eg '...' in logs */
153
- replaceThisInLog) {
154
- question += this.predefinedRequests.jsonRequest;
155
- this.logQuestion(question, replaceThisInLog, debugLog);
156
- const answer = await this.getAnswerInConversation(conversation, question, issuer, settings, debugLog, replaceThisInLog);
137
+ async jsonQuestionInConversation(set) {
138
+ set.question += this.predefinedRequests.jsonRequest;
139
+ this.logQuestion(set);
140
+ const answer = await this.getQuestionAnswerInConversation(set);
157
141
  return (0, oai_llm_service_base_1.DyFM_safeParseJSON)(answer);
158
142
  }
159
143
  askJsonQuestionInConversation = this.jsonQuestionInConversation;
@@ -166,13 +150,11 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
166
150
  *
167
151
  * (uses {@link DyFM_safeParseJSON})
168
152
  */
169
- async jsonQuestionWithKeysDescriptionInConversation(conversation, question, keysDescription, issuer, settings, debugLog,
170
- /** this is used to readably replace too long contents to eg '...' in logs */
171
- replaceThisInLog) {
172
- const jsonRequestWithKeysDescription = this.predefinedRequests.jsonRequestWithKeysDescription.replace('{{DyNTS_jsonKeysDescription}}', keysDescription);
173
- question += jsonRequestWithKeysDescription;
174
- this.logQuestion(question, replaceThisInLog, debugLog);
175
- const answer = await this.getAnswerInConversation(conversation, question, issuer, settings, debugLog, replaceThisInLog);
153
+ async jsonQuestionWithKeysDescriptionInConversation(set) {
154
+ const jsonRequestWithKeysDescription = this.predefinedRequests.jsonRequestWithKeysDescription.replace('{{DyNTS_jsonKeysDescription}}', set.keysDescription);
155
+ set.question += jsonRequestWithKeysDescription;
156
+ this.logQuestion(set);
157
+ const answer = await this.getQuestionAnswerInConversation(set);
176
158
  return (0, oai_llm_service_base_1.DyFM_safeParseJSON)(answer);
177
159
  }
178
160
  askJsonQuestionWithKeysDescriptionInConversation = this.jsonQuestionWithKeysDescriptionInConversation;
@@ -185,13 +167,11 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
185
167
  *
186
168
  * (uses {@link DyFM_safeParseJSON})
187
169
  */
188
- async jsonQuestionWithExactKeysInConversation(conversation, question, keys, issuer, settings, debugLog,
189
- /** this is used to readably replace too long contents to eg '...' in logs */
190
- replaceThisInLog) {
191
- const jsonRequestWithExactKeys = this.predefinedRequests.jsonRequestWithExactKeys.replace('{{DyNTS_jsonKeys}}', this.getTextListAsText(keys));
192
- question += jsonRequestWithExactKeys;
193
- this.logQuestion(question, replaceThisInLog, debugLog);
194
- const answer = await this.getAnswerInConversation(conversation, question, issuer, settings, debugLog, replaceThisInLog);
170
+ async jsonQuestionWithExactKeysInConversation(set) {
171
+ const jsonRequestWithExactKeys = this.predefinedRequests.jsonRequestWithExactKeys.replace('{{DyNTS_jsonKeys}}', this.getTextListAsText(set.keys));
172
+ set.question += jsonRequestWithExactKeys;
173
+ this.logQuestion(set);
174
+ const answer = await this.getQuestionAnswerInConversation(set);
195
175
  return (0, oai_llm_service_base_1.DyFM_safeParseJSON)(answer);
196
176
  }
197
177
  askJsonQuestionWithExactKeysInConversation = this.jsonQuestionWithExactKeysInConversation;
@@ -204,12 +184,10 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
204
184
  *
205
185
  * (uses {@link DyFM_safeParseList})
206
186
  */
207
- async listQuestionInConversation(conversation, question, issuer, settings, debugLog,
208
- /** this is used to readably replace too long contents to eg '...' in logs */
209
- replaceThisInLog) {
210
- question += this.predefinedRequests.listRequest;
211
- this.logQuestion(question, replaceThisInLog, debugLog);
212
- const answer = await this.getAnswerInConversation(conversation, question, issuer, settings, debugLog, replaceThisInLog);
187
+ async listQuestionInConversation(set) {
188
+ set.question += this.predefinedRequests.listRequest;
189
+ this.logQuestion(set);
190
+ const answer = await this.getQuestionAnswerInConversation(set);
213
191
  return (0, oai_llm_service_base_1.DyFM_safeParseList)(answer);
214
192
  }
215
193
  askListQuestionInConversation = this.listQuestionInConversation;
@@ -238,6 +216,15 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
238
216
 
239
217
  return answer;
240
218
  } */
219
+ async getQuestionAnswerInConversation(set) {
220
+ return await this.getAnswerInConversation({
221
+ ...set,
222
+ newMessage: set.question,
223
+ });
224
+ }
225
+ /* getQuestionAnswerInConversation = this.getAnswerInConversation; */
226
+ getQuestionInConversation = this.getQuestionAnswerInConversation;
227
+ askQuestionInConversation = this.getQuestionAnswerInConversation;
241
228
  /**
242
229
  * Asks the AI to answer a question using the whole conversation
243
230
  * (If you want to use only the conversation, without adding a new message,
@@ -245,57 +232,59 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
245
232
  *
246
233
  * Uses the {@link resolveConversation}
247
234
  */
248
- async getAnswerInConversation(conversation, newMessage, issuer, settings, debugLog,
249
- /** this is used to readably replace too long contents to eg '...' in logs */
250
- replaceThisInLog) {
251
- conversation.push({
235
+ async getAnswerInConversation(set) {
236
+ set.conversation.push({
252
237
  role: oai_gpt_message_role_enum_1.DyNTS_OAI_GPT_Message_Role.user,
253
- content: newMessage,
238
+ content: set.newMessage,
254
239
  });
255
- const answer = (await this.resolveConversation(conversation, issuer, settings, false, debugLog, replaceThisInLog));
256
- if (debugLog || this.debugLog) {
240
+ const answer = await this.resolveConversationMessage(set);
241
+ if (set.debugLog || this.debugLog) {
257
242
  console.log(' - answer: ', answer);
258
243
  }
259
244
  return answer;
260
245
  }
261
- getQuestionAnswerInConversation = this.getAnswerInConversation;
262
- getQuestionInConversation = this.getAnswerInConversation;
263
- askQuestionInConversation = this.getAnswerInConversation;
246
+ async resolveConversationMessage(set) {
247
+ return await this.resolveConversation(set);
248
+ }
264
249
  /**
265
250
  * Resolves a conversation
266
251
  *
267
252
  * Uses the {@link getMessageCreateInput}
268
253
  */
269
- async resolveConversation(conversation, issuer, settings, getFullResponse, debugLog,
270
- /** this is used to readably replace too long contents to eg '...' in logs */
271
- replaceThisInLog) {
254
+ async resolveConversation(set) {
272
255
  try {
273
- conversation.unshift(this.getDefaultSystemMessage(settings));
256
+ set.conversation.unshift(this.getDefaultSystemMessage(set.settings));
274
257
  // conversation shortening
275
- const shortenedConversation = this.shortenConversation(conversation, issuer, debugLog);
276
- this.logConversation(shortenedConversation, debugLog, replaceThisInLog);
277
- const result = await this.openai.chat.completions.create(this.getMessageCreateInput(shortenedConversation, issuer, settings));
278
- if (getFullResponse) {
258
+ const shortenedConversation = this.shortenConversation(set);
259
+ this.logConversation({
260
+ ...set,
261
+ conversation: shortenedConversation,
262
+ });
263
+ const result = await this.openai.chat.completions.create(this.getMessageCreateInput({
264
+ ...set,
265
+ conversation: shortenedConversation,
266
+ }));
267
+ if (set.getFullResponse) {
279
268
  return result;
280
269
  }
281
270
  return result.choices[0].message.content;
282
271
  }
283
272
  catch (error) {
284
273
  throw new fsm_dynamo_1.DyFM_Error({
285
- ...this.getDefaultErrorSettings('resolveConversation', error, issuer),
274
+ ...this.getDefaultErrorSettings('resolveConversation', error, set.issuer),
286
275
  errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-OAB-RC0`,
287
276
  });
288
277
  }
289
278
  }
290
279
  resolveSimpleUserMessageInConversation = this.resolveConversation;
291
- shortenConversation(conversation, issuer, debugLog) {
280
+ shortenConversation(set) {
292
281
  try {
293
- const clonedConversation = (0, fsm_dynamo_1.DyFM_clone)(conversation);
282
+ const clonedConversation = (0, fsm_dynamo_1.DyFM_clone)(set.conversation);
294
283
  const systemMessages = clonedConversation.filter(message => message.role === oai_gpt_message_role_enum_1.DyNTS_OAI_GPT_Message_Role.system);
295
284
  const systemMessagesStringLength = JSON.stringify(systemMessages).length;
296
285
  const msgs = clonedConversation.filter(message => message.role !== oai_gpt_message_role_enum_1.DyNTS_OAI_GPT_Message_Role.system).map(message => message.content);
297
286
  let stringifiedMessages = JSON.stringify(msgs);
298
- if (this.debugLog || debugLog) {
287
+ if (this.debugLog || set.debugLog) {
299
288
  console.log('stringifiedMessagesCount before removing', stringifiedMessages.length);
300
289
  }
301
290
  let removedMessagesCount = 0;
@@ -308,14 +297,14 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
308
297
  stringifiedMessages = JSON.stringify(msgs);
309
298
  lastStringifiedMessagesLength = stringifiedMessages.length;
310
299
  }
311
- if (this.debugLog || debugLog) {
300
+ if (this.debugLog || set.debugLog) {
312
301
  console.log('removedMessagesCount', removedMessagesCount);
313
302
  console.log('lastStringifiedMessagesLength', lastStringifiedMessagesLength);
314
303
  }
315
304
  if (!clonedConversation.length) {
316
305
  fsm_dynamo_1.DyFM_Log.error('No conversation messages (left)', {
317
306
  /* conversation: DyFM_clone(conversation), */
318
- conversationLength: conversation.length,
307
+ conversationLength: set.conversation.length,
319
308
  clonedConversation: (0, fsm_dynamo_1.DyFM_clone)(clonedConversation),
320
309
  });
321
310
  throw new Error('No conversation messages (left)');
@@ -325,17 +314,15 @@ class DyNTS_OAI_LLMChat_ServiceBase extends oai_llm_service_base_1.DyNTS_OAI_LLM
325
314
  catch (error) {
326
315
  console.error('❌❌ Error shortening conversation:', error);
327
316
  throw new fsm_dynamo_1.DyFM_Error({
328
- ...this.getDefaultErrorSettings('shortenConversation', error, issuer),
317
+ ...this.getDefaultErrorSettings('shortenConversation', error, set.issuer),
329
318
  errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-OAB-SC0`,
330
319
  });
331
320
  }
332
321
  }
333
- logConversation(conversation, debugLog,
334
- /** this is used to readably replace too long contents to eg '...' in logs */
335
- replaceThisInLog) {
336
- if (debugLog || this.debugLog) {
337
- conversation.forEach(message => {
338
- console.log(` - ${message.role}: ${message.content.replace(replaceThisInLog, this.defaultLogReplacer)}`);
322
+ logConversation(set) {
323
+ if (set.debugLog || this.debugLog) {
324
+ set.conversation.forEach(message => {
325
+ console.log(` - ${message.role}: ${message.content.replace(set.replaceThisInLog, this.defaultLogReplacer)}`);
339
326
  });
340
327
  }
341
328
  }
@@ -1 +1 @@
1
- {"version":3,"file":"oai-llm-chat.service-base.js","sourceRoot":"","sources":["../../../../src/_modules/open-ai/_services/oai-llm-chat.service-base.ts"],"names":[],"mappings":";;;AAGA,sDAA2H;AAE3H,uFAAoF;AAIpF,mFAAiF;AAEjF,iEAA2G;AAC3G,yFAAsF;AAGtF;;;;;;GAMG;AAEH,kCAAkC;AAElC,MAAa,6BAA8B,SAAQ,gDAAyB;IAE1E;;;;;OAKG;IACH,KAAK,CAAC,2BAA2B,CAC/B,YAAqC,EACrC,QAAgB,EAChB,MAAc,EACd,QAAkB,EAClB,QAAgC;IAChC,6EAA6E;IAC7E,gBAAyB;QAEzB,QAAQ,IAAI,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC;QAElD,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAEvD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAC/C,YA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,kBAAkB,CAAC,EAAE,CAC5F,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAnlBD,sEAmlBC"}
1
+ {"version":3,"file":"oai-llm-chat.service-base.js","sourceRoot":"","sources":["../../../../src/_modules/open-ai/_services/oai-llm-chat.service-base.ts"],"names":[],"mappings":";;;AAGA,sDAA2H;AAE3H,uFAAoF;AAIpF,mFAAiF;AAEjF,iEAA2G;AAC3G,yFAAsF;AAGtF;;;;;;GAMG;AAEH,kCAAkC;AAElC,MAAa,6BAA8B,SAAQ,gDAAyB;IAE1E;;;;;OAKG;IACH,KAAK,CAAC,2BAA2B,CAC/B,GAQC;QAED,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC;QAEtD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAEtB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,+BAA+B,CAAC,GAAG,CAAC,CAAC;QAE/D,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACnF,CAAC;IACD,8BAA8B,GAAG,IAAI,CAAC,2BAA2B,CAAC;IAElE;;;;OAIG;IACH,KAAK,CAAC,4BAA4B,CAChC,GAQC;QAED,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAEtB,OAAO,MAAM,IAAI,CAAC,+BAA+B,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;IACD,+BAA+B,GAAG,IAAI,CAAC,4BAA4B,CAAC;IAEpE;;;;OAIG;IACH,KAAK,CAAC,gCAAgC,CACpC,GAQC;QAED,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC;QAEvD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAEtB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,+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