@mate-academy/llm-gateway 1.0.3 → 1.1.0
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/README.md +377 -0
- package/dist/LLMService.constants.js +1 -16
- package/dist/LLMService.entity.js +1 -38
- package/dist/LLMService.factory.js +1 -71
- package/dist/LLMService.typedefs.js +1 -36
- package/dist/functional.utils.js +1 -9
- package/dist/index.js +1 -23
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.constants.js +1 -99
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.constants.js.map +1 -1
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.entity.js +1 -42
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.typedefs.js +1 -19
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAIService.factory.js +1 -17
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAIService.factory.js.map +1 -1
- package/dist/providers/GoogleGenerativeAI/index.js +1 -22
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.js +1 -211
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.js.map +1 -1
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAICompletion.service.js +1 -50
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAICompletion.service.js.map +1 -1
- package/dist/providers/GoogleGenerativeAI/services/index.js +1 -19
- package/dist/providers/OpenAI/OpenAI.constants.js +1 -44
- package/dist/providers/OpenAI/OpenAI.constants.js.map +1 -1
- package/dist/providers/OpenAI/OpenAI.entity.js +1 -15
- package/dist/providers/OpenAI/OpenAI.typedefs.js +1 -14
- package/dist/providers/OpenAI/OpenAIService.factory.js +1 -17
- package/dist/providers/OpenAI/OpenAIService.factory.js.map +1 -1
- package/dist/providers/OpenAI/index.js +1 -22
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.js +1 -200
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.js.map +1 -1
- package/dist/providers/OpenAI/services/OpenAICompletion.service.js +1 -52
- package/dist/providers/OpenAI/services/OpenAICompletion.service.js.map +1 -1
- package/dist/providers/OpenAI/services/index.js +1 -19
- package/dist/providers/index.js +1 -19
- package/dist/services/LLMAssistanceService.abstract.js +1 -12
- package/dist/services/LLMAssistanceService.abstract.js.map +1 -1
- package/dist/services/LLMBaseService.abstract.js +1 -27
- package/dist/services/LLMBaseService.abstract.js.map +1 -1
- package/dist/services/LLMCompletionService.abstract.js +1 -12
- package/dist/services/LLMCompletionService.abstract.js.map +1 -1
- package/dist/services/LLMServicePurposeFactory.abstract.js +1 -7
- package/dist/services/index.js +1 -21
- package/package.json +5 -2
|
@@ -1,99 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GOOGLE_AI_SERVICE_BUILDERS = exports.GOOGLE_AI_MODELS = exports.MIN_CACHE_CONTENT_LENGTH = void 0;
|
|
4
|
-
const LLMService_typedefs_1 = require("../../LLMService.typedefs");
|
|
5
|
-
const GoogleGenerativeAI_typedefs_1 = require("./GoogleGenerativeAI.typedefs");
|
|
6
|
-
const services_1 = require("../../providers/GoogleGenerativeAI/services");
|
|
7
|
-
const functional_utils_1 = require("../../functional.utils");
|
|
8
|
-
exports.MIN_CACHE_CONTENT_LENGTH = 32_768;
|
|
9
|
-
const GOOGLE_AI_AVAILABLE_MODELS = {
|
|
10
|
-
[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_FLASH]: {
|
|
11
|
-
name: GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_FLASH,
|
|
12
|
-
limits: {
|
|
13
|
-
maxInputTokens: 1_048_576,
|
|
14
|
-
maxOutputTokens: 8_192,
|
|
15
|
-
},
|
|
16
|
-
config: {
|
|
17
|
-
temperature: 0.2,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_FLASH_STABLE]: {
|
|
21
|
-
name: GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_FLASH_STABLE,
|
|
22
|
-
limits: {
|
|
23
|
-
maxInputTokens: 1_048_576,
|
|
24
|
-
maxOutputTokens: 8_192,
|
|
25
|
-
},
|
|
26
|
-
config: {
|
|
27
|
-
temperature: 0.2,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_PRO]: {
|
|
31
|
-
name: GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_PRO,
|
|
32
|
-
limits: {
|
|
33
|
-
maxInputTokens: 2_097_152,
|
|
34
|
-
maxOutputTokens: 8_192,
|
|
35
|
-
},
|
|
36
|
-
config: {
|
|
37
|
-
temperature: 0.2,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_PRO_STABLE]: {
|
|
41
|
-
name: GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_PRO_STABLE,
|
|
42
|
-
limits: {
|
|
43
|
-
maxInputTokens: 2_097_152,
|
|
44
|
-
maxOutputTokens: 8_192,
|
|
45
|
-
},
|
|
46
|
-
config: {
|
|
47
|
-
temperature: 0.2,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_0_FLASH]: {
|
|
51
|
-
name: GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_0_FLASH,
|
|
52
|
-
limits: {
|
|
53
|
-
maxInputTokens: 1_048_576,
|
|
54
|
-
maxOutputTokens: 8_192,
|
|
55
|
-
},
|
|
56
|
-
config: {
|
|
57
|
-
temperature: 0.2,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_0_FLASH_STABLE]: {
|
|
61
|
-
name: GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_0_FLASH_STABLE,
|
|
62
|
-
limits: {
|
|
63
|
-
maxInputTokens: 1_048_576,
|
|
64
|
-
maxOutputTokens: 8_192,
|
|
65
|
-
},
|
|
66
|
-
config: {
|
|
67
|
-
temperature: 0.2,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_5_PRO_PREVIEW]: {
|
|
71
|
-
name: GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_5_PRO_PREVIEW,
|
|
72
|
-
limits: {
|
|
73
|
-
maxInputTokens: 1_048_576,
|
|
74
|
-
maxOutputTokens: 65_536,
|
|
75
|
-
},
|
|
76
|
-
config: {
|
|
77
|
-
temperature: 0.2,
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
exports.GOOGLE_AI_MODELS = {
|
|
82
|
-
[LLMService_typedefs_1.LLMPurposes.Completion]: (0, functional_utils_1.pick)(GOOGLE_AI_AVAILABLE_MODELS, [
|
|
83
|
-
GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_FLASH,
|
|
84
|
-
GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_PRO,
|
|
85
|
-
GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_0_FLASH,
|
|
86
|
-
GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_5_PRO_PREVIEW,
|
|
87
|
-
]),
|
|
88
|
-
// Stable models are used for assistance as they support additional methods
|
|
89
|
-
[LLMService_typedefs_1.LLMPurposes.Assistance]: (0, functional_utils_1.pick)(GOOGLE_AI_AVAILABLE_MODELS, [
|
|
90
|
-
GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_FLASH_STABLE,
|
|
91
|
-
GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_PRO_STABLE,
|
|
92
|
-
GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_0_FLASH_STABLE,
|
|
93
|
-
]),
|
|
94
|
-
};
|
|
95
|
-
exports.GOOGLE_AI_SERVICE_BUILDERS = {
|
|
96
|
-
[LLMService_typedefs_1.LLMPurposes.Completion]: (logger, options) => (new services_1.GoogleGenerativeAICompletionService(logger, options)),
|
|
97
|
-
[LLMService_typedefs_1.LLMPurposes.Assistance]: (logger, options) => (new services_1.GoogleGenerativeAIAssistanceService(logger, options)),
|
|
98
|
-
};
|
|
99
|
-
//# sourceMappingURL=GoogleGenerativeAI.constants.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GOOGLE_AI_SERVICE_BUILDERS=exports.GOOGLE_AI_MODELS=exports.MIN_CACHE_CONTENT_LENGTH=void 0;const LLMService_typedefs_1=require("../../LLMService.typedefs"),GoogleGenerativeAI_typedefs_1=require("./GoogleGenerativeAI.typedefs"),services_1=require("../../providers/GoogleGenerativeAI/services"),functional_utils_1=require("../../functional.utils");exports.MIN_CACHE_CONTENT_LENGTH=32768;const GOOGLE_AI_AVAILABLE_MODELS={[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_FLASH]:{name:GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_FLASH,limits:{maxInputTokens:1048576,maxOutputTokens:8192},config:{temperature:.2}},[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_FLASH_STABLE]:{name:GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_FLASH_STABLE,limits:{maxInputTokens:1048576,maxOutputTokens:8192},config:{temperature:.2}},[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_PRO]:{name:GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_PRO,limits:{maxInputTokens:2097152,maxOutputTokens:8192},config:{temperature:.2}},[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_PRO_STABLE]:{name:GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_PRO_STABLE,limits:{maxInputTokens:2097152,maxOutputTokens:8192},config:{temperature:.2}},[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_0_FLASH]:{name:GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_0_FLASH,limits:{maxInputTokens:1048576,maxOutputTokens:8192},config:{temperature:.2}},[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_0_FLASH_STABLE]:{name:GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_0_FLASH_STABLE,limits:{maxInputTokens:1048576,maxOutputTokens:8192},config:{temperature:.2}},[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_5_PRO_PREVIEW]:{name:GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_5_PRO_PREVIEW,limits:{maxInputTokens:1048576,maxOutputTokens:65536},config:{temperature:.2}}};exports.GOOGLE_AI_MODELS={[LLMService_typedefs_1.LLMPurposes.Completion]:(0,functional_utils_1.pick)(GOOGLE_AI_AVAILABLE_MODELS,[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_FLASH,GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_PRO,GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_0_FLASH,GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_5_PRO_PREVIEW]),[LLMService_typedefs_1.LLMPurposes.Assistance]:(0,functional_utils_1.pick)(GOOGLE_AI_AVAILABLE_MODELS,[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_FLASH_STABLE,GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_1_5_PRO_STABLE,GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_2_0_FLASH_STABLE])},exports.GOOGLE_AI_SERVICE_BUILDERS={[LLMService_typedefs_1.LLMPurposes.Completion]:(e,_)=>new services_1.GoogleGenerativeAICompletionService(e,_),[LLMService_typedefs_1.LLMPurposes.Assistance]:(e,_)=>new services_1.GoogleGenerativeAIAssistanceService(e,_)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleGenerativeAI.constants.js","sourceRoot":"","sources":["../../../src/providers/GoogleGenerativeAI/GoogleGenerativeAI.constants.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"GoogleGenerativeAI.constants.js","sourceRoot":"","sources":["../../../src/providers/GoogleGenerativeAI/GoogleGenerativeAI.constants.ts"],"names":[],"mappings":";;;AAAA,+DAM+B;AAC/B,+EAA6E;AAC7E,sEAGiD;AACjD,yDAA0C;AAE7B,QAAA,wBAAwB,GAAG,MAAM,CAAC;AAE/C,MAAM,0BAA0B,GAE5B;IACF,CAAC,0DAA4B,CAAC,gBAAgB,CAAC,EAAE;QAC/C,IAAI,EAAE,0DAA4B,CAAC,gBAAgB;QACnD,MAAM,EAAE;YACN,cAAc,EAAE,SAAS;YACzB,eAAe,EAAE,KAAK;SACvB;QACD,MAAM,EAAE;YACN,WAAW,EAAE,GAAG;SACjB;KACF;IACD,CAAC,0DAA4B,CAAC,uBAAuB,CAAC,EAAE;QACtD,IAAI,EAAE,0DAA4B,CAAC,u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UAAU,CAAC,EAAE,IAAA,uBAAI,EAC5B,0BAA0B,EAC1B;QACE,0DAA4B,CAAC,gBAAgB;QAC7C,0DAA4B,CAAC,cAAc;QAC3C,0DAA4B,CAAC,gBAAgB;QAC7C,0DAA4B,CAAC,sBAAsB;KACpD,CACF;IACD,2EAA2E;IAC3E,CAAC,iCAAW,CAAC,UAAU,CAAC,EAAE,IAAA,uBAAI,EAC5B,0BAA0B,EAC1B;QACE,0DAA4B,CAAC,uBAAuB;QACpD,0DAA4B,CAAC,qBAAqB;QAClD,0DAA4B,CAAC,uBAAuB;KACrD,CACF;CACF,CAAC;AAEW,QAAA,0BAA0B,GAInC;IACF,CAAC,iCAAW,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,CAC7C,IAAI,8CAAmC,CAAC,MAAM,EAAE,OAAO,CAAC,CACzD;IACD,CAAC,iCAAW,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,CAC7C,IAAI,8CAAmC,CAAC,MAAM,EAAE,OAAO,CAAC,CACzD;CACF,CAAC"}
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleGenerativeAIEntity = void 0;
|
|
4
|
-
class GoogleGenerativeAIEntity {
|
|
5
|
-
static getContentParameters(model, messages, instructions) {
|
|
6
|
-
return {
|
|
7
|
-
model: model.name,
|
|
8
|
-
contents: messages.map((message) => ({
|
|
9
|
-
parts: [{
|
|
10
|
-
text: message.content,
|
|
11
|
-
}],
|
|
12
|
-
role: message.role,
|
|
13
|
-
})),
|
|
14
|
-
config: {
|
|
15
|
-
systemInstruction: instructions,
|
|
16
|
-
temperature: model.config.temperature,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
static getFileDataParts(uploadedFiles) {
|
|
21
|
-
return uploadedFiles.map((file) => ({
|
|
22
|
-
fileData: {
|
|
23
|
-
fileUri: file.path,
|
|
24
|
-
mimeType: file.mimeType,
|
|
25
|
-
},
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
static getTextParts(messages) {
|
|
29
|
-
return messages.map((message) => ({ text: message }));
|
|
30
|
-
}
|
|
31
|
-
static getCountTokensFn(instance) {
|
|
32
|
-
return async (contents, model) => {
|
|
33
|
-
const tokenCount = await instance.models.countTokens({
|
|
34
|
-
model: model.name,
|
|
35
|
-
contents,
|
|
36
|
-
});
|
|
37
|
-
return tokenCount.totalTokens ?? 0;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.GoogleGenerativeAIEntity = GoogleGenerativeAIEntity;
|
|
42
|
-
//# sourceMappingURL=GoogleGenerativeAI.entity.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GoogleGenerativeAIEntity=void 0;class GoogleGenerativeAIEntity{static getContentParameters(e,t,n){return{model:e.name,contents:t.map((e=>({parts:[{text:e.content}],role:e.role}))),config:{systemInstruction:n,temperature:e.config.temperature}}}static getFileDataParts(e){return e.map((e=>({fileData:{fileUri:e.path,mimeType:e.mimeType}})))}static getTextParts(e){return e.map((e=>({text:e})))}static getCountTokensFn(e){return async(t,n)=>(await e.models.countTokens({model:n.name,contents:t})).totalTokens??0}}exports.GoogleGenerativeAIEntity=GoogleGenerativeAIEntity;
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleGenerativeAIRoles = exports.GoogleGenerativeAIModelNames = void 0;
|
|
4
|
-
var GoogleGenerativeAIModelNames;
|
|
5
|
-
(function (GoogleGenerativeAIModelNames) {
|
|
6
|
-
GoogleGenerativeAIModelNames["GEMINI_1_5_FLASH"] = "gemini-1.5-flash";
|
|
7
|
-
GoogleGenerativeAIModelNames["GEMINI_1_5_FLASH_STABLE"] = "gemini-1.5-flash-001";
|
|
8
|
-
GoogleGenerativeAIModelNames["GEMINI_1_5_PRO"] = "gemini-1.5-pro";
|
|
9
|
-
GoogleGenerativeAIModelNames["GEMINI_1_5_PRO_STABLE"] = "gemini-1.5-pro-002";
|
|
10
|
-
GoogleGenerativeAIModelNames["GEMINI_2_0_FLASH"] = "gemini-2.0-flash";
|
|
11
|
-
GoogleGenerativeAIModelNames["GEMINI_2_0_FLASH_STABLE"] = "gemini-2.0-flash-001";
|
|
12
|
-
GoogleGenerativeAIModelNames["GEMINI_2_5_PRO_PREVIEW"] = "gemini-2.5-pro-preview-03-25";
|
|
13
|
-
})(GoogleGenerativeAIModelNames || (exports.GoogleGenerativeAIModelNames = GoogleGenerativeAIModelNames = {}));
|
|
14
|
-
var GoogleGenerativeAIRoles;
|
|
15
|
-
(function (GoogleGenerativeAIRoles) {
|
|
16
|
-
GoogleGenerativeAIRoles["User"] = "user";
|
|
17
|
-
GoogleGenerativeAIRoles["Model"] = "model";
|
|
18
|
-
})(GoogleGenerativeAIRoles || (exports.GoogleGenerativeAIRoles = GoogleGenerativeAIRoles = {}));
|
|
19
|
-
//# sourceMappingURL=GoogleGenerativeAI.typedefs.js.map
|
|
1
|
+
"use strict";var GoogleGenerativeAIModelNames,GoogleGenerativeAIRoles;Object.defineProperty(exports,"__esModule",{value:!0}),exports.GoogleGenerativeAIRoles=exports.GoogleGenerativeAIModelNames=void 0,function(e){e.GEMINI_1_5_FLASH="gemini-1.5-flash",e.GEMINI_1_5_FLASH_STABLE="gemini-1.5-flash-001",e.GEMINI_1_5_PRO="gemini-1.5-pro",e.GEMINI_1_5_PRO_STABLE="gemini-1.5-pro-002",e.GEMINI_2_0_FLASH="gemini-2.0-flash",e.GEMINI_2_0_FLASH_STABLE="gemini-2.0-flash-001",e.GEMINI_2_5_PRO_PREVIEW="gemini-2.5-pro-preview-03-25"}(GoogleGenerativeAIModelNames||(exports.GoogleGenerativeAIModelNames=GoogleGenerativeAIModelNames={})),function(e){e.User="user",e.Model="model"}(GoogleGenerativeAIRoles||(exports.GoogleGenerativeAIRoles=GoogleGenerativeAIRoles={}));
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleGenerativeAIServiceFactory = void 0;
|
|
4
|
-
const LLMService_typedefs_1 = require("../../LLMService.typedefs");
|
|
5
|
-
const services_1 = require("../../services");
|
|
6
|
-
const GoogleGenerativeAI_constants_1 = require("./GoogleGenerativeAI.constants");
|
|
7
|
-
class GoogleGenerativeAIServiceFactory extends services_1.LLMServicePurposeFactory {
|
|
8
|
-
createService(purpose, logger, options) {
|
|
9
|
-
const serviceBuilder = GoogleGenerativeAI_constants_1.GOOGLE_AI_SERVICE_BUILDERS[purpose];
|
|
10
|
-
if (!serviceBuilder) {
|
|
11
|
-
throw new Error(`Purpose [${purpose}] is not supported for [${LLMService_typedefs_1.LLMProviders.GoogleGenerativeAI}] service`);
|
|
12
|
-
}
|
|
13
|
-
return serviceBuilder(logger, options);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.GoogleGenerativeAIServiceFactory = GoogleGenerativeAIServiceFactory;
|
|
17
|
-
//# sourceMappingURL=GoogleGenerativeAIService.factory.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GoogleGenerativeAIServiceFactory=void 0;const LLMService_typedefs_1=require("../../LLMService.typedefs"),services_1=require("../../services"),GoogleGenerativeAI_constants_1=require("../../providers/GoogleGenerativeAI/GoogleGenerativeAI.constants");class GoogleGenerativeAIServiceFactory extends services_1.LLMServicePurposeFactory{createService(e,r,o){const t=GoogleGenerativeAI_constants_1.GOOGLE_AI_SERVICE_BUILDERS[e];if(!t)throw new Error(`Purpose [${e}] is not supported for [${LLMService_typedefs_1.LLMProviders.GoogleGenerativeAI}] service`);return t(r,o)}}exports.GoogleGenerativeAIServiceFactory=GoogleGenerativeAIServiceFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleGenerativeAIService.factory.js","sourceRoot":"","sources":["../../../src/providers/GoogleGenerativeAI/GoogleGenerativeAIService.factory.ts"],"names":[],"mappings":";;;AACA
|
|
1
|
+
{"version":3,"file":"GoogleGenerativeAIService.factory.js","sourceRoot":"","sources":["../../../src/providers/GoogleGenerativeAI/GoogleGenerativeAIService.factory.ts"],"names":[],"mappings":";;;AACA,+DAK+B;AAC/B,yCAAsD;AACtD,8GAAyG;AAEzG,MAAa,gCAAiC,SAAQ,mCAErD;IACC,aAAa,CAGX,OAAgB,EAChB,MAAc,EACd,OAA4D;QAE5D,MAAM,cAAc,GAAG,yDAA0B,CAAC,OAAO,CAAC,CAAC;QAE3D,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,2BAA2B,kCAAY,CAAC,kBAAkB,WAAW,CAAC,CAAC;QAC5G,CAAC;QAED,OAAO,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;CACF;AAlBD,4EAkBC"}
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./GoogleGenerativeAI.constants"), exports);
|
|
18
|
-
__exportStar(require("./GoogleGenerativeAI.typedefs"), exports);
|
|
19
|
-
__exportStar(require("./GoogleGenerativeAI.entity"), exports);
|
|
20
|
-
__exportStar(require("./GoogleGenerativeAIService.factory"), exports);
|
|
21
|
-
__exportStar(require("./services"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,o){void 0===o&&(o=t);var i=Object.getOwnPropertyDescriptor(r,t);i&&!("get"in i?!r.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,o,i)}:function(e,r,t,o){void 0===o&&(o=t),e[o]=r[t]}),__exportStar=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||__createBinding(r,e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./GoogleGenerativeAI.constants"),exports),__exportStar(require("./GoogleGenerativeAI.typedefs"),exports),__exportStar(require("./GoogleGenerativeAI.entity"),exports),__exportStar(require("./GoogleGenerativeAIService.factory"),exports),__exportStar(require("./services"),exports);
|
|
@@ -1,211 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleGenerativeAIAssistanceService = void 0;
|
|
4
|
-
const uuid_1 = require("uuid");
|
|
5
|
-
const genai_1 = require("@google/genai");
|
|
6
|
-
const LLMService_typedefs_1 = require("../../../LLMService.typedefs");
|
|
7
|
-
const services_1 = require("../../../services");
|
|
8
|
-
const GoogleGenerativeAI_typedefs_1 = require("../GoogleGenerativeAI.typedefs");
|
|
9
|
-
const GoogleGenerativeAI_entity_1 = require("../GoogleGenerativeAI.entity");
|
|
10
|
-
const GoogleGenerativeAI_constants_1 = require("../GoogleGenerativeAI.constants");
|
|
11
|
-
class GoogleGenerativeAIAssistanceService extends services_1.LLMAssistanceService {
|
|
12
|
-
#instance = null;
|
|
13
|
-
cachedContent = new Map();
|
|
14
|
-
chatSessions = new Map();
|
|
15
|
-
uploadedFiles = new Map();
|
|
16
|
-
constructor(logger, options) {
|
|
17
|
-
super(LLMService_typedefs_1.LLMProviders.GoogleGenerativeAI, logger, options);
|
|
18
|
-
}
|
|
19
|
-
get instance() {
|
|
20
|
-
if (!this.#instance) {
|
|
21
|
-
this.#instance = new genai_1.GoogleGenAI({
|
|
22
|
-
apiKey: this.options.apiKey,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return this.#instance;
|
|
26
|
-
}
|
|
27
|
-
async uploadFile(file) {
|
|
28
|
-
try {
|
|
29
|
-
const { path, mimeType, name, } = file;
|
|
30
|
-
const existingFile = this.uploadedFiles.get(path);
|
|
31
|
-
if (existingFile) {
|
|
32
|
-
return existingFile;
|
|
33
|
-
}
|
|
34
|
-
const uploadResult = await this.instance.files.upload({
|
|
35
|
-
file: path,
|
|
36
|
-
config: {
|
|
37
|
-
mimeType,
|
|
38
|
-
displayName: name,
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
if (!uploadResult.name) {
|
|
42
|
-
throw new Error('Upload result did not return a name');
|
|
43
|
-
}
|
|
44
|
-
if (!uploadResult.uri) {
|
|
45
|
-
throw new Error('Upload result did not return a uri');
|
|
46
|
-
}
|
|
47
|
-
if (uploadResult.error) {
|
|
48
|
-
throw uploadResult.error;
|
|
49
|
-
}
|
|
50
|
-
const uploadedFile = {
|
|
51
|
-
...file,
|
|
52
|
-
fileId: uploadResult.name,
|
|
53
|
-
path: uploadResult.uri,
|
|
54
|
-
};
|
|
55
|
-
this.uploadedFiles.set(path, uploadedFile);
|
|
56
|
-
return uploadedFile;
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
this.logger
|
|
60
|
-
.child('uploadFile')
|
|
61
|
-
.error('Error uploading file', {
|
|
62
|
-
error,
|
|
63
|
-
file,
|
|
64
|
-
});
|
|
65
|
-
return { error };
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
async deleteFile(fileId) {
|
|
69
|
-
this.uploadedFiles.delete(fileId);
|
|
70
|
-
await this.instance.files.delete({
|
|
71
|
-
name: fileId,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
async createFileStorage(options) {
|
|
75
|
-
const { uploadedFiles, model, instructions, } = options;
|
|
76
|
-
try {
|
|
77
|
-
const parts = GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity.getFileDataParts(uploadedFiles);
|
|
78
|
-
const countTokensFn = GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity
|
|
79
|
-
.getCountTokensFn(this.instance);
|
|
80
|
-
const tokenCount = await countTokensFn(parts, model);
|
|
81
|
-
if (tokenCount < GoogleGenerativeAI_constants_1.MIN_CACHE_CONTENT_LENGTH) {
|
|
82
|
-
return {
|
|
83
|
-
storageId: '',
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
const cacheResult = await this.instance.caches.create({
|
|
87
|
-
model: model.name,
|
|
88
|
-
config: {
|
|
89
|
-
contents: [
|
|
90
|
-
{
|
|
91
|
-
role: GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIRoles.User,
|
|
92
|
-
parts,
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
systemInstruction: instructions,
|
|
96
|
-
ttl: '1h',
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
if (!cacheResult.name) {
|
|
100
|
-
throw new Error('Cache result did not return a name');
|
|
101
|
-
}
|
|
102
|
-
this.cachedContent.set(cacheResult.name, cacheResult);
|
|
103
|
-
return {
|
|
104
|
-
storageId: cacheResult.name,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
catch (error) {
|
|
108
|
-
this.logger
|
|
109
|
-
.child('createFileStorage')
|
|
110
|
-
.error('Error creating file storage', {
|
|
111
|
-
error,
|
|
112
|
-
uploadedFiles,
|
|
113
|
-
model,
|
|
114
|
-
});
|
|
115
|
-
return { error };
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
async deleteFileStorage(fileStorageId) {
|
|
119
|
-
if (fileStorageId === '') {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
this.cachedContent.delete(fileStorageId);
|
|
123
|
-
await this.instance.caches.delete({
|
|
124
|
-
name: fileStorageId,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
createChat(options) {
|
|
128
|
-
try {
|
|
129
|
-
const { storageId, model, instructions, history: providedHistory, files, } = options;
|
|
130
|
-
const cachedContent = storageId
|
|
131
|
-
? this.cachedContent.get(storageId)
|
|
132
|
-
: undefined;
|
|
133
|
-
const history = providedHistory
|
|
134
|
-
? [
|
|
135
|
-
{
|
|
136
|
-
role: GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIRoles.User,
|
|
137
|
-
parts: GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity.getTextParts(providedHistory),
|
|
138
|
-
},
|
|
139
|
-
]
|
|
140
|
-
: [];
|
|
141
|
-
if (!cachedContent && files) {
|
|
142
|
-
const fileParts = GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity.getFileDataParts(files);
|
|
143
|
-
history.push({
|
|
144
|
-
role: GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIRoles.User,
|
|
145
|
-
parts: fileParts,
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
const chatSession = this.instance.chats.create({
|
|
149
|
-
model: model.name,
|
|
150
|
-
history,
|
|
151
|
-
config: {
|
|
152
|
-
systemInstruction: instructions,
|
|
153
|
-
temperature: model.config.temperature,
|
|
154
|
-
...(cachedContent && { cachedContent: cachedContent.name }),
|
|
155
|
-
},
|
|
156
|
-
});
|
|
157
|
-
const chatId = (0, uuid_1.v4)();
|
|
158
|
-
this.chatSessions.set(chatId, chatSession);
|
|
159
|
-
return Promise.resolve({ chatId });
|
|
160
|
-
}
|
|
161
|
-
catch (error) {
|
|
162
|
-
this.logger
|
|
163
|
-
.child('createChat')
|
|
164
|
-
.error('Error creating chat', {
|
|
165
|
-
error,
|
|
166
|
-
options,
|
|
167
|
-
});
|
|
168
|
-
return Promise.resolve({ error });
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
deleteChat(chatId) {
|
|
172
|
-
this.chatSessions.delete(chatId);
|
|
173
|
-
return Promise.resolve();
|
|
174
|
-
}
|
|
175
|
-
createAssistant() {
|
|
176
|
-
// Google Generative AI does not have an assistant concept at the moment
|
|
177
|
-
return Promise.resolve({
|
|
178
|
-
assistantId: '',
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
deleteAssistant() {
|
|
182
|
-
// Google Generative AI does not have an assistant concept at the moment
|
|
183
|
-
return Promise.resolve();
|
|
184
|
-
}
|
|
185
|
-
async assistInChat(options) {
|
|
186
|
-
try {
|
|
187
|
-
const { message, chatId, } = options;
|
|
188
|
-
const chatSession = this.chatSessions.get(chatId);
|
|
189
|
-
if (!chatSession) {
|
|
190
|
-
throw new Error('Chat session not found');
|
|
191
|
-
}
|
|
192
|
-
const chatResponse = await chatSession.sendMessage({
|
|
193
|
-
message: message.content,
|
|
194
|
-
});
|
|
195
|
-
return {
|
|
196
|
-
text: chatResponse.text ?? '',
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
catch (error) {
|
|
200
|
-
this.logger
|
|
201
|
-
.child('assistInChat')
|
|
202
|
-
.error('Error assisting in chat', {
|
|
203
|
-
error,
|
|
204
|
-
options,
|
|
205
|
-
});
|
|
206
|
-
return { error };
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
exports.GoogleGenerativeAIAssistanceService = GoogleGenerativeAIAssistanceService;
|
|
211
|
-
//# sourceMappingURL=GoogleGenerativeAIAssistance.service.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GoogleGenerativeAIAssistanceService=void 0;const uuid_1=require("uuid"),genai_1=require("@google/genai"),LLMService_typedefs_1=require("../../../LLMService.typedefs"),services_1=require("../../../services"),GoogleGenerativeAI_typedefs_1=require("../../../providers/GoogleGenerativeAI/GoogleGenerativeAI.typedefs"),GoogleGenerativeAI_entity_1=require("../../../providers/GoogleGenerativeAI/GoogleGenerativeAI.entity"),GoogleGenerativeAI_constants_1=require("../../../providers/GoogleGenerativeAI/GoogleGenerativeAI.constants");class GoogleGenerativeAIAssistanceService extends services_1.LLMAssistanceService{#e=null;cachedContent=new Map;chatSessions=new Map;uploadedFiles=new Map;constructor(e,t){super(LLMService_typedefs_1.LLMProviders.GoogleGenerativeAI,e,t)}get instance(){return this.#e||(this.#e=new genai_1.GoogleGenAI({apiKey:this.options.apiKey})),this.#e}async uploadFile(e){try{const{path:t,mimeType:r,name:s}=e,i=this.uploadedFiles.get(t);if(i)return i;const o=await this.instance.files.upload({file:t,config:{mimeType:r,displayName:s}});if(!o.name)throw new Error("Upload result did not return a name");if(!o.uri)throw new Error("Upload result did not return a uri");if(o.error)throw o.error;const n={...e,fileId:o.name,path:o.uri};return this.uploadedFiles.set(t,n),n}catch(t){return this.logger.child("uploadFile").error("Error uploading file",{error:t,file:e}),{error:t}}}async deleteFile(e){this.uploadedFiles.delete(e),await this.instance.files.delete({name:e})}async createFileStorage(e){const{uploadedFiles:t,model:r,instructions:s}=e;try{const e=GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity.getFileDataParts(t),i=GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity.getCountTokensFn(this.instance);if(await i(e,r)<GoogleGenerativeAI_constants_1.MIN_CACHE_CONTENT_LENGTH)return{storageId:""};const o=await this.instance.caches.create({model:r.name,config:{contents:[{role:GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIRoles.User,parts:e}],systemInstruction:s,ttl:"1h"}});if(!o.name)throw new Error("Cache result did not return a name");return this.cachedContent.set(o.name,o),{storageId:o.name}}catch(e){return this.logger.child("createFileStorage").error("Error creating file storage",{error:e,uploadedFiles:t,model:r}),{error:e}}}async deleteFileStorage(e){""!==e&&(this.cachedContent.delete(e),await this.instance.caches.delete({name:e}))}createChat(e){try{const{storageId:t,model:r,instructions:s,history:i,files:o}=e,n=t?this.cachedContent.get(t):void 0,a=i?[{role:GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIRoles.User,parts:GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity.getTextParts(i)}]:[];if(!n&&o){const e=GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity.getFileDataParts(o);a.push({role:GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIRoles.User,parts:e})}const l=this.instance.chats.create({model:r.name,history:a,config:{systemInstruction:s,temperature:r.config.temperature,...n&&{cachedContent:n.name}}}),c=(0,uuid_1.v4)();return this.chatSessions.set(c,l),Promise.resolve({chatId:c})}catch(t){return this.logger.child("createChat").error("Error creating chat",{error:t,options:e}),Promise.resolve({error:t})}}deleteChat(e){return this.chatSessions.delete(e),Promise.resolve()}createAssistant(){return Promise.resolve({assistantId:""})}deleteAssistant(){return Promise.resolve()}async assistInChat(e){try{const{message:t,chatId:r}=e,s=this.chatSessions.get(r);if(!s)throw new Error("Chat session not found");return{text:(await s.sendMessage({message:t.content})).text??""}}catch(t){return this.logger.child("assistInChat").error("Error assisting in chat",{error:t,options:e}),{error:t}}}}exports.GoogleGenerativeAIAssistanceService=GoogleGenerativeAIAssistanceService;
|
package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleGenerativeAIAssistance.service.js","sourceRoot":"","sources":["../../../../src/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.ts"],"names":[],"mappings":";;;AACA,+BAAoC;AACpC,yCAKuB;AACvB
|
|
1
|
+
{"version":3,"file":"GoogleGenerativeAIAssistance.service.js","sourceRoot":"","sources":["../../../../src/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.ts"],"names":[],"mappings":";;;AACA,+BAAoC;AACpC,yCAKuB;AACvB,+DAa+B;AAC/B,yCAAkD;AAClD,4GAAqG;AACrG,wGAAoG;AACpG,8GAAuG;AAEvG,MAAa,mCACX,SAAQ,+BAAqD;IAC7D,SAAS,GAAuB,IAAI,CAAC;IAE7B,aAAa,GAA+B,IAAI,GAAG,EAAE,CAAC;IAEtD,YAAY,GAAsB,IAAI,GAAG,EAAE,CAAC;IAE5C,aAAa,GAAiC,IAAI,GAAG,EAAE,CAAC;IAEhE,YACE,MAAc,EACd,OAA4D;QAE5D,KAAK,CAAC,kCAAY,CAAC,kBAAkB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED,IAAc,QAAQ;QACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,IAAI,mBAAW,CAAC;gBAC/B,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;aAC5B,CAAC,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAmB;QAClC,IAAI,CAAC;YACH,MAAM,EACJ,IAAI,EACJ,QAAQ,EACR,IAAI,GACL,GAAG,IAAI,CAAC;YAET,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAElD,IAAI,YAAY,EAAE,CAAC;gBACjB,OAAO,YAAY,CAAC;YACtB,CAAC;YAED,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;gBACpD,IAAI,EAAE,IAAI;gBACV,MAAM,EAAE;oBACN,QAAQ;oBACR,WAAW,EAAE,IAAI;iBAClB;aACF,CAAC,CAAC;YAEH,IAAI,CAAC,YAAY,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E;gBAChC,KAAK;gBACL,OAAO;aACR,CAAC,CAAC;YAEL,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AAvRD,kFAuRC"}
|
|
@@ -1,50 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleGenerativeAICompletionService = void 0;
|
|
4
|
-
const genai_1 = require("@google/genai");
|
|
5
|
-
const LLMService_typedefs_1 = require("../../../LLMService.typedefs");
|
|
6
|
-
const services_1 = require("../../../services");
|
|
7
|
-
const LLMService_entity_1 = require("../../../LLMService.entity");
|
|
8
|
-
const GoogleGenerativeAI_entity_1 = require("../GoogleGenerativeAI.entity");
|
|
9
|
-
class GoogleGenerativeAICompletionService extends services_1.LLMCompletionService {
|
|
10
|
-
#instance = null;
|
|
11
|
-
constructor(logger, options) {
|
|
12
|
-
super(LLMService_typedefs_1.LLMProviders.GoogleGenerativeAI, logger, options);
|
|
13
|
-
}
|
|
14
|
-
get instance() {
|
|
15
|
-
if (!this.#instance) {
|
|
16
|
-
this.#instance = new genai_1.GoogleGenAI({
|
|
17
|
-
apiKey: this.options.apiKey,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return this.#instance;
|
|
21
|
-
}
|
|
22
|
-
async sendMessage(options) {
|
|
23
|
-
try {
|
|
24
|
-
const { model, message, history = [], instructions, } = options;
|
|
25
|
-
const countTokensFn = GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity
|
|
26
|
-
.getCountTokensFn(this.instance);
|
|
27
|
-
const combinedMessages = await LLMService_entity_1.LLMServiceEntity.combineMessagesWithLimit({
|
|
28
|
-
history,
|
|
29
|
-
message: message.content,
|
|
30
|
-
model,
|
|
31
|
-
countTokensFn,
|
|
32
|
-
});
|
|
33
|
-
const result = await this.instance.models.generateContent(GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity.getContentParameters(model, combinedMessages, instructions));
|
|
34
|
-
return {
|
|
35
|
-
text: result.text ?? '',
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
this.logger
|
|
40
|
-
.child('sendMessage')
|
|
41
|
-
.error('Error sending message', {
|
|
42
|
-
error,
|
|
43
|
-
options,
|
|
44
|
-
});
|
|
45
|
-
return { error };
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.GoogleGenerativeAICompletionService = GoogleGenerativeAICompletionService;
|
|
50
|
-
//# sourceMappingURL=GoogleGenerativeAICompletion.service.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GoogleGenerativeAICompletionService=void 0;const genai_1=require("@google/genai"),LLMService_typedefs_1=require("../../../LLMService.typedefs"),services_1=require("../../../services"),LLMService_entity_1=require("../../../LLMService.entity"),GoogleGenerativeAI_entity_1=require("../../../providers/GoogleGenerativeAI/GoogleGenerativeAI.entity");class GoogleGenerativeAICompletionService extends services_1.LLMCompletionService{#e=null;constructor(e,t){super(LLMService_typedefs_1.LLMProviders.GoogleGenerativeAI,e,t)}get instance(){return this.#e||(this.#e=new genai_1.GoogleGenAI({apiKey:this.options.apiKey})),this.#e}async sendMessage(e){try{const{model:t,message:i,history:n=[],instructions:r}=e,o=GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity.getCountTokensFn(this.instance),s=await LLMService_entity_1.LLMServiceEntity.combineMessagesWithLimit({history:n,message:i.content,model:t,countTokensFn:o});return{text:(await this.instance.models.generateContent(GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity.getContentParameters(t,s,r))).text??""}}catch(t){return this.logger.child("sendMessage").error("Error sending message",{error:t,options:e}),{error:t}}}}exports.GoogleGenerativeAICompletionService=GoogleGenerativeAICompletionService;
|
package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAICompletion.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleGenerativeAICompletion.service.js","sourceRoot":"","sources":["../../../../src/providers/GoogleGenerativeAI/services/GoogleGenerativeAICompletion.service.ts"],"names":[],"mappings":";;;AACA,yCAA4C;AAC5C
|
|
1
|
+
{"version":3,"file":"GoogleGenerativeAICompletion.service.js","sourceRoot":"","sources":["../../../../src/providers/GoogleGenerativeAI/services/GoogleGenerativeAICompletion.service.ts"],"names":[],"mappings":";;;AACA,yCAA4C;AAC5C,+DAK+B;AAC/B,yCAEoB;AACpB,2DAAuD;AACvD,wGAAoG;AAEpG,MAAa,mCACX,SAAQ,+BAAqD;IAC7D,SAAS,GAAuB,IAAI,CAAC;IAErC,YACE,MAAc,EACd,OAA4D;QAE5D,KAAK,CAAC,kCAAY,CAAC,kBAAkB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED,IAAc,QAAQ;QACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,IAAI,mBAAW,CAAC;gBAC/B,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;aAC5B,CAAC,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,WAAW,CACf,OAAoD;QAEpD,IAAI,CAAC;YACH,MAAM,EACJ,KAAK,EACL,OAAO,EACP,OAAO,GAAG,EAAE,EACZ,YAAY,GACb,GAAG,OAAO,CAAC;YAEZ,MAAM,aAAa,GAAG,oDAAwB;iBAC3C,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAEnC,MAAM,gBAAgB,GAAG,MAAM,oCAAgB,CAAC,wBAAwB,CAAC;gBACvE,OAAO;gBACP,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,KAAK;gBACL,aAAa;aACd,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CACvD,oDAAwB,CAAC,oBAAoB,CAC3C,KAAK,EACL,gBAAgB,EAChB,YAAY,CACb,CACF,CAAC;YAEF,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;aACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,CAAC,MAAM;iBACR,KAAK,CAAC,aAAa,CAAC;iBACpB,KAAK,CAAC,uBAAuB,EAAE;gBAC9B,KAAK;gBACL,OAAO;aACR,CAAC,CAAC;YAEL,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AAhED,kFAgEC"}
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./GoogleGenerativeAICompletion.service"), exports);
|
|
18
|
-
__exportStar(require("./GoogleGenerativeAIAssistance.service"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||__createBinding(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./GoogleGenerativeAICompletion.service"),exports),__exportStar(require("./GoogleGenerativeAIAssistance.service"),exports);
|
|
@@ -1,44 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OPEN_AI_SERVICE_BUILDERS = exports.OPEN_AI_MODELS = void 0;
|
|
4
|
-
const LLMService_typedefs_1 = require("../../LLMService.typedefs");
|
|
5
|
-
const OpenAI_typedefs_1 = require("./OpenAI.typedefs");
|
|
6
|
-
const services_1 = require("./services");
|
|
7
|
-
const functional_utils_1 = require("../../functional.utils");
|
|
8
|
-
const OPEN_AI_AVAILABLE_MODELS = {
|
|
9
|
-
[OpenAI_typedefs_1.OpenAIModelNames.GPT_4_OMNI]: {
|
|
10
|
-
name: OpenAI_typedefs_1.OpenAIModelNames.GPT_4_OMNI,
|
|
11
|
-
limits: {
|
|
12
|
-
maxInputTokens: 128_000,
|
|
13
|
-
maxOutputTokens: 16_384,
|
|
14
|
-
},
|
|
15
|
-
config: {
|
|
16
|
-
temperature: 0.2,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
[OpenAI_typedefs_1.OpenAIModelNames.GPT_4_1]: {
|
|
20
|
-
name: OpenAI_typedefs_1.OpenAIModelNames.GPT_4_1,
|
|
21
|
-
limits: {
|
|
22
|
-
maxInputTokens: 1_047_576,
|
|
23
|
-
maxOutputTokens: 32_768,
|
|
24
|
-
},
|
|
25
|
-
config: {
|
|
26
|
-
temperature: 0.2,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
exports.OPEN_AI_MODELS = {
|
|
31
|
-
[LLMService_typedefs_1.LLMPurposes.Completion]: (0, functional_utils_1.pick)(OPEN_AI_AVAILABLE_MODELS, [
|
|
32
|
-
OpenAI_typedefs_1.OpenAIModelNames.GPT_4_OMNI,
|
|
33
|
-
OpenAI_typedefs_1.OpenAIModelNames.GPT_4_1,
|
|
34
|
-
]),
|
|
35
|
-
[LLMService_typedefs_1.LLMPurposes.Assistance]: (0, functional_utils_1.pick)(OPEN_AI_AVAILABLE_MODELS, [
|
|
36
|
-
OpenAI_typedefs_1.OpenAIModelNames.GPT_4_OMNI,
|
|
37
|
-
OpenAI_typedefs_1.OpenAIModelNames.GPT_4_1,
|
|
38
|
-
]),
|
|
39
|
-
};
|
|
40
|
-
exports.OPEN_AI_SERVICE_BUILDERS = {
|
|
41
|
-
[LLMService_typedefs_1.LLMPurposes.Completion]: (logger, options) => (new services_1.OpenAICompletionService(logger, options)),
|
|
42
|
-
[LLMService_typedefs_1.LLMPurposes.Assistance]: (logger, options) => (new services_1.OpenAIAssistanceService(logger, options)),
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=OpenAI.constants.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OPEN_AI_SERVICE_BUILDERS=exports.OPEN_AI_MODELS=void 0;const LLMService_typedefs_1=require("../../LLMService.typedefs"),OpenAI_typedefs_1=require("../../providers/OpenAI/OpenAI.typedefs"),services_1=require("./services"),functional_utils_1=require("../../functional.utils"),OPEN_AI_AVAILABLE_MODELS={[OpenAI_typedefs_1.OpenAIModelNames.GPT_4_OMNI]:{name:OpenAI_typedefs_1.OpenAIModelNames.GPT_4_OMNI,limits:{maxInputTokens:128e3,maxOutputTokens:16384},config:{temperature:.2}},[OpenAI_typedefs_1.OpenAIModelNames.GPT_4_1]:{name:OpenAI_typedefs_1.OpenAIModelNames.GPT_4_1,limits:{maxInputTokens:1047576,maxOutputTokens:32768},config:{temperature:.2}}};exports.OPEN_AI_MODELS={[LLMService_typedefs_1.LLMPurposes.Completion]:(0,functional_utils_1.pick)(OPEN_AI_AVAILABLE_MODELS,[OpenAI_typedefs_1.OpenAIModelNames.GPT_4_OMNI,OpenAI_typedefs_1.OpenAIModelNames.GPT_4_1]),[LLMService_typedefs_1.LLMPurposes.Assistance]:(0,functional_utils_1.pick)(OPEN_AI_AVAILABLE_MODELS,[OpenAI_typedefs_1.OpenAIModelNames.GPT_4_OMNI,OpenAI_typedefs_1.OpenAIModelNames.GPT_4_1])},exports.OPEN_AI_SERVICE_BUILDERS={[LLMService_typedefs_1.LLMPurposes.Completion]:(e,_)=>new services_1.OpenAICompletionService(e,_),[LLMService_typedefs_1.LLMPurposes.Assistance]:(e,_)=>new services_1.OpenAIAssistanceService(e,_)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAI.constants.js","sourceRoot":"","sources":["../../../src/providers/OpenAI/OpenAI.constants.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"OpenAI.constants.js","sourceRoot":"","sources":["../../../src/providers/OpenAI/OpenAI.constants.ts"],"names":[],"mappings":";;;AAAA,+DAM+B;AAC/B,wEAAsE;AACtE,yCAGoB;AACpB,yDAA0C;AAE1C,MAAM,wBAAwB,GAE1B;IACF,CAAC,kCAAgB,CAAC,UAAU,CAAC,EAAE;QAC7B,IAAI,EAAE,kCAAgB,CAAC,UAAU;QACjC,MAAM,EAAE;YACN,cAAc,EAAE,OAAO;YACvB,eAAe,EAAE,MAAM;SACxB;QACD,MAAM,EAAE;YACN,WAAW,EAAE,GAAG;SACjB;KACF;IACD,CAAC,kCAAgB,CAAC,OAAO,CAAC,EAAE;QAC1B,IAAI,EAAE,kCAAgB,CAAC,OAAO;QAC9B,MAAM,EAAE;YACN,cAAc,EAAE,SAAS;YACzB,eAAe,EAAE,MAAM;SACxB;QACD,MAAM,EAAE;YACN,WAAW,EAAE,GAAG;SACjB;KACF;CACF,CAAC;AAEW,QAAA,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