@xuda.io/ai_module 1.1.5233 → 1.1.5235
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.mjs +5 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -11028,7 +11028,7 @@ export const open_ai_alive_check = async function () {};
|
|
|
11028
11028
|
// };
|
|
11029
11029
|
|
|
11030
11030
|
export const get_chat_suggestions = async function (req) {
|
|
11031
|
-
const { uid, conversation_item_id, no_of_suggestions = 3, ai_model = _conf.default_ai_model, context } = req;
|
|
11031
|
+
const { uid, conversation_item_id, no_of_suggestions = 3, ai_model = _conf.default_ai_model, context, exclude_agents = [] } = req;
|
|
11032
11032
|
let { ai_agents } = req;
|
|
11033
11033
|
|
|
11034
11034
|
try {
|
|
@@ -11046,6 +11046,7 @@ export const get_chat_suggestions = async function (req) {
|
|
|
11046
11046
|
const ai_agents_ret = await get_user_ai_agents(uid);
|
|
11047
11047
|
for (const doc of ai_agents_ret.docs) {
|
|
11048
11048
|
if (doc._id === conversation_item_doc.ai_agent_id) continue; //exclude the current agent from list
|
|
11049
|
+
if (exclude_agents.includes(doc._id)) continue;
|
|
11049
11050
|
ai_agents.push(doc._id);
|
|
11050
11051
|
}
|
|
11051
11052
|
}
|
|
@@ -11090,7 +11091,7 @@ export const get_chat_suggestions = async function (req) {
|
|
|
11090
11091
|
|
|
11091
11092
|
// Define the response format as a fixed-length array of 5
|
|
11092
11093
|
const AgentResponseSchema = z.object({
|
|
11093
|
-
agents: z.array(
|
|
11094
|
+
agents: z.array(AgentSchema).max(no_of_suggestions),
|
|
11094
11095
|
});
|
|
11095
11096
|
//${conversation_item_doc.text}
|
|
11096
11097
|
const chat_ret = await submit_chat_gpt_prompt({
|
|
@@ -11099,7 +11100,7 @@ export const get_chat_suggestions = async function (req) {
|
|
|
11099
11100
|
|
|
11100
11101
|
Role: You are an expert Routing Assistant specialized in connecting users with the most relevant specialized AI agents.
|
|
11101
11102
|
|
|
11102
|
-
Task: Select
|
|
11103
|
+
Task: Select maximum ${no_of_suggestions} agents from the ## Agent List that are best suited to act upon or refine the current conversation state.
|
|
11103
11104
|
|
|
11104
11105
|
Selection Strategy:
|
|
11105
11106
|
|
|
@@ -11123,7 +11124,7 @@ export const get_chat_suggestions = async function (req) {
|
|
|
11123
11124
|
|
|
11124
11125
|
Agent Source: ${JSON.stringify(agents_docs)}
|
|
11125
11126
|
|
|
11126
|
-
Output: > Return a JSON array of
|
|
11127
|
+
Output: > Return a JSON array of maximum ${no_of_suggestions} objects following this schema:
|
|
11127
11128
|
[{ "type":"string","agent_id": "string", "short_action": "string", "agent_description": "string" }]
|
|
11128
11129
|
|
|
11129
11130
|
## output example:
|