@xuda.io/ai_module 1.1.4377 → 1.1.4378
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 +146 -12
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -7008,8 +7008,141 @@ const get_image_blob_from_downloaded_image = async function (url) {
|
|
|
7008
7008
|
return images[0];
|
|
7009
7009
|
};
|
|
7010
7010
|
|
|
7011
|
+
// export const get_business_info = async function (uid, name, email, account_profile_info) {
|
|
7012
|
+
// // 1. Prepare the valid values from your categories list
|
|
7013
|
+
// const categories = [
|
|
7014
|
+
// {
|
|
7015
|
+
// id: 'ind_technology',
|
|
7016
|
+
// name: 'Technology',
|
|
7017
|
+
// sub: ['Software Development', 'AI & Machine Learning', 'Cybersecurity', 'Cloud Computing', 'IT Services', 'SaaS & Platforms', 'Hardware & Electronics'],
|
|
7018
|
+
// },
|
|
7019
|
+
// {
|
|
7020
|
+
// id: 'ind_marketing',
|
|
7021
|
+
// name: 'Marketing & Advertising',
|
|
7022
|
+
// sub: ['Digital Marketing', 'PPC & SEO', 'Content Creation', 'Branding', 'Social Media Management', 'Email Marketing', 'Market Research'],
|
|
7023
|
+
// },
|
|
7024
|
+
// {
|
|
7025
|
+
// id: 'ind_sales',
|
|
7026
|
+
// name: 'Sales',
|
|
7027
|
+
// sub: ['B2B Sales', 'B2C Sales', 'Real Estate Sales', 'Account Management', 'Lead Generation', 'Inside Sales', 'Field Sales'],
|
|
7028
|
+
// },
|
|
7029
|
+
// {
|
|
7030
|
+
// id: 'ind_finance',
|
|
7031
|
+
// name: 'Finance & Accounting',
|
|
7032
|
+
// sub: ['Banking', 'Investment', 'Financial Planning', 'Accounting', 'Bookkeeping', 'Insurance', 'FinTech'],
|
|
7033
|
+
// },
|
|
7034
|
+
// {
|
|
7035
|
+
// id: 'ind_healthcare',
|
|
7036
|
+
// name: 'Healthcare',
|
|
7037
|
+
// sub: ['Medical Clinics', 'Hospitals', 'Pharma', 'Mental Health', 'Healthcare IT', 'Home Care', 'Medical Research'],
|
|
7038
|
+
// },
|
|
7039
|
+
// {
|
|
7040
|
+
// id: 'ind_realestate',
|
|
7041
|
+
// name: 'Real Estate',
|
|
7042
|
+
// sub: ['Residential Real Estate', 'Commercial Real Estate', 'Property Management', 'Investment & BRRRR', 'Construction', 'Architecture', 'Interior Design'],
|
|
7043
|
+
// },
|
|
7044
|
+
// {
|
|
7045
|
+
// id: 'ind_ecommerce',
|
|
7046
|
+
// name: 'E-commerce',
|
|
7047
|
+
// sub: ['Online Store', 'Dropshipping', 'Amazon FBA', 'Marketplace Selling', 'Retail', 'Inventory Management', 'Fulfillment & Logistics'],
|
|
7048
|
+
// },
|
|
7049
|
+
// {
|
|
7050
|
+
// id: 'ind_education',
|
|
7051
|
+
// name: 'Education',
|
|
7052
|
+
// sub: ['Schools', 'Universities', 'Private Tutoring', 'Online Courses', 'EdTech', 'Training & Development'],
|
|
7053
|
+
// },
|
|
7054
|
+
// {
|
|
7055
|
+
// id: 'ind_hospitality',
|
|
7056
|
+
// name: 'Hospitality & Travel',
|
|
7057
|
+
// sub: ['Hotels', 'Restaurants', 'Cafes & Bars', 'Travel Agencies', 'Tourism', 'Events & Catering', 'Transportation'],
|
|
7058
|
+
// },
|
|
7059
|
+
// {
|
|
7060
|
+
// id: 'ind_professional',
|
|
7061
|
+
// name: 'Professional Services',
|
|
7062
|
+
// sub: ['Legal', 'Consulting', 'HR & Recruiting', 'Accounting Firms', 'Business Services', 'Management Consulting'],
|
|
7063
|
+
// },
|
|
7064
|
+
// {
|
|
7065
|
+
// id: 'ind_manufacturing',
|
|
7066
|
+
// name: 'Manufacturing',
|
|
7067
|
+
// sub: ['Automotive', 'Industrial', 'Textile', 'Electronics', 'Food Production', 'Machinery', 'Chemicals'],
|
|
7068
|
+
// },
|
|
7069
|
+
// {
|
|
7070
|
+
// id: 'ind_nonprofit',
|
|
7071
|
+
// name: 'Nonprofit & Government',
|
|
7072
|
+
// sub: ['NGOs', 'Municipality', 'Government Services', 'Public Health', 'Community Organizations', 'Education Programs'],
|
|
7073
|
+
// },
|
|
7074
|
+
// {
|
|
7075
|
+
// id: 'ind_media',
|
|
7076
|
+
// name: 'Media & Entertainment',
|
|
7077
|
+
// sub: ['Film & Video', 'Music', 'Publishing', 'Gaming', 'News & Journalism', 'Influencers', 'Production Studios'],
|
|
7078
|
+
// },
|
|
7079
|
+
// {
|
|
7080
|
+
// id: 'ind_logistics',
|
|
7081
|
+
// name: 'Logistics & Transportation',
|
|
7082
|
+
// sub: ['Shipping', 'Trucking', 'Last-Mile Delivery', 'Warehousing', 'Freight Forwarding', 'Route Optimization'],
|
|
7083
|
+
// },
|
|
7084
|
+
// {
|
|
7085
|
+
// id: 'ind_energy',
|
|
7086
|
+
// name: 'Energy & Utilities',
|
|
7087
|
+
// sub: ['Solar', 'Oil & Gas', 'Electricity Providers', 'Water Utilities', 'Environmental Services', 'Renewable Energy'],
|
|
7088
|
+
// },
|
|
7089
|
+
// {
|
|
7090
|
+
// id: 'ind_construction',
|
|
7091
|
+
// name: 'Construction & Trades',
|
|
7092
|
+
// sub: ['General Contracting', 'Roofing', 'Plumbing', 'HVAC', 'Electrical', 'Renovation', 'Engineering'],
|
|
7093
|
+
// },
|
|
7094
|
+
// {
|
|
7095
|
+
// id: 'ind_food',
|
|
7096
|
+
// name: 'Food & Beverage',
|
|
7097
|
+
// sub: ['Restaurants', 'Catering', 'Food Manufacturing', 'Bakeries', 'Bars & Nightlife', 'Food Delivery'],
|
|
7098
|
+
// },
|
|
7099
|
+
// {
|
|
7100
|
+
// id: 'ind_retail',
|
|
7101
|
+
// name: 'Retail',
|
|
7102
|
+
// sub: ['Physical Stores', 'Boutiques', 'Supermarkets', 'Consumer Goods', 'Fashion Retail', 'Home Goods'],
|
|
7103
|
+
// },
|
|
7104
|
+
// ];
|
|
7105
|
+
// // Prepare enums for the model
|
|
7106
|
+
// const categoryNames = categories.map((c) => c.name);
|
|
7107
|
+
// const allSubCategories = categories.flatMap((c) => c.sub);
|
|
7108
|
+
|
|
7109
|
+
// const business_info_ret = await submit_chat_gpt_prompt({
|
|
7110
|
+
// uid,
|
|
7111
|
+
// prompt: `Research the company: "${name}" (${email}).
|
|
7112
|
+
// Tasks:
|
|
7113
|
+
// 1. Identify the company size.
|
|
7114
|
+
// 2. Select the most accurate Industry Category and Sub-Category from the provided lists.
|
|
7115
|
+
// 3. Identify the primary country and return its ISO 3166-1 alpha-2 code (e.g., 'US', 'GB', 'IL').`,
|
|
7116
|
+
// model: 'gpt-5-nano',
|
|
7117
|
+
// response_format: z.object({
|
|
7118
|
+
// business_size: z.enum(['unknown', 'small', 'medium', 'large', 'enterprise']),
|
|
7119
|
+
// business_category: z.enum(categoryNames),
|
|
7120
|
+
// business_sub_category: z.enum(allSubCategories),
|
|
7121
|
+
// business_country: z.string().length(2).describe("The 2-letter ISO country code, e.g., 'US'"),
|
|
7122
|
+
// }),
|
|
7123
|
+
// metadata: { func: 'get_business_info' },
|
|
7124
|
+
// account_profile_info,
|
|
7125
|
+
// tools: [{ type: 'web_search_preview' }],
|
|
7126
|
+
// });
|
|
7127
|
+
|
|
7128
|
+
// try {
|
|
7129
|
+
// if (business_info_ret.code > -1) {
|
|
7130
|
+
// const data = typeof business_info_ret.data === 'string' ? JSON.parse(business_info_ret.data) : business_info_ret.data;
|
|
7131
|
+
|
|
7132
|
+
// // Ensure the country code is always uppercase
|
|
7133
|
+
// if (data.business_country) {
|
|
7134
|
+
// data.business_country = data.business_country.toUpperCase();
|
|
7135
|
+
// }
|
|
7136
|
+
|
|
7137
|
+
// return data;
|
|
7138
|
+
// }
|
|
7139
|
+
// } catch (error) {
|
|
7140
|
+
// console.error('Error processing business info:', error);
|
|
7141
|
+
// }
|
|
7142
|
+
// };
|
|
7143
|
+
|
|
7011
7144
|
export const get_business_info = async function (uid, name, email, account_profile_info) {
|
|
7012
|
-
//
|
|
7145
|
+
// Extract lists from your JSON categories array
|
|
7013
7146
|
const categories = [
|
|
7014
7147
|
{
|
|
7015
7148
|
id: 'ind_technology',
|
|
@@ -7102,23 +7235,22 @@ export const get_business_info = async function (uid, name, email, account_profi
|
|
|
7102
7235
|
sub: ['Physical Stores', 'Boutiques', 'Supermarkets', 'Consumer Goods', 'Fashion Retail', 'Home Goods'],
|
|
7103
7236
|
},
|
|
7104
7237
|
];
|
|
7105
|
-
// Prepare enums for the model
|
|
7106
7238
|
const categoryNames = categories.map((c) => c.name);
|
|
7107
7239
|
const allSubCategories = categories.flatMap((c) => c.sub);
|
|
7108
7240
|
|
|
7109
7241
|
const business_info_ret = await submit_chat_gpt_prompt({
|
|
7110
7242
|
uid,
|
|
7111
7243
|
prompt: `Research the company: "${name}" (${email}).
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
3. Identify the primary country and return its ISO 3166-1 alpha-2 code (e.g., 'US', 'GB', 'IL').`,
|
|
7244
|
+
1. Provide a professional one-sentence biography of the company.
|
|
7245
|
+
2. Categorize them using the provided industry lists.
|
|
7246
|
+
3. Identify their primary country as a 2-letter ISO code (e.g., 'US').`,
|
|
7116
7247
|
model: 'gpt-5-nano',
|
|
7117
7248
|
response_format: z.object({
|
|
7249
|
+
business_bio: z.string().describe('A concise, professional one-sentence summary of what the business does'),
|
|
7118
7250
|
business_size: z.enum(['unknown', 'small', 'medium', 'large', 'enterprise']),
|
|
7119
7251
|
business_category: z.enum(categoryNames),
|
|
7120
7252
|
business_sub_category: z.enum(allSubCategories),
|
|
7121
|
-
business_country: z.string().length(2).describe("
|
|
7253
|
+
business_country: z.string().length(2).describe("2-letter ISO country code (e.g., 'US')"),
|
|
7122
7254
|
}),
|
|
7123
7255
|
metadata: { func: 'get_business_info' },
|
|
7124
7256
|
account_profile_info,
|
|
@@ -7129,14 +7261,16 @@ export const get_business_info = async function (uid, name, email, account_profi
|
|
|
7129
7261
|
if (business_info_ret.code > -1) {
|
|
7130
7262
|
const data = typeof business_info_ret.data === 'string' ? JSON.parse(business_info_ret.data) : business_info_ret.data;
|
|
7131
7263
|
|
|
7132
|
-
//
|
|
7133
|
-
if (data.business_country)
|
|
7134
|
-
|
|
7135
|
-
|
|
7264
|
+
// Standardize country to uppercase
|
|
7265
|
+
if (data.business_country) data.business_country = data.business_country.toUpperCase();
|
|
7266
|
+
|
|
7267
|
+
// Logic to attach the ID for your database
|
|
7268
|
+
const matched = categories.find((c) => c.name === data.business_category);
|
|
7269
|
+
data.business_category_id = matched ? matched.id : null;
|
|
7136
7270
|
|
|
7137
7271
|
return data;
|
|
7138
7272
|
}
|
|
7139
7273
|
} catch (error) {
|
|
7140
|
-
console.error('Error
|
|
7274
|
+
console.error('Error in get_business_info:', error);
|
|
7141
7275
|
}
|
|
7142
7276
|
};
|