@lyxa.ai/core 1.4.286 → 1.4.288
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/dist/libraries/llm/interfaces/common-llm-interfaces.d.ts +2 -0
- package/dist/libraries/llm/interfaces/common-llm-interfaces.js.map +1 -1
- package/dist/libraries/llm/llm-provider-service.js +4 -1
- package/dist/libraries/llm/llm-provider-service.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/line-item-attribute.model.d.ts +1 -0
- package/dist/libraries/mongo/models/embedded/line-item-attribute.model.js +5 -0
- package/dist/libraries/mongo/models/embedded/line-item-attribute.model.js.map +1 -1
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LLMProvider } from '../llm-provider-service';
|
|
2
2
|
export interface IAICompletionProvider {
|
|
3
3
|
generateSearchVariants(items: ItemTextInput[], model?: string, instructions?: string, options?: {
|
|
4
|
+
concurrency?: number;
|
|
4
5
|
pollIntervalMs?: number;
|
|
5
6
|
maxWaitMs?: number;
|
|
6
7
|
}): Promise<TextVariantResult[]>;
|
|
@@ -17,6 +18,7 @@ export interface AiConfiguration {
|
|
|
17
18
|
model?: string;
|
|
18
19
|
instructions?: string;
|
|
19
20
|
prompt?: string;
|
|
21
|
+
concurrency?: number;
|
|
20
22
|
}
|
|
21
23
|
export interface ItemTextInput {
|
|
22
24
|
itemId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-llm-interfaces.js","sourceRoot":"/","sources":["libraries/llm/interfaces/common-llm-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { LLMProvider } from '../llm-provider-service';\n\nexport interface IAICompletionProvider {\n\tgenerateSearchVariants(\n\t\titems: ItemTextInput[],\n\t\tmodel?: string,\n\t\tinstructions?: string,\n\t\toptions?: { pollIntervalMs?: number; maxWaitMs?: number }\n\t): Promise<TextVariantResult[]>;\n}\n\n// export interface TextVariantConfig {\n// \tisArabic?: boolean; // Arabic translation, Arabic script\n// \tisArabizi?: boolean; // Arabic word, Latin script (e.g. \"zaytoon\")\n// \tisArabicTransliteration?: boolean; // original word, spelled phonetically in Arabic script (e.g. \"أوليف\")\n// }\n\nexport interface TextVariantResult {\n\titemId: string;\n\toriginal: string;\n\tarabic?: string[];\n\tarabizi?: string[];\n\tarabicTransliteration?: string[];\n}\n\nexport interface AiConfiguration {\n\tprovider: LLMProvider;\n\tmodel?: string;\n\tinstructions?: string;\n\tprompt?: string;\n}\n\nexport interface ItemTextInput {\n\titemId: string;\n\ttext: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"common-llm-interfaces.js","sourceRoot":"/","sources":["libraries/llm/interfaces/common-llm-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { LLMProvider } from '../llm-provider-service';\n\nexport interface IAICompletionProvider {\n\tgenerateSearchVariants(\n\t\titems: ItemTextInput[],\n\t\tmodel?: string,\n\t\tinstructions?: string,\n\t\toptions?: { concurrency?: number; pollIntervalMs?: number; maxWaitMs?: number }\n\t): Promise<TextVariantResult[]>;\n}\n\n// export interface TextVariantConfig {\n// \tisArabic?: boolean; // Arabic translation, Arabic script\n// \tisArabizi?: boolean; // Arabic word, Latin script (e.g. \"zaytoon\")\n// \tisArabicTransliteration?: boolean; // original word, spelled phonetically in Arabic script (e.g. \"أوليف\")\n// }\n\nexport interface TextVariantResult {\n\titemId: string;\n\toriginal: string;\n\tarabic?: string[];\n\tarabizi?: string[];\n\tarabicTransliteration?: string[];\n}\n\nexport interface AiConfiguration {\n\tprovider: LLMProvider;\n\tmodel?: string;\n\tinstructions?: string;\n\tprompt?: string;\n\tconcurrency?: number;\n}\n\nexport interface ItemTextInput {\n\titemId: string;\n\ttext: string;\n}\n"]}
|
|
@@ -30,7 +30,10 @@ class LLMCompletionService {
|
|
|
30
30
|
async generatePromptVariants(payload, aiConfigurations) {
|
|
31
31
|
const provider = await this.getProvider();
|
|
32
32
|
console.log(`You are using llm provider: ${this.provider} with model: ${aiConfigurations.model ?? 'gpt-5-mini'}`);
|
|
33
|
-
|
|
33
|
+
const options = {
|
|
34
|
+
concurrency: aiConfigurations.concurrency ?? 10,
|
|
35
|
+
};
|
|
36
|
+
return provider.generateSearchVariants(payload, aiConfigurations.model, aiConfigurations.instructions, options);
|
|
34
37
|
}
|
|
35
38
|
async getProvider() {
|
|
36
39
|
if (!this.providerInstance) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm-provider-service.js","sourceRoot":"/","sources":["libraries/llm/llm-provider-service.ts"],"names":[],"mappings":";;;AAAA,6BAAqC;AAOrC,+DAA+D;AAC/D,iEAAuE;AAEvE,IAAY,WAGX;AAHD,WAAY,WAAW;IACtB,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;AAClB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAID,MAAa,oBAAoB;IAgBH;IAfrB,gBAAgB,GAAiC,IAAI,CAAC;IAE7C,SAAS,GAAyC;QAClE,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,KAAK,IAAI,EAAE;YAChC,MAAM,MAAM,GAAG,MAAM,IAAA,gBAAY,GAAE,CAAC,iBAAiB,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACjF,IAAI,CAAC,MAAM,EAAE,CAAC;gBACb,MAAM,IAAA,8BAAe,EAAC,iCAAiC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;YAC9E,CAAC;YACD,OAAO,IAAI,0CAAwB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC;QACD,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,KAAK,IAAI,EAAE;YAChC,MAAM,IAAA,8BAAe,EAAC,YAAY,WAAW,CAAC,MAAM,yBAAyB,CAAC,CAAC;QAChF,CAAC;KACD,CAAC;IAEF,YAA6B,QAAqB;QAArB,aAAQ,GAAR,QAAQ,CAAa;IAAG,CAAC;I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AE,gBAAgB,CAAC,WAAW,IAAI,EAAE;SAC/C,CAAC;QACF,OAAO,QAAQ,CAAC,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACjH,CAAC;IAEO,KAAK,CAAC,WAAW;QACxB,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;gBACd,MAAM,IAAA,8BAAe,EAAC,yCAAyC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YACjF,CAAC;YACD,IAAI,CAAC,gBAAgB,GAAG,MAAM,OAAO,EAAE,CAAC;QACzC,CAAC;QACD,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC9B,CAAC;CACD;AA1CD,oDA0CC","sourcesContent":["import { getLibraries } from '../..';\nimport {\n\tItemTextInput,\n\tAiConfiguration,\n\tTextVariantResult,\n\tIAICompletionProvider,\n} from './interfaces/common-llm-interfaces';\nimport { badRequestError } from '../../utilities/error-common';\nimport { OpenAICompletionProvider } from './providers/openai-provider';\n\nexport enum LLMProvider {\n\tOPENAI = 'openai',\n\tGEMINI = 'gemini',\n}\n\ntype ProviderFactory = () => Promise<IAICompletionProvider>;\n\nexport class LLMCompletionService {\n\tprivate providerInstance: IAICompletionProvider | null = null;\n\n\tprivate readonly factories: Record<LLMProvider, ProviderFactory> = {\n\t\t[LLMProvider.OPENAI]: async () => {\n\t\t\tconst apiKey = await getLibraries().getSecretsService().getKey('OPENAI_API_KEY');\n\t\t\tif (!apiKey) {\n\t\t\t\tthrow badRequestError(`No API key found for provider ${LLMProvider.OPENAI}`);\n\t\t\t}\n\t\t\treturn new OpenAICompletionProvider(apiKey, 'gpt-5-mini');\n\t\t},\n\t\t[LLMProvider.GEMINI]: async () => {\n\t\t\tthrow badRequestError(`Provider ${LLMProvider.GEMINI} is not implemented yet`);\n\t\t},\n\t};\n\n\tconstructor(private readonly provider: LLMProvider) {}\n\n\tasync generatePromptVariants(\n\t\tpayload: ItemTextInput[],\n\t\taiConfigurations: AiConfiguration\n\t): Promise<TextVariantResult[]> {\n\t\tconst provider = await this.getProvider();\n\t\tconsole.log(\n\t\t\t`You are using llm provider: ${this.provider} with model: ${aiConfigurations.model ?? 'gpt-5-mini'}`\n\t\t);\n\t\tconst options = {\n\t\t\tconcurrency: aiConfigurations.concurrency ?? 10,\n\t\t};\n\t\treturn provider.generateSearchVariants(payload, aiConfigurations.model, aiConfigurations.instructions, options);\n\t}\n\n\tprivate async getProvider(): Promise<IAICompletionProvider> {\n\t\tif (!this.providerInstance) {\n\t\t\tconst factory = this.factories[this.provider];\n\t\t\tif (!factory) {\n\t\t\t\tthrow badRequestError(`Unsupported transliteration provider: ${this.provider}`);\n\t\t\t}\n\t\t\tthis.providerInstance = await factory();\n\t\t}\n\t\treturn this.providerInstance;\n\t}\n}\n"]}
|
|
@@ -23,6 +23,7 @@ class SelectedAttributeItem {
|
|
|
23
23
|
name;
|
|
24
24
|
price;
|
|
25
25
|
secondaryPrice;
|
|
26
|
+
quantity;
|
|
26
27
|
}
|
|
27
28
|
exports.SelectedAttributeItem = SelectedAttributeItem;
|
|
28
29
|
__decorate([
|
|
@@ -37,6 +38,10 @@ __decorate([
|
|
|
37
38
|
(0, typegoose_1.prop)({ type: Number, min: 0 }),
|
|
38
39
|
__metadata("design:type", Number)
|
|
39
40
|
], SelectedAttributeItem.prototype, "secondaryPrice", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typegoose_1.prop)({ type: Number, min: 1, max: 999999999, default: 1 }),
|
|
43
|
+
__metadata("design:type", Number)
|
|
44
|
+
], SelectedAttributeItem.prototype, "quantity", void 0);
|
|
40
45
|
class LineItemAttribute {
|
|
41
46
|
attribute;
|
|
42
47
|
attributeSnap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-item-attribute.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/line-item-attribute.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,wDAA+C;AAE/C,MAAM,aAAa;IAEX,IAAI,CAAU;CACrB;AADO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAClB;AAGtB,MAAa,qBAAqB;IAE1B,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,cAAc,CAAU;
|
|
1
|
+
{"version":3,"file":"line-item-attribute.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/line-item-attribute.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,wDAA+C;AAE/C,MAAM,aAAa;IAEX,IAAI,CAAU;CACrB;AADO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAClB;AAGtB,MAAa,qBAAqB;IAE1B,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,cAAc,CAAU;IAGxB,QAAQ,CAAU;CACzB;AAZD,sDAYC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;mDAC9B;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;;oDACzC;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;6DACA;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDAClC;AAG1B,MAAa,iBAAiB;IAEtB,SAAS,CAAkB;IAG3B,aAAa,CAAiB;IAG9B,aAAa,CAA2B;CAC/C;AATD,8CASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,2BAAS,EAAE,CAAC;;oDACb;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BACP,aAAa;wDAAC;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,qBAAqB,CAAC,EAAE,CAAC;;wDACT","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { Attribute } from '../attribute.model';\n\nclass AttributeSnap {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n}\n\nexport class SelectedAttributeItem {\n\t@prop({ required: true, type: String, trim: true })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: Number, min: 0, max: 999999999 })\n\tpublic price!: number;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic secondaryPrice?: number;\n\n\t@prop({ type: Number, min: 1, max: 999999999, default: 1 })\n\tpublic quantity?: number;\n}\n\nexport class LineItemAttribute {\n\t@prop({ required: true, ref: () => Attribute })\n\tpublic attribute!: Ref<Attribute>;\n\n\t@prop({ type: AttributeSnap })\n\tpublic attributeSnap?: AttributeSnap;\n\n\t@prop({ required: true, type: [SelectedAttributeItem] })\n\tpublic selectedItems!: SelectedAttributeItem[];\n}\n"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED