@xuda.io/ai_module 1.1.5126 → 1.1.5127
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 +26 -22
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4785,7 +4785,7 @@ setTimeout(async () => {
|
|
|
4785
4785
|
|
|
4786
4786
|
// await init_studio_units();
|
|
4787
4787
|
let ret;
|
|
4788
|
-
|
|
4788
|
+
ret = await get_chat_suggestions(uid, [], 'coi_7b65b783af38b91c8ec4c499d3694bab');
|
|
4789
4789
|
// ret = await get_active_account_profile_info(uid);
|
|
4790
4790
|
// ret = await is_spam_email(uid, 'dsgr8-2994400420@gigs.craigslist.org', 'To: You, From: Us - 70% Off Stickers & Labels Today Only');
|
|
4791
4791
|
// ret = await is_spam_email(uid, 'noreply@tm.openai.com', 'Please update your Plus payment method', account_profile_info);
|
|
@@ -10888,39 +10888,43 @@ export const get_chat_suggestions = async function (uid, ai_agents, conversation
|
|
|
10888
10888
|
|
|
10889
10889
|
const agents_docs = await get_agents();
|
|
10890
10890
|
|
|
10891
|
+
const AgentItemSchema = z.object({
|
|
10892
|
+
agent_id: z.string().describe('The unique identifier for the agent'),
|
|
10893
|
+
short_action: z.string().describe('A brief, 2-4 word call to action'),
|
|
10894
|
+
agent_description: z.string().describe("A professional description of the agent's capabilities"),
|
|
10895
|
+
});
|
|
10896
|
+
|
|
10897
|
+
// Define the response format as a fixed-length array of 5
|
|
10898
|
+
const AgentResponseSchema = z.object({
|
|
10899
|
+
agents: z.array(AgentItemSchema).length(5),
|
|
10900
|
+
});
|
|
10901
|
+
|
|
10891
10902
|
const chat_ret = await submit_chat_gpt_prompt({
|
|
10892
10903
|
uid,
|
|
10893
10904
|
prompt: `
|
|
10894
10905
|
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
3. the ## prompt category
|
|
10902
|
-
4. the ## prompt response
|
|
10906
|
+
Role: You are a routing assistant.
|
|
10907
|
+
|
|
10908
|
+
Task: Analyze the provided user context and select the 5 most relevant agents from the ## Agent List.
|
|
10909
|
+
|
|
10910
|
+
Selection Logic:
|
|
10911
|
+
Base your selection on the alignment between the agent's purpose and the following context:
|
|
10903
10912
|
|
|
10904
|
-
|
|
10905
|
-
${JSON.stringify(account_doc.account_info)}
|
|
10913
|
+
User Profile: ${JSON.stringify(account_doc.account_info)}
|
|
10906
10914
|
|
|
10907
|
-
|
|
10908
|
-
${conversation_item_doc.prompt || conversation_doc.prompt}
|
|
10915
|
+
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}.
|
|
10909
10916
|
|
|
10910
|
-
|
|
10911
|
-
${conversation_doc?.category_info?.category}
|
|
10917
|
+
Data Source: > ${JSON.stringify(agents_docs)}
|
|
10912
10918
|
|
|
10913
|
-
|
|
10914
|
-
|
|
10919
|
+
Output: > Return a JSON array of exactly 5 objects following this schema:
|
|
10920
|
+
[{ "agent_id": "string", "short_action": "string", "agent_description": "string" }]
|
|
10915
10921
|
|
|
10916
|
-
##
|
|
10917
|
-
|
|
10922
|
+
## output example:
|
|
10923
|
+
[{agent_id:"392_agn_55cb328d2743",short_action:"Create article","agent_description":"create proffessional article..."}]
|
|
10918
10924
|
|
|
10919
10925
|
`,
|
|
10920
10926
|
model: ai_model,
|
|
10921
|
-
|
|
10922
|
-
// mood_level: z.number().describe('mood level of interaction: -2: very negative,-1: negative 0:natural 1:positive 2: very positive'),
|
|
10923
|
-
// }),
|
|
10927
|
+
response_format: AgentResponseSchema,
|
|
10924
10928
|
metadata: { conversation_item_id, func: 'get_chat_suggestions' },
|
|
10925
10929
|
account_profile_info,
|
|
10926
10930
|
});
|