"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(require("axios"));exports.fetchInstantLearningTagsAPI=function(t,r){return e.__awaiter(void 0,void 0,void 0,function(){var i,a,s,o;return e.__generator(this,function(e){switch(e.label){case 0:if(!r||!t)return console.warn("fetchInstantLearningTagsAPI: Missing query or baseUrl"),[2,{}];i="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI4MDU5NjU4Yy1hNjVjLTRlMTQtODlhYS1hNTE5NWY1ZDA5ZjUiLCJ1c2VybmFtZSI6IkthdGh5YXlhbmlNIiwibmFtZSI6Ik0gS2F0aHlheWFuaSIsImVtYWlsIjoibWFkdW1idS5rYXRoeWF5YW5pQHRlY2hvbHV0aW9uLmNvbSIsInJvbGUiOiJzdXBlcl9hZG1pbiIsInN0YXR1cyI6ImFjdGl2ZSIsImlhdCI6MTc1MzM4Mzg4N30.iF2nGYpBedIfeGasUNc7lhjStb_B_u1uz6NFEh0u6qI",e.label=1;case 1:return e.trys.push([1,3,,4]),[4,n.default.post("".concat(t,"/api/instant-learning/getInstantLearningTags"),{query:r},{headers:{Authorization:"Bearer ".concat(i)}})];case 2:return a=e.sent(),[2,(null===(o=null==a?void 0:a.data)||void 0===o?void 0:o.tags)||{}];case 3:return s=e.sent(),console.error("Error fetching instant learning tags:",s),[2,{}];case 4:return[2]}})})},exports.fetchSuggestedCategories=function(t,n){return e.__awaiter(void 0,void 0,void 0,function(){var r,i,a,s,o,c,l,u,d,I;return e.__generator(this,function(e){switch(e.label){case 0:if(!t.trim())return[2,[]];r="".concat(n,"/api/instant-learning/getSuggestedCategories"),i="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI4MDU5NjU4Yy1hNjVjLTRlMTQtODlhYS1hNTE5NWY1ZDA5ZjUiLCJ1c2VybmFtZSI6IkthdGh5YXlhbmlNIiwibmFtZSI6Ik0gS2F0aHlheWFuaSIsImVtYWlsIjoibWFkdW1idS5rYXRoeWF5YW5pQHRlY2hvbHV0aW9uLmNvbSIsInJvbGUiOiJzdXBlcl9hZG1pbiIsInN0YXR1cyI6ImFjdGl2ZSIsImlhdCI6MTc1MzM4Mzg4N30.iF2nGYpBedIfeGasUNc7lhjStb_B_u1uz6NFEh0u6qI",a={llm_model:"gpt-4o",topics_config:{dbIndexName:"techolution-instantLearning-categories",dbType:"alloydb",embeddingModel:"mxbai-embed-large-v1",embedding_column:"category_embedding",similarity_threshold:.6},question:"".concat(t),prompt:'You are an intelligent classifier. Analyze the following question or conversation and extract the most relevant **categories** that describe its content. \nInclude:\n1. **Specific topics** (e.g., lung cancer, diabetes, neural networks).\n2. **General domains** (e.g., healthcare, education, technology).\n3. **Intent or task types** (e.g., treatment guidance, diagnosis, troubleshooting).\n\nInput:\nchat_data: The original query from the user\n\nOnly return the categories in this exact format:\n[\n  {\n    "categories": ["<category1>", "<category2>", "..."]\n  }\n]'},e.label=1;case 1:return e.trys.push([1,4,,5]),[4,fetch(r,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json, text/plain, */*",Authorization:"Bearer ".concat(i)},body:JSON.stringify(a)})];case 2:if(!(s=e.sent()).ok)throw new Error("API request failed with status ".concat(s.status));return[4,s.json()];case 3:return o=e.sent(),(c=null===(d=null==o?void 0:o.response)||void 0===d?void 0:d.response)&&Array.isArray(c)&&c.length>0&&(l=null===(I=c[0])||void 0===I?void 0:I.categories)&&Array.isArray(l)?[2,l.map(function(e){return{label:e,value:e,isCustom:!1}})]:(console.warn("Category API response was successful but did not match the expected structure.",o),[2,[]]);case 4:return u=e.sent(),console.error("Error fetching suggested categories:",u),[2,[]];case 5:return[2]}})})};
//# sourceMappingURL=instantLearningAPI.js.map
