@xuda.io/ai_module 1.1.5130 → 1.1.5132

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 (2) hide show
  1. package/index.mjs +21 -8
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -10834,7 +10834,7 @@ export const open_ai_alive_check = async function () {};
10834
10834
  // return account_profile_info;
10835
10835
  // };
10836
10836
 
10837
- export const get_chat_suggestions = async function (uid, ai_agents, conversation_item_id, ai_model = _conf.default_ai_model) {
10837
+ export const get_chat_suggestions = async function (uid, ai_agents, conversation_item_id, no_of_suggesstions = 3, ai_model = _conf.default_ai_model) {
10838
10838
  try {
10839
10839
  const account_profile_info = await get_active_account_profile_info(uid);
10840
10840
  const account_doc = await db_module.get_couch_doc_native('xuda_accounts', uid);
@@ -10893,25 +10893,38 @@ export const get_chat_suggestions = async function (uid, ai_agents, conversation
10893
10893
 
10894
10894
  // Define the response format as a fixed-length array of 5
10895
10895
  const AgentResponseSchema = z.object({
10896
- agents: z.array(AgentItemSchema).length(5),
10896
+ agents: z.array(AgentItemSchema).length(no_of_suggesstions),
10897
10897
  });
10898
10898
 
10899
10899
  const chat_ret = await submit_chat_gpt_prompt({
10900
10900
  uid,
10901
10901
  prompt: `
10902
10902
 
10903
- Role: You are a routing assistant.
10903
+ Role: You are an expert Routing Assistant specialized in connecting users with the most relevant specialized AI agents.
10904
10904
 
10905
- Task: Analyze the provided user context and select the 5 most relevant agents from the ## Agent List.
10905
+ Task: Select exactly ${no_of_suggesstions} agents from the ## Agent List that are best suited to act upon or refine the current conversation state.
10906
10906
 
10907
- Selection Logic:
10908
- Base your selection on the alignment between the agent's purpose and the following context:
10907
+ Selection Strategy:
10908
+
10909
+ Format Compatibility: Analyze the ## Prompt Response. If it contains code, data structures, or specific document types (like HTML), prioritize agents whose agent_instructions or agent_name involve processing, transforming, or styling that specific format.
10910
+
10911
+ Workflow Continuity: Choose agents that represent a logical "next step" in a development or content creation pipeline (e.g., if code was generated, suggest an agent that deploys, converts, or styles it).
10912
+
10913
+ Contextual Relevance: Balance the selection with the ## User Info and ## Prompt Category to ensure the agents match the user's industry and intent.
10914
+
10915
+ Input Context:
10909
10916
 
10910
10917
  User Profile: ${JSON.stringify(account_doc.account_info)}
10911
10918
 
10912
- Recent Interaction: The user asked ${conversation_item_doc.prompt || conversation_doc.prompt}, categorized as ${conversation_doc?.category_info?.category}, which resulted in the response: ${conversation_item_doc.text}.
10919
+ Prompt Category: ${conversation_doc?.category_info?.category}
10920
+
10921
+ Current State:
10922
+
10923
+ Input: ${conversation_item_doc.prompt || conversation_doc.prompt}
10924
+
10925
+ Output to Process: ${conversation_item_doc.text}
10913
10926
 
10914
- Data Source: > ${JSON.stringify(agents_docs)}
10927
+ Agent Source: ${JSON.stringify(agents_docs)}
10915
10928
 
10916
10929
  Output: > Return a JSON array of exactly 5 objects following this schema:
10917
10930
  [{ "agent_id": "string", "short_action": "string", "agent_description": "string" }]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5130",
3
+ "version": "1.1.5132",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",