@xuda.io/ai_module 1.1.4372 → 1.1.4373
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 +125 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -7005,3 +7005,128 @@ const get_image_blob_from_downloaded_image = async function (url) {
|
|
|
7005
7005
|
|
|
7006
7006
|
return images[0];
|
|
7007
7007
|
};
|
|
7008
|
+
|
|
7009
|
+
export const get_business_info = async function (uid, name, email, account_profile_info) {
|
|
7010
|
+
// 1. Prepare the valid values from your categories list
|
|
7011
|
+
const categories = [
|
|
7012
|
+
{
|
|
7013
|
+
id: 'ind_technology',
|
|
7014
|
+
name: 'Technology',
|
|
7015
|
+
sub: ['Software Development', 'AI & Machine Learning', 'Cybersecurity', 'Cloud Computing', 'IT Services', 'SaaS & Platforms', 'Hardware & Electronics'],
|
|
7016
|
+
},
|
|
7017
|
+
{
|
|
7018
|
+
id: 'ind_marketing',
|
|
7019
|
+
name: 'Marketing & Advertising',
|
|
7020
|
+
sub: ['Digital Marketing', 'PPC & SEO', 'Content Creation', 'Branding', 'Social Media Management', 'Email Marketing', 'Market Research'],
|
|
7021
|
+
},
|
|
7022
|
+
{
|
|
7023
|
+
id: 'ind_sales',
|
|
7024
|
+
name: 'Sales',
|
|
7025
|
+
sub: ['B2B Sales', 'B2C Sales', 'Real Estate Sales', 'Account Management', 'Lead Generation', 'Inside Sales', 'Field Sales'],
|
|
7026
|
+
},
|
|
7027
|
+
{
|
|
7028
|
+
id: 'ind_finance',
|
|
7029
|
+
name: 'Finance & Accounting',
|
|
7030
|
+
sub: ['Banking', 'Investment', 'Financial Planning', 'Accounting', 'Bookkeeping', 'Insurance', 'FinTech'],
|
|
7031
|
+
},
|
|
7032
|
+
{
|
|
7033
|
+
id: 'ind_healthcare',
|
|
7034
|
+
name: 'Healthcare',
|
|
7035
|
+
sub: ['Medical Clinics', 'Hospitals', 'Pharma', 'Mental Health', 'Healthcare IT', 'Home Care', 'Medical Research'],
|
|
7036
|
+
},
|
|
7037
|
+
{
|
|
7038
|
+
id: 'ind_realestate',
|
|
7039
|
+
name: 'Real Estate',
|
|
7040
|
+
sub: ['Residential Real Estate', 'Commercial Real Estate', 'Property Management', 'Investment & BRRRR', 'Construction', 'Architecture', 'Interior Design'],
|
|
7041
|
+
},
|
|
7042
|
+
{
|
|
7043
|
+
id: 'ind_ecommerce',
|
|
7044
|
+
name: 'E-commerce',
|
|
7045
|
+
sub: ['Online Store', 'Dropshipping', 'Amazon FBA', 'Marketplace Selling', 'Retail', 'Inventory Management', 'Fulfillment & Logistics'],
|
|
7046
|
+
},
|
|
7047
|
+
{
|
|
7048
|
+
id: 'ind_education',
|
|
7049
|
+
name: 'Education',
|
|
7050
|
+
sub: ['Schools', 'Universities', 'Private Tutoring', 'Online Courses', 'EdTech', 'Training & Development'],
|
|
7051
|
+
},
|
|
7052
|
+
{
|
|
7053
|
+
id: 'ind_hospitality',
|
|
7054
|
+
name: 'Hospitality & Travel',
|
|
7055
|
+
sub: ['Hotels', 'Restaurants', 'Cafes & Bars', 'Travel Agencies', 'Tourism', 'Events & Catering', 'Transportation'],
|
|
7056
|
+
},
|
|
7057
|
+
{
|
|
7058
|
+
id: 'ind_professional',
|
|
7059
|
+
name: 'Professional Services',
|
|
7060
|
+
sub: ['Legal', 'Consulting', 'HR & Recruiting', 'Accounting Firms', 'Business Services', 'Management Consulting'],
|
|
7061
|
+
},
|
|
7062
|
+
{
|
|
7063
|
+
id: 'ind_manufacturing',
|
|
7064
|
+
name: 'Manufacturing',
|
|
7065
|
+
sub: ['Automotive', 'Industrial', 'Textile', 'Electronics', 'Food Production', 'Machinery', 'Chemicals'],
|
|
7066
|
+
},
|
|
7067
|
+
{
|
|
7068
|
+
id: 'ind_nonprofit',
|
|
7069
|
+
name: 'Nonprofit & Government',
|
|
7070
|
+
sub: ['NGOs', 'Municipality', 'Government Services', 'Public Health', 'Community Organizations', 'Education Programs'],
|
|
7071
|
+
},
|
|
7072
|
+
{
|
|
7073
|
+
id: 'ind_media',
|
|
7074
|
+
name: 'Media & Entertainment',
|
|
7075
|
+
sub: ['Film & Video', 'Music', 'Publishing', 'Gaming', 'News & Journalism', 'Influencers', 'Production Studios'],
|
|
7076
|
+
},
|
|
7077
|
+
{
|
|
7078
|
+
id: 'ind_logistics',
|
|
7079
|
+
name: 'Logistics & Transportation',
|
|
7080
|
+
sub: ['Shipping', 'Trucking', 'Last-Mile Delivery', 'Warehousing', 'Freight Forwarding', 'Route Optimization'],
|
|
7081
|
+
},
|
|
7082
|
+
{
|
|
7083
|
+
id: 'ind_energy',
|
|
7084
|
+
name: 'Energy & Utilities',
|
|
7085
|
+
sub: ['Solar', 'Oil & Gas', 'Electricity Providers', 'Water Utilities', 'Environmental Services', 'Renewable Energy'],
|
|
7086
|
+
},
|
|
7087
|
+
{
|
|
7088
|
+
id: 'ind_construction',
|
|
7089
|
+
name: 'Construction & Trades',
|
|
7090
|
+
sub: ['General Contracting', 'Roofing', 'Plumbing', 'HVAC', 'Electrical', 'Renovation', 'Engineering'],
|
|
7091
|
+
},
|
|
7092
|
+
{
|
|
7093
|
+
id: 'ind_food',
|
|
7094
|
+
name: 'Food & Beverage',
|
|
7095
|
+
sub: ['Restaurants', 'Catering', 'Food Manufacturing', 'Bakeries', 'Bars & Nightlife', 'Food Delivery'],
|
|
7096
|
+
},
|
|
7097
|
+
{
|
|
7098
|
+
id: 'ind_retail',
|
|
7099
|
+
name: 'Retail',
|
|
7100
|
+
sub: ['Physical Stores', 'Boutiques', 'Supermarkets', 'Consumer Goods', 'Fashion Retail', 'Home Goods'],
|
|
7101
|
+
},
|
|
7102
|
+
];
|
|
7103
|
+
|
|
7104
|
+
const categoryNames = categories.map((c) => c.name);
|
|
7105
|
+
const allSubCategories = categories.flatMap((c) => c.sub);
|
|
7106
|
+
|
|
7107
|
+
const business_info_ret = await submit_chat_gpt_prompt({
|
|
7108
|
+
uid,
|
|
7109
|
+
prompt: `Research the company "${name}" (${email}). Identify their business size,
|
|
7110
|
+
main industry category, and specific sub-category based on the provided lists.`,
|
|
7111
|
+
model: 'gpt-5-nano',
|
|
7112
|
+
response_format: z.object({
|
|
7113
|
+
business_size: z.enum(['unknown', 'small', 'medium', 'large', 'enterprise']),
|
|
7114
|
+
business_category: z.enum(categoryNames).describe('The primary industry category name'),
|
|
7115
|
+
business_sub_category: z.enum(allSubCategories).describe('The specific niche within that category'),
|
|
7116
|
+
business_country: z.string().describe('Primary country of operation'),
|
|
7117
|
+
}),
|
|
7118
|
+
metadata: { func: 'get_business_info' },
|
|
7119
|
+
account_profile_info,
|
|
7120
|
+
tools: [{ type: 'web_search_preview' }],
|
|
7121
|
+
});
|
|
7122
|
+
|
|
7123
|
+
try {
|
|
7124
|
+
if (business_info_ret.code > -1) {
|
|
7125
|
+
const data = typeof business_info_ret.data === 'string' ? JSON.parse(business_info_ret.data) : business_info_ret.data;
|
|
7126
|
+
|
|
7127
|
+
return data;
|
|
7128
|
+
}
|
|
7129
|
+
} catch (error) {
|
|
7130
|
+
console.error('Schema validation or parsing error', error);
|
|
7131
|
+
}
|
|
7132
|
+
};
|