@futdevpro/nts-dynamo 1.10.23 → 1.10.24

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.
Files changed (71) hide show
  1. package/build/_modules/oauth2/_routes/oauth2.controller.d.ts +17 -0
  2. package/build/_modules/oauth2/_routes/oauth2.controller.d.ts.map +1 -0
  3. package/build/_modules/oauth2/_routes/oauth2.controller.js +97 -0
  4. package/build/_modules/oauth2/_routes/oauth2.controller.js.map +1 -0
  5. package/build/_modules/oauth2/_services/oauth2.auth-service.d.ts +31 -0
  6. package/build/_modules/oauth2/_services/oauth2.auth-service.d.ts.map +1 -0
  7. package/build/_modules/oauth2/_services/oauth2.auth-service.js +216 -0
  8. package/build/_modules/oauth2/_services/oauth2.auth-service.js.map +1 -0
  9. package/build/_modules/oauth2/_services/oauth2.control-service.d.ts +133 -0
  10. package/build/_modules/oauth2/_services/oauth2.control-service.d.ts.map +1 -0
  11. package/build/_modules/oauth2/_services/oauth2.control-service.js +574 -0
  12. package/build/_modules/oauth2/_services/oauth2.control-service.js.map +1 -0
  13. package/build/_modules/oauth2/index.d.ts +4 -0
  14. package/build/_modules/oauth2/index.d.ts.map +1 -0
  15. package/build/_modules/oauth2/index.js +7 -0
  16. package/build/_modules/oauth2/index.js.map +1 -0
  17. package/build/_modules/open-ai/_enums/open-ai-model.enum.d.ts +11 -0
  18. package/build/_modules/open-ai/_enums/open-ai-model.enum.d.ts.map +1 -0
  19. package/build/_modules/open-ai/_enums/open-ai-model.enum.js +110 -0
  20. package/build/_modules/open-ai/_enums/open-ai-model.enum.js.map +1 -0
  21. package/build/_modules/open-ai/_models/gpt-call-settings.interface.d.ts +54 -0
  22. package/build/_modules/open-ai/_models/gpt-call-settings.interface.d.ts.map +1 -0
  23. package/build/_modules/open-ai/_models/gpt-call-settings.interface.js +65 -0
  24. package/build/_modules/open-ai/_models/gpt-call-settings.interface.js.map +1 -0
  25. package/build/_modules/open-ai/_models/open-ai-api-env-settings.interface.d.ts +7 -0
  26. package/build/_modules/open-ai/_models/open-ai-api-env-settings.interface.d.ts.map +1 -0
  27. package/build/_modules/open-ai/_models/open-ai-api-env-settings.interface.js +3 -0
  28. package/build/_modules/open-ai/_models/open-ai-api-env-settings.interface.js.map +1 -0
  29. package/build/_modules/open-ai/_models/open-ai-settings.interface.d.ts +17 -0
  30. package/build/_modules/open-ai/_models/open-ai-settings.interface.d.ts.map +1 -0
  31. package/build/_modules/open-ai/_models/open-ai-settings.interface.js +25 -0
  32. package/build/_modules/open-ai/_models/open-ai-settings.interface.js.map +1 -0
  33. package/build/_modules/open-ai/_services/embedding.control-service.d.ts +26 -0
  34. package/build/_modules/open-ai/_services/embedding.control-service.d.ts.map +1 -0
  35. package/build/_modules/open-ai/_services/embedding.control-service.js +54 -0
  36. package/build/_modules/open-ai/_services/embedding.control-service.js.map +1 -0
  37. package/build/_modules/open-ai/_services/gpt.service-base.d.ts +98 -0
  38. package/build/_modules/open-ai/_services/gpt.service-base.d.ts.map +1 -0
  39. package/build/_modules/open-ai/_services/gpt.service-base.js +284 -0
  40. package/build/_modules/open-ai/_services/gpt.service-base.js.map +1 -0
  41. package/build/_modules/open-ai/_services/open-ai.service-base.d.ts +23 -0
  42. package/build/_modules/open-ai/_services/open-ai.service-base.d.ts.map +1 -0
  43. package/build/_modules/open-ai/_services/open-ai.service-base.js +50 -0
  44. package/build/_modules/open-ai/_services/open-ai.service-base.js.map +1 -0
  45. package/build/_modules/open-ai/index.d.ts +8 -0
  46. package/build/_modules/open-ai/index.d.ts.map +1 -0
  47. package/build/_modules/open-ai/index.js +11 -0
  48. package/build/_modules/open-ai/index.js.map +1 -0
  49. package/build/_services/base/db.service.d.ts +38 -0
  50. package/build/_services/base/db.service.d.ts.map +1 -1
  51. package/build/_services/base/db.service.js +40 -0
  52. package/build/_services/base/db.service.js.map +1 -1
  53. package/build/_services/server/app.server.d.ts +17 -0
  54. package/build/_services/server/app.server.d.ts.map +1 -1
  55. package/build/_services/server/app.server.js +17 -0
  56. package/build/_services/server/app.server.js.map +1 -1
  57. package/package.json +47 -17
  58. package/src/_modules/oauth2/_routes/oauth2.controller.ts +99 -0
  59. package/src/_modules/oauth2/_services/oauth2.auth-service.ts +232 -0
  60. package/src/_modules/oauth2/_services/oauth2.control-service.ts +651 -0
  61. package/src/_modules/oauth2/index.ts +9 -0
  62. package/src/_modules/open-ai/_enums/open-ai-model.enum.ts +137 -0
  63. package/src/_modules/open-ai/_models/gpt-call-settings.interface.ts +69 -0
  64. package/src/_modules/open-ai/_models/open-ai-api-env-settings.interface.ts +12 -0
  65. package/src/_modules/open-ai/_models/open-ai-settings.interface.ts +31 -0
  66. package/src/_modules/open-ai/_services/embedding.control-service.ts +61 -0
  67. package/src/_modules/open-ai/_services/gpt.service-base.ts +440 -0
  68. package/src/_modules/open-ai/_services/open-ai.service-base.ts +73 -0
  69. package/src/_modules/open-ai/index.ts +13 -0
  70. package/src/_services/base/db.service.ts +41 -0
  71. package/src/_services/server/app.server.ts +18 -0
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DyNTS_OpenAIModel = void 0;
4
+ var DyNTS_OpenAIModel;
5
+ (function (DyNTS_OpenAIModel) {
6
+ // GPT-3.5
7
+ /* gpt35_turbo = 'gpt-3.5-turbo',
8
+ gpt35_turbo0125 = 'gpt-3.5-turbo-0125',
9
+ gpt35_turbo1106 = 'gpt-3.5-turbo-1106',
10
+ gpt35_turbo16k = 'gpt-3.5-turbo-16k',
11
+ gpt35_turboInstruct = 'gpt-3.5-turbo-instruct',
12
+ gpt35_turboInstruct0914 = 'gpt-3.5-turbo-instruct-0914', */
13
+ // GPT-4
14
+ // gpt-4
15
+ DyNTS_OpenAIModel["gpt4o"] = "gpt-4o";
16
+ // gpt-4o-2024-08-06
17
+ DyNTS_OpenAIModel["gpt4o_20240806"] = "gpt-4o-2024-08-06";
18
+ // gpt-4o-2024-05-13
19
+ DyNTS_OpenAIModel["gpt4o_20240513"] = "gpt-4o-2024-05-13";
20
+ /* gpt4 = 'gpt-4',
21
+ gpt4_0613 = 'gpt-4-0613',
22
+ gpt4_0125Preview = 'gpt-4-0125-preview',
23
+ gpt4_1106Preview = 'gpt-4-1106-preview',
24
+ gpt4_turbo = 'gpt-4-turbo',
25
+ gpt4_turbo20240409 = 'gpt-4-turbo-2024-04-09',
26
+ gpt4_turboPreview = 'gpt-4-turbo-preview', */
27
+ // GPT-Mini
28
+ // gpt-4o-mini
29
+ DyNTS_OpenAIModel["gpt4o_mini"] = "gpt-4o-mini";
30
+ // gpt-4o-mini-2024-07-18
31
+ DyNTS_OpenAIModel["gpt4o_mini20240718"] = "gpt-4o-mini-2024-07-18";
32
+ // GPT-4o
33
+ /* gpt4o = 'gpt-4o',
34
+ gpt4o_20240513 = 'gpt-4o-2024-05-13',
35
+ gpt4o_mini = 'gpt-4o-mini',
36
+ gpt4o_mini20240718 = 'gpt-4o-mini-2024-07-18', */
37
+ // DALL·E
38
+ /* dallE_2 = 'dall-e-2',
39
+ dallE_2_HD = 'dall-e-2',
40
+ dallE_3 = 'dall-e-3',
41
+ dallE_3_HD = 'dall-e-3', */
42
+ // Text-to-Speech (TTS)
43
+ /* tts1 = 'tts-1',
44
+ tts1_1106 = 'tts-1-1106',
45
+ tts1_HD = 'tts-1-hd',
46
+ tts1_HD_1106 = 'tts-1-hd-1106',
47
+ whisper_1 = 'whisper-1', */
48
+ // Text Embeddings
49
+ // text-embedding-3-small
50
+ DyNTS_OpenAIModel["textEmbedding_3Small"] = "text-embedding-3-small";
51
+ // text-embedding-3-large
52
+ DyNTS_OpenAIModel["textEmbedding_3Large"] = "text-embedding-3-large";
53
+ // text-embedding-ada-002
54
+ DyNTS_OpenAIModel["textEmbedding_ada002"] = "text-embedding-ada-002";
55
+ /* textEmbedding_ada002 = 'text-embedding-ada-002',
56
+ textEmbedding_3Small = 'text-embedding-3-small',
57
+ textEmbedding_3Large = 'text-embedding-3-large', */
58
+ // Moderation Models
59
+ /* textModeration_007 = 'text-moderation-007',
60
+ textModeration_latest = 'text-moderation-latest',
61
+ textModeration_stable = 'text-moderation-stable', */
62
+ /* davinci002 = 'davinci-002', */
63
+ /* // GPT-3.5
64
+ gpt35_turbo = 'gpt-3.5-turbo',
65
+ gpt35_turbo0125 = 'gpt-3.5-turbo-0125',
66
+ gpt35_turbo1106 = 'gpt-3.5-turbo-1106',
67
+ gpt35_turbo16k = 'gpt-3.5-turbo-16k',
68
+ gpt35_turboInstruct = 'gpt-3.5-turbo-instruct',
69
+ gpt35_turboInstruct0914 = 'gpt-3.5-turbo-instruct-0914',
70
+
71
+ // GPT-4
72
+ gpt4 = 'gpt-4',
73
+ gpt4_0613 = 'gpt-4-0613',
74
+ gpt4_0125Preview = 'gpt-4-0125-preview',
75
+ gpt4_1106Preview = 'gpt-4-1106-preview',
76
+ gpt4_turbo = 'gpt-4-turbo',
77
+ gpt4_turbo20240409 = 'gpt-4-turbo-2024-04-09',
78
+ gpt4_turboPreview = 'gpt-4-turbo-preview',
79
+
80
+ // GPT-4o
81
+ gpt4o = 'gpt-4o',
82
+ gpt4o_20240513 = 'gpt-4o-2024-05-13',
83
+ gpt4o_mini = 'gpt-4o-mini',
84
+ gpt4o_mini20240718 = 'gpt-4o-mini-2024-07-18',
85
+
86
+ // DALL·E
87
+ dallE_2 = 'dall-e-2',
88
+ dallE_3 = 'dall-e-3',
89
+
90
+ // Text-to-Speech (TTS)
91
+ tts1 = 'tts-1',
92
+ tts1_1106 = 'tts-1-1106',
93
+ tts1_HD = 'tts-1-hd',
94
+ tts1_HD_1106 = 'tts-1-hd-1106',
95
+ whisper_1 = 'whisper-1',
96
+
97
+ // Text Embeddings
98
+ textEmbedding_ada002 = 'text-embedding-ada-002',
99
+ textEmbedding_3Small = 'text-embedding-3-small',
100
+ textEmbedding_3Large = 'text-embedding-3-large',
101
+
102
+ // Moderation Models
103
+ textModeration_007 = 'text-moderation-007',
104
+ textModeration_latest = 'text-moderation-latest',
105
+ textModeration_stable = 'text-moderation-stable',
106
+
107
+
108
+ davinci002 = 'davinci-002', */
109
+ })(DyNTS_OpenAIModel || (exports.DyNTS_OpenAIModel = DyNTS_OpenAIModel = {}));
110
+ //# sourceMappingURL=open-ai-model.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-ai-model.enum.js","sourceRoot":"","sources":["../../../../src/_modules/open-ai/_enums/open-ai-model.enum.ts"],"names":[],"mappings":";;;AAKA,IAAY,iBA+HX;AA/HD,WAAY,iBAAiB;IAC3B,UAAU;IACV;;;;;+DAK2D;IAE3D,QAAQ;IACR,QAAQ;IACR,qCAAgB,CAAA;IAChB,oBAAoB;IACpB,yDAAoC,CAAA;IACpC,oBAAoB;IACpB,yDAAoC,CAAA;IAEpC;;;;;;iDAM6C;IAE7C,WAAW;IACX,cAAc;IACd,+CAA0B,CAAA;IAC1B,yBAAyB;IACzB,kEAA6C,CAAA;IAG7C,SAAS;IACT;;;qDAGiD;IAEjD,SAAS;IACT;;;+BAG2B;IAE3B,uBAAuB;IACvB;;;;+BAI2B;IAE3B,kBAAkB;IAClB,yBAAyB;IACzB,oEAA+C,CAAA;IAC/C,yBAAyB;IACzB,oEAA+C,CAAA;IAC/C,yBAAyB;IACzB,oEAA+C,CAAA;IAE/C;;uDAEmD;IAEnD,sBAAsB;IACtB;;wDAEoD;IAGpD,iCAAiC;IAYjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCA6C8B;AAChC,CAAC,EA/HW,iBAAiB,iCAAjB,iBAAiB,QA+H5B"}
@@ -0,0 +1,54 @@
1
+ import { DyNTS_OpenAIModel } from '../_enums/open-ai-model.enum';
2
+ export declare class DyNTS_GPTCall_Settings {
3
+ systemPrompt?: string;
4
+ useModel?: DyNTS_OpenAIModel | string;
5
+ gptProject?: string;
6
+ debugLog?: boolean;
7
+ /**
8
+ * This parameter controls the randomness and creativity of the generated output.
9
+ *
10
+ * Lower values (e.g., 0.2) produce more focused, predictable results,
11
+ * while higher values (e.g., 0.8) introduce more variation and unexpected outputs,
12
+ * making the model more creative and exploratory.
13
+ *
14
+ * Adjust this setting to balance between creativity and consistency.
15
+ */
16
+ temperature?: number;
17
+ /**
18
+ * Defines the upper limit of tokens (words or parts of words)
19
+ * the model can generate in a single response.
20
+ *
21
+ * The total token count includes both the input (prompt) and the output (response).
22
+ *
23
+ * You can allocate up to 4096 tokens per request, but be mindful of prompt length,
24
+ * as it affects how many tokens remain for the response.
25
+ */
26
+ maxTokens?: number;
27
+ /**
28
+ * This parameter adjusts the diversity of the output using nucleus sampling,
29
+ * where the model considers tokens based on cumulative probability.
30
+ *
31
+ * A value of 0.5 ensures that only the most likely half of all possible tokens
32
+ * are considered, while increasing the value (up to 1)
33
+ * allows for a broader range of token options, leading to more varied responses.
34
+ */
35
+ topP?: number;
36
+ /**
37
+ * This setting penalizes tokens that have already appeared frequently in the generated text,
38
+ * discouraging repetition and encouraging the model to introduce new content.
39
+ *
40
+ * Higher values result in less repetition, making the output more diverse.
41
+ */
42
+ frequencyPenalty?: number;
43
+ /**
44
+ * This parameter influences the model by penalizing tokens based on
45
+ * their presence in the text so far.
46
+ *
47
+ * It encourages the introduction of new topics or ideas by reducing the likelihood of
48
+ * generating tokens that have already appeared,
49
+ * helping to keep the conversation or text more varied and engaging.
50
+ */
51
+ presencePenalty?: number;
52
+ constructor(set?: DyNTS_GPTCall_Settings);
53
+ }
54
+ //# sourceMappingURL=gpt-call-settings.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpt-call-settings.interface.d.ts","sourceRoot":"","sources":["../../../../src/_modules/open-ai/_models/gpt-call-settings.interface.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,qBAAa,sBAAsB;IACjC,YAAY,CAAC,EAAE,MAAM,CAAM;IAC3B,QAAQ,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAA2B;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,CAAO;IAC3B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAQ;IAC1B;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAQ;IACrB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAK;IAC9B;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,MAAM,CAAK;gBAO3B,GAAG,CAAC,EAAE,sBAAsB;CAM/B"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DyNTS_GPTCall_Settings = void 0;
4
+ const open_ai_model_enum_1 = require("../_enums/open-ai-model.enum");
5
+ class DyNTS_GPTCall_Settings {
6
+ systemPrompt = '';
7
+ useModel = open_ai_model_enum_1.DyNTS_OpenAIModel.gpt4o;
8
+ gptProject;
9
+ debugLog;
10
+ /**
11
+ * This parameter controls the randomness and creativity of the generated output.
12
+ *
13
+ * Lower values (e.g., 0.2) produce more focused, predictable results,
14
+ * while higher values (e.g., 0.8) introduce more variation and unexpected outputs,
15
+ * making the model more creative and exploratory.
16
+ *
17
+ * Adjust this setting to balance between creativity and consistency.
18
+ */
19
+ temperature = 0.5;
20
+ /**
21
+ * Defines the upper limit of tokens (words or parts of words)
22
+ * the model can generate in a single response.
23
+ *
24
+ * The total token count includes both the input (prompt) and the output (response).
25
+ *
26
+ * You can allocate up to 4096 tokens per request, but be mindful of prompt length,
27
+ * as it affects how many tokens remain for the response.
28
+ */
29
+ maxTokens = 2000;
30
+ /**
31
+ * This parameter adjusts the diversity of the output using nucleus sampling,
32
+ * where the model considers tokens based on cumulative probability.
33
+ *
34
+ * A value of 0.5 ensures that only the most likely half of all possible tokens
35
+ * are considered, while increasing the value (up to 1)
36
+ * allows for a broader range of token options, leading to more varied responses.
37
+ */
38
+ topP = 0.75;
39
+ /**
40
+ * This setting penalizes tokens that have already appeared frequently in the generated text,
41
+ * discouraging repetition and encouraging the model to introduce new content.
42
+ *
43
+ * Higher values result in less repetition, making the output more diverse.
44
+ */
45
+ frequencyPenalty = 0;
46
+ /**
47
+ * This parameter influences the model by penalizing tokens based on
48
+ * their presence in the text so far.
49
+ *
50
+ * It encourages the introduction of new topics or ideas by reducing the likelihood of
51
+ * generating tokens that have already appeared,
52
+ * helping to keep the conversation or text more varied and engaging.
53
+ */
54
+ presencePenalty = 0;
55
+ /* organizationId?: string;
56
+ apiKey?: string;
57
+ project?: string; */
58
+ constructor(set) {
59
+ if (set) {
60
+ Object.assign(this, set);
61
+ }
62
+ }
63
+ }
64
+ exports.DyNTS_GPTCall_Settings = DyNTS_GPTCall_Settings;
65
+ //# sourceMappingURL=gpt-call-settings.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpt-call-settings.interface.js","sourceRoot":"","sources":["../../../../src/_modules/open-ai/_models/gpt-call-settings.interface.ts"],"names":[],"mappings":";;;AAGA,qEAAiE;AAEjE,MAAa,sBAAsB;IACjC,YAAY,GAAY,EAAE,CAAC;IAC3B,QAAQ,GAAgC,sCAAiB,CAAC,KAAK,CAAC;IAChE,UAAU,CAAU;IACpB,QAAQ,CAAW;IAEnB;;;;;;;;OAQG;IACH,WAAW,GAAY,GAAG,CAAC;IAC3B;;;;;;;;OAQG;IACH,SAAS,GAAY,IAAI,CAAC;IAC1B;;;;;;;OAOG;IACH,IAAI,GAAY,IAAI,CAAC;IACrB;;;;;OAKG;IACH,gBAAgB,GAAY,CAAC,CAAC;IAC9B;;;;;;;OAOG;IACH,eAAe,GAAY,CAAC,CAAC;IAE7B;;wBAEoB;IAEpB,YACE,GAA4B;QAE5B,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;CACF;AA/DD,wDA+DC"}
@@ -0,0 +1,7 @@
1
+ export interface DyNTS_OpenAIApiEnv_Settings {
2
+ accessKey: string;
3
+ organizationId: string;
4
+ legacyEndpoint: string;
5
+ newEndpoint: string;
6
+ }
7
+ //# sourceMappingURL=open-ai-api-env-settings.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-ai-api-env-settings.interface.d.ts","sourceRoot":"","sources":["../../../../src/_modules/open-ai/_models/open-ai-api-env-settings.interface.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IAEvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=open-ai-api-env-settings.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-ai-api-env-settings.interface.js","sourceRoot":"","sources":["../../../../src/_modules/open-ai/_models/open-ai-api-env-settings.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { ClientOptions } from 'openai';
2
+ import { DyNTS_GPTCall_Settings } from './gpt-call-settings.interface';
3
+ export declare class DyNTS_OpenAI_Settings {
4
+ /**
5
+ * OpenAI API configuration.
6
+ *
7
+ * apiKey, organization and project are required.
8
+ * they are defaults to
9
+ * process.env['OPENAI_API_KEY'],
10
+ * process.env['OPENAI_ORG_ID'] and
11
+ * process.env['OPENAI_PROJECT_ID']
12
+ */
13
+ openAIConfig: ClientOptions;
14
+ defaultSettings: DyNTS_GPTCall_Settings;
15
+ constructor(set: DyNTS_OpenAI_Settings);
16
+ }
17
+ //# sourceMappingURL=open-ai-settings.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-ai-settings.interface.d.ts","sourceRoot":"","sources":["../../../../src/_modules/open-ai/_models/open-ai-settings.interface.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,qBAAa,qBAAqB;IAChC;;;;;;;;OAQG;IACH,YAAY,EAAE,aAAa,CAAC;IAI5B,eAAe,EAAE,sBAAsB,CAAC;gBAGtC,GAAG,EAAE,qBAAqB;CAM7B"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DyNTS_OpenAI_Settings = void 0;
4
+ class DyNTS_OpenAI_Settings {
5
+ /**
6
+ * OpenAI API configuration.
7
+ *
8
+ * apiKey, organization and project are required.
9
+ * they are defaults to
10
+ * process.env['OPENAI_API_KEY'],
11
+ * process.env['OPENAI_ORG_ID'] and
12
+ * process.env['OPENAI_PROJECT_ID']
13
+ */
14
+ openAIConfig;
15
+ /* systemPrompt?: string;
16
+ useModel?: string | DyNTS_OpenAIModel = DyNTS_OpenAIModel.gpt4o; */
17
+ defaultSettings;
18
+ constructor(set) {
19
+ if (set) {
20
+ Object.assign(this, set);
21
+ }
22
+ }
23
+ }
24
+ exports.DyNTS_OpenAI_Settings = DyNTS_OpenAI_Settings;
25
+ //# sourceMappingURL=open-ai-settings.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-ai-settings.interface.js","sourceRoot":"","sources":["../../../../src/_modules/open-ai/_models/open-ai-settings.interface.ts"],"names":[],"mappings":";;;AAOA,MAAa,qBAAqB;IAChC;;;;;;;;OAQG;IACH,YAAY,CAAgB;IAC5B;uEACmE;IAEnE,eAAe,CAAyB;IAExC,YACE,GAA0B;QAE1B,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;CACF;AAvBD,sDAuBC"}
@@ -0,0 +1,26 @@
1
+ import { DyNTS_OpenAIModel } from '../_enums/open-ai-model.enum';
2
+ import { DyNTS_OpenAI_ServiceBase } from './open-ai.service-base';
3
+ /**
4
+ * Service for handling OpenAI text embeddings
5
+ * @class Embedding_ControlService
6
+ * @extends DyNTS_OpenAI_ServiceBase
7
+ */
8
+ export declare class Embedding_ControlService extends DyNTS_OpenAI_ServiceBase {
9
+ /**
10
+ * Creates embeddings for the given text using the specified model
11
+ * @param {string} text - The text to create embeddings for
12
+ * @param {DyNTS_OpenAIModel} [model=DyNTS_GPTModel.textEmbedding_3Large] - The embedding model to use
13
+ * @returns {Promise<number[]>} The embedding vector
14
+ * @throws {Error} If the embedding creation fails
15
+ */
16
+ createEmbedding(text: string, model?: DyNTS_OpenAIModel): Promise<number[]>;
17
+ /**
18
+ * Creates embeddings for multiple texts using the specified model
19
+ * @param {string[]} texts - Array of texts to create embeddings for
20
+ * @param {DyNTS_OpenAIModel} [model=DyNTS_GPTModel.textEmbedding_3Large] - The embedding model to use
21
+ * @returns {Promise<number[][]>} Array of embedding vectors
22
+ * @throws {Error} If the embedding creation fails
23
+ */
24
+ createEmbeddings(texts: string[], model?: DyNTS_OpenAIModel): Promise<number[][]>;
25
+ }
26
+ //# sourceMappingURL=embedding.control-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedding.control-service.d.ts","sourceRoot":"","sources":["../../../../src/_modules/open-ai/_services/embedding.control-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,wBAAwB;IAEpE;;;;;;OAMG;IACG,eAAe,CACnB,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,iBAA0D,GAChE,OAAO,CAAC,MAAM,EAAE,CAAC;IAcpB;;;;;;OAMG;IACG,gBAAgB,CACpB,KAAK,EAAE,MAAM,EAAE,EACf,KAAK,GAAE,iBAA0D,GAChE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;CAavB"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Embedding_ControlService = void 0;
4
+ const open_ai_model_enum_1 = require("../_enums/open-ai-model.enum");
5
+ const open_ai_service_base_1 = require("./open-ai.service-base");
6
+ /**
7
+ * Service for handling OpenAI text embeddings
8
+ * @class Embedding_ControlService
9
+ * @extends DyNTS_OpenAI_ServiceBase
10
+ */
11
+ class Embedding_ControlService extends open_ai_service_base_1.DyNTS_OpenAI_ServiceBase {
12
+ /**
13
+ * Creates embeddings for the given text using the specified model
14
+ * @param {string} text - The text to create embeddings for
15
+ * @param {DyNTS_OpenAIModel} [model=DyNTS_GPTModel.textEmbedding_3Large] - The embedding model to use
16
+ * @returns {Promise<number[]>} The embedding vector
17
+ * @throws {Error} If the embedding creation fails
18
+ */
19
+ async createEmbedding(text, model = open_ai_model_enum_1.DyNTS_OpenAIModel.textEmbedding_3Large) {
20
+ try {
21
+ const response = await this.openai.embeddings.create({
22
+ model,
23
+ input: text,
24
+ });
25
+ return response.data[0].embedding;
26
+ }
27
+ catch (error) {
28
+ console.error('Error creating embedding:', error);
29
+ throw new Error('Failed to create embedding');
30
+ }
31
+ }
32
+ /**
33
+ * Creates embeddings for multiple texts using the specified model
34
+ * @param {string[]} texts - Array of texts to create embeddings for
35
+ * @param {DyNTS_OpenAIModel} [model=DyNTS_GPTModel.textEmbedding_3Large] - The embedding model to use
36
+ * @returns {Promise<number[][]>} Array of embedding vectors
37
+ * @throws {Error} If the embedding creation fails
38
+ */
39
+ async createEmbeddings(texts, model = open_ai_model_enum_1.DyNTS_OpenAIModel.textEmbedding_3Large) {
40
+ try {
41
+ const response = await this.openai.embeddings.create({
42
+ model,
43
+ input: texts,
44
+ });
45
+ return response.data.map(item => item.embedding);
46
+ }
47
+ catch (error) {
48
+ console.error('Error creating embeddings:', error);
49
+ throw new Error('Failed to create embeddings');
50
+ }
51
+ }
52
+ }
53
+ exports.Embedding_ControlService = Embedding_ControlService;
54
+ //# sourceMappingURL=embedding.control-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedding.control-service.js","sourceRoot":"","sources":["../../../../src/_modules/open-ai/_services/embedding.control-service.ts"],"names":[],"mappings":";;;AAGA,qEAAiE;AACjE,iEAAkE;AAElE;;;;GAIG;AACH,MAAa,wBAAyB,SAAQ,+CAAwB;IAEpE;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CACnB,IAAY,EACZ,QAA2B,sCAAiB,CAAC,oBAAoB;QAEjE,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;gBACnD,KAAK;gBACL,KAAK,EAAE,IAAI;aACZ,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACpC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;YAClD,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB,CACpB,KAAe,EACf,QAA2B,sCAAiB,CAAC,oBAAoB;QAEjE,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;gBACnD,KAAK;gBACL,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF;AAjDD,4DAiDC"}
@@ -0,0 +1,98 @@
1
+ import { ChatCompletion } from 'openai/resources';
2
+ import { DyNTS_OpenAI_ServiceBase } from './open-ai.service-base';
3
+ import { DyNTS_GPTCall_Settings } from '../_models/gpt-call-settings.interface';
4
+ /**
5
+ * {
6
+ organization: 'org-XY',
7
+ apiKey: 'sk-XY',
8
+ project: 'proj_XY',
9
+ }
10
+ */
11
+ export declare class DyNTS_GPT_ServiceBase extends DyNTS_OpenAI_ServiceBase {
12
+ defaultLogReplacer: string;
13
+ askYesNoQuestion(question: string, issuer: string, replaceThisInLog?: string): Promise<boolean>;
14
+ askSimpleQuestion(question: string, issuer: string, replaceThisInLog?: string): Promise<string>;
15
+ askPercentageQuestion(question: string, issuer: string, replaceThisInLog?: string): Promise<number>;
16
+ askSelectQuestion(question: string, selectFrom: string[], issuer: string, replaceThisInLog?: string): Promise<string>;
17
+ askMultipleSelectQuestionWithOptions(question: string, options: string[], issuer: string, replaceThisInLog?: string): Promise<string[]>;
18
+ /**
19
+ * Azt kérjük tőle, hogy adjon egy JSON formában választ.
20
+ * Amit aztán megpróbálunk JSON.parse-olni.
21
+ * Ha nem sikerül, akkor { unparsable: answer }-t adunk vissza.
22
+ */
23
+ askJSONQuestion(question: string, issuer: string, replaceThisInLog?: string): Promise<any>;
24
+ /**
25
+ * Azt kérjük tőle, hogy adjon egy JSON formában választ.
26
+ * Amit aztán megpróbálunk JSON.parse-olni.
27
+ * Ha nem sikerül, akkor { unparsable: answer }-t adunk vissza.
28
+ *
29
+ * A keysDescription-be leírjuk, milyen kulcsokat várunk. (nem konkrét kulcsneveket)
30
+ */
31
+ askJSONQuestionWithKeysDescription(question: string, keysDescription: string, issuer: string, replaceThisInLog?: string): Promise<any>;
32
+ /**
33
+ * Azt kérjük tőle, hogy adjon egy JSON formában választ.
34
+ * Amit aztán megpróbálunk JSON.parse-olni.
35
+ * Ha nem sikerül, akkor { unparsable: answer }-t adunk vissza.
36
+ *
37
+ * A keys-be leírjuk a konkrét kulcsneveket.
38
+ */
39
+ askJSONQuestionWithExactKeys(question: string, keys: string[], issuer: string, replaceThisInLog?: string): Promise<any>;
40
+ askListQuestion(question: string, issuer: string, replaceThisInLog?: string): Promise<string[]>;
41
+ private logQuestion;
42
+ /**
43
+ * This function will log the answer if the debugLog is true
44
+ */
45
+ getQuestionAnswer(question: string, issuer: string, messageSettings?: DyNTS_GPTCall_Settings): Promise<string>;
46
+ /**
47
+ * olvasható mondatszerű-listaszerű formába teszi a listaelemeket
48
+ * pl.: ['a', 'b', 'c'] -> '"a", "b" or "c"'
49
+ */
50
+ getListAsText(list: string[]): string;
51
+ /**
52
+ * This function will log the question and the answer if the debugLog is true
53
+ */
54
+ getAnswer(question: string, issuer: string, settings?: DyNTS_GPTCall_Settings): Promise<string>;
55
+ resolveSimpleUserMessage(message: string, issuer: string, settings?: DyNTS_GPTCall_Settings): Promise<string>;
56
+ resolveConversation(conversation: DyNTS_GPT_Message[], issuer: string, settings?: DyNTS_GPTCall_Settings, getFullResponse?: boolean): Promise<string | ChatCompletion>;
57
+ /**
58
+ * TODO: Overview this: maybe it should use each setting from default if not provided here
59
+ */
60
+ private getMessageCreateInput;
61
+ private getDefaultSystemMessage;
62
+ }
63
+ export interface DyNTS_GPT_Message {
64
+ role: DyNTS_GPT_Message_Role | string;
65
+ content: string;
66
+ }
67
+ export declare enum DyNTS_GPT_Message_Role {
68
+ /**
69
+ * Developer-provided instructions that the model should follow, regardless of
70
+ * messages sent by the user. With o1 models and newer, `developer` messages
71
+ * replace the previous `system` messages.
72
+ */
73
+ developer = "developer",
74
+ /**
75
+ * Developer-provided instructions that the model should follow, regardless of
76
+ * messages sent by the user. With o1 models and newer, use `developer` messages
77
+ * for this purpose instead.
78
+ */
79
+ system = "system",
80
+ /**
81
+ * Messages sent by an end user, containing prompts or additional context
82
+ * information.
83
+ */
84
+ user = "user",
85
+ /**
86
+ * Messages sent by the model in response to user messages.
87
+ */
88
+ assistant = "assistant",
89
+ /** ??? */
90
+ tool = "tool",
91
+ /**
92
+ * ???
93
+ * @deprecated
94
+ */
95
+ function = "function"
96
+ }
97
+ export declare function DyFM_notNull(value: any): boolean;
98
+ //# sourceMappingURL=gpt.service-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpt.service-base.d.ts","sourceRoot":"","sources":["../../../../src/_modules/open-ai/_services/gpt.service-base.ts"],"names":[],"mappings":"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"}