@digipair/skill-chatbot 0.2.6 → 0.2.8

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.
package/index.cjs.js CHANGED
@@ -10,5 +10,7 @@ require('@digipair/engine');
10
10
  exports.boost = index.boost;
11
11
  exports.chatbot = index.chatbot;
12
12
  exports.find = index.find;
13
+ exports.getRole = index.getRole;
13
14
  exports.history = index.history;
14
15
  exports.search = index.search;
16
+ exports.setRole = index.setRole;
package/index.cjs2.js CHANGED
@@ -41106,6 +41106,37 @@ Summarize the conversation history in a short, clear and concise text, taking in
41106
41106
  const result = await executePinsList(pinsSettingsList, context);
41107
41107
  return result;
41108
41108
  }
41109
+ async getRole(params, _pinsSettingsList, context) {
41110
+ var _context_private;
41111
+ const session = `${context.request.digipair}-${context.request.body.userId}`;
41112
+ var _context_private_VESPA_SERVER;
41113
+ const { baseUrl = (_context_private_VESPA_SERVER = (_context_private = context.private) == null ? void 0 : _context_private.VESPA_SERVER) != null ? _context_private_VESPA_SERVER : VESPA_SERVER, role } = params;
41114
+ const [document] = await this.searchDocuments(baseUrl, session, `is_parent = true and userQuery() order by date desc limit 1`, {
41115
+ query: `role:"${role}"`
41116
+ });
41117
+ await document;
41118
+ }
41119
+ async setRole(params, _pinsSettingsList, context) {
41120
+ var _context_private;
41121
+ const session = `${context.request.digipair}-${context.request.body.userId}`;
41122
+ var _context_private_VESPA_SERVER;
41123
+ const { baseUrl = (_context_private_VESPA_SERVER = (_context_private = context.private) == null ? void 0 : _context_private.VESPA_SERVER) != null ? _context_private_VESPA_SERVER : VESPA_SERVER, role, document } = params;
41124
+ const [previous] = await this.searchDocuments(baseUrl, session, `is_parent = true and userQuery() order by date desc limit 1`, {
41125
+ query: `role:"${role}"`
41126
+ });
41127
+ var _previous_uuid;
41128
+ const next = _extends({
41129
+ session,
41130
+ date: Date.now(),
41131
+ role
41132
+ }, document, {
41133
+ uuid: (_previous_uuid = previous == null ? void 0 : previous.uuid) != null ? _previous_uuid : v4(),
41134
+ is_parent: true
41135
+ });
41136
+ await this.updateDocuments(baseUrl, [
41137
+ next
41138
+ ]);
41139
+ }
41109
41140
  constructor(){
41110
41141
  this.embeddingsModel = null;
41111
41142
  }
@@ -41115,6 +41146,8 @@ const find = (params, pinsSettingsList, context)=>new ChatbotService().find(para
41115
41146
  const search = (params, pinsSettingsList, context)=>new ChatbotService().search(params, pinsSettingsList, context);
41116
41147
  const chatbot = (params, pinsSettingsList, context)=>new ChatbotService().chatbot(params, pinsSettingsList, context);
41117
41148
  const boost = (params, pinsSettingsList, context)=>new ChatbotService().boost(params, pinsSettingsList, context);
41149
+ const getRole = (params, pinsSettingsList, context)=>new ChatbotService().getRole(params, pinsSettingsList, context);
41150
+ const setRole = (params, pinsSettingsList, context)=>new ChatbotService().setRole(params, pinsSettingsList, context);
41118
41151
 
41119
41152
  exports.BasePromptTemplate = BasePromptTemplate;
41120
41153
  exports.BaseStringPromptTemplate = BaseStringPromptTemplate;
@@ -41124,6 +41157,8 @@ exports.boost = boost;
41124
41157
  exports.chatbot = chatbot;
41125
41158
  exports.checkValidTemplate = checkValidTemplate;
41126
41159
  exports.find = find;
41160
+ exports.getRole = getRole;
41127
41161
  exports.history = history;
41128
41162
  exports.renderTemplate = renderTemplate;
41129
41163
  exports.search = search;
41164
+ exports.setRole = setRole;
package/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- export { d as boost, b as chatbot, f as find, h as history, s as search } from './index.esm2.js';
1
+ export { d as boost, b as chatbot, f as find, g as getRole, h as history, s as search, e as setRole } from './index.esm2.js';
2
2
  import '@digipair/engine';
package/index.esm2.js CHANGED
@@ -41084,6 +41084,37 @@ Summarize the conversation history in a short, clear and concise text, taking in
41084
41084
  const result = await executePinsList(pinsSettingsList, context);
41085
41085
  return result;
41086
41086
  }
41087
+ async getRole(params, _pinsSettingsList, context) {
41088
+ var _context_private;
41089
+ const session = `${context.request.digipair}-${context.request.body.userId}`;
41090
+ var _context_private_VESPA_SERVER;
41091
+ const { baseUrl = (_context_private_VESPA_SERVER = (_context_private = context.private) == null ? void 0 : _context_private.VESPA_SERVER) != null ? _context_private_VESPA_SERVER : VESPA_SERVER, role } = params;
41092
+ const [document] = await this.searchDocuments(baseUrl, session, `is_parent = true and userQuery() order by date desc limit 1`, {
41093
+ query: `role:"${role}"`
41094
+ });
41095
+ await document;
41096
+ }
41097
+ async setRole(params, _pinsSettingsList, context) {
41098
+ var _context_private;
41099
+ const session = `${context.request.digipair}-${context.request.body.userId}`;
41100
+ var _context_private_VESPA_SERVER;
41101
+ const { baseUrl = (_context_private_VESPA_SERVER = (_context_private = context.private) == null ? void 0 : _context_private.VESPA_SERVER) != null ? _context_private_VESPA_SERVER : VESPA_SERVER, role, document } = params;
41102
+ const [previous] = await this.searchDocuments(baseUrl, session, `is_parent = true and userQuery() order by date desc limit 1`, {
41103
+ query: `role:"${role}"`
41104
+ });
41105
+ var _previous_uuid;
41106
+ const next = _extends({
41107
+ session,
41108
+ date: Date.now(),
41109
+ role
41110
+ }, document, {
41111
+ uuid: (_previous_uuid = previous == null ? void 0 : previous.uuid) != null ? _previous_uuid : v4(),
41112
+ is_parent: true
41113
+ });
41114
+ await this.updateDocuments(baseUrl, [
41115
+ next
41116
+ ]);
41117
+ }
41087
41118
  constructor(){
41088
41119
  this.embeddingsModel = null;
41089
41120
  }
@@ -41093,5 +41124,7 @@ const find = (params, pinsSettingsList, context)=>new ChatbotService().find(para
41093
41124
  const search = (params, pinsSettingsList, context)=>new ChatbotService().search(params, pinsSettingsList, context);
41094
41125
  const chatbot = (params, pinsSettingsList, context)=>new ChatbotService().chatbot(params, pinsSettingsList, context);
41095
41126
  const boost = (params, pinsSettingsList, context)=>new ChatbotService().boost(params, pinsSettingsList, context);
41127
+ const getRole = (params, pinsSettingsList, context)=>new ChatbotService().getRole(params, pinsSettingsList, context);
41128
+ const setRole = (params, pinsSettingsList, context)=>new ChatbotService().setRole(params, pinsSettingsList, context);
41096
41129
 
41097
- export { BasePromptTemplate as B, ChatPromptValue as C, PromptTemplate as P, BaseStringPromptTemplate as a, chatbot as b, checkValidTemplate as c, boost as d, find as f, history as h, renderTemplate as r, search as s };
41130
+ export { BasePromptTemplate as B, ChatPromptValue as C, PromptTemplate as P, BaseStringPromptTemplate as a, chatbot as b, checkValidTemplate as c, boost as d, setRole as e, find as f, getRole as g, history as h, renderTemplate as r, search as s };
@@ -9,4 +9,6 @@ export declare const chatbot: (params: any, pinsSettingsList: PinsSettings[], co
9
9
  logs: any;
10
10
  }>;
11
11
  export declare const boost: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
12
+ export declare const getRole: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<void>;
13
+ export declare const setRole: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<void>;
12
14
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-chatbot",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"