@futdevpro/nts-dynamo 1.12.14 → 1.14.1
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/build/_collections/star.controller.d.ts +8 -0
- package/build/_collections/star.controller.d.ts.map +1 -0
- package/build/_collections/star.controller.js +98 -0
- package/build/_collections/star.controller.js.map +1 -0
- package/build/_modules/ai/_models/ai-input-interfaces.d.ts +61 -0
- package/build/_modules/ai/_models/ai-input-interfaces.d.ts.map +1 -0
- package/build/_modules/{open-ai/_models/interfaces/oai-document-page.interface.js → ai/_models/ai-input-interfaces.js} +1 -1
- package/build/_modules/ai/_models/ai-input-interfaces.js.map +1 -0
- package/build/_modules/{open-ai/_collections/oai-chunking.util.d.ts → ai/_modules/document-ai/_collections/dai-chunking.util.d.ts} +10 -10
- package/build/_modules/ai/_modules/document-ai/_collections/dai-chunking.util.d.ts.map +1 -0
- package/build/_modules/{open-ai/_collections/oai-chunking.util.js → ai/_modules/document-ai/_collections/dai-chunking.util.js} +58 -41
- package/build/_modules/ai/_modules/document-ai/_collections/dai-chunking.util.js.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_collections/dai-document.util.d.ts +29 -0
- package/build/_modules/ai/_modules/document-ai/_collections/dai-document.util.d.ts.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_collections/dai-document.util.js +74 -0
- package/build/_modules/ai/_modules/document-ai/_collections/dai-document.util.js.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_enums/dai-compare-result-type.enum.d.ts +7 -0
- package/build/_modules/ai/_modules/document-ai/_enums/dai-compare-result-type.enum.d.ts.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_enums/dai-compare-result-type.enum.js +11 -0
- package/build/_modules/ai/_modules/document-ai/_enums/dai-compare-result-type.enum.js.map +1 -0
- package/build/_modules/{open-ai/_models/oai-doc-chunk.data-model.d.ts → ai/_modules/document-ai/_models/data-models/dai-doc-chunk.data-model.d.ts} +25 -13
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-chunk.data-model.d.ts.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-chunk.data-model.js +132 -0
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-chunk.data-model.js.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-page.data-model.d.ts +29 -0
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-page.data-model.d.ts.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-page.data-model.js +112 -0
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-page.data-model.js.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-document.data-model.d.ts +18 -0
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-document.data-model.d.ts.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-document.data-model.js +71 -0
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-document.data-model.js.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-chunk-compare-result.interface.d.ts +9 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-chunk-compare-result.interface.d.ts.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-chunk-compare-result.interface.js +3 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-chunk-compare-result.interface.js.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-page-compare-result.interface.d.ts +12 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-page-compare-result.interface.d.ts.map +1 -0
- package/build/_modules/{open-ai/_models/interfaces/oai-chunk-compare-result.interface.js → ai/_modules/document-ai/_models/interfaces/dai-doc-page-compare-result.interface.js} +1 -1
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-page-compare-result.interface.js.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-document-compare-result.interface.d.ts +13 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-document-compare-result.interface.d.ts.map +1 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-document-compare-result.interface.js +3 -0
- package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-document-compare-result.interface.js.map +1 -0
- package/build/_modules/ai/_modules/document-ai/index.d.ts +11 -0
- package/build/_modules/ai/_modules/document-ai/index.d.ts.map +1 -0
- package/build/_modules/ai/_modules/document-ai/index.js +26 -0
- package/build/_modules/ai/_modules/document-ai/index.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_collections/oai-global-settings.const.d.ts.map +1 -0
- package/build/_modules/{open-ai → ai/_modules/open-ai}/_collections/oai-global-settings.const.js +2 -2
- package/build/_modules/ai/_modules/open-ai/_collections/oai-global-settings.const.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_enums/oai-gpt-message-role.enum.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_enums/oai-gpt-message-role.enum.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-global-settings.interface.d.ts +6 -0
- package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-global-settings.interface.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-chunk-data.service.d.ts +22 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-chunk-data.service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-chunk-data.service.js +223 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-chunk-data.service.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-page.data-service.d.ts +26 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-page.data-service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-page.data-service.js +232 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-page.data-service.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-document.data-service.d.ts +23 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-document.data-service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-document.data-service.js +284 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-document.data-service.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-embedding.control-service.d.ts +7 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-embedding.control-service.d.ts.map +1 -0
- package/build/_modules/{open-ai → ai/_modules/open-ai}/_services/oai-embedding.control-service.js +5 -5
- package/build/_modules/ai/_modules/open-ai/_services/oai-embedding.control-service.js.map +1 -0
- package/build/_modules/{open-ai → ai/_modules/open-ai}/_services/oai-llm-chat.service-base.d.ts +16 -16
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts.map +1 -0
- package/build/_modules/{open-ai → ai/_modules/open-ai}/_services/oai-llm-chat.service-base.js +3 -3
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.js.map +1 -0
- package/build/_modules/{open-ai → ai/_modules/open-ai}/_services/oai-llm.service-base.d.ts +19 -19
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.d.ts.map +1 -0
- package/build/_modules/{open-ai → ai/_modules/open-ai}/_services/oai-llm.service-base.js +6 -6
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.js.map +1 -0
- package/build/_modules/{open-ai → ai/_modules/open-ai}/_services/oai-vector-data.service.d.ts +6 -6
- package/build/_modules/ai/_modules/open-ai/_services/oai-vector-data.service.d.ts.map +1 -0
- package/build/_modules/{open-ai → ai/_modules/open-ai}/_services/oai-vector-data.service.js +138 -6
- package/build/_modules/ai/_modules/open-ai/_services/oai-vector-data.service.js.map +1 -0
- package/build/_modules/{open-ai → ai/_modules/open-ai}/index.d.ts +4 -10
- package/build/_modules/ai/_modules/open-ai/index.d.ts.map +1 -0
- package/build/_modules/{open-ai → ai/_modules/open-ai}/index.js +22 -11
- package/build/_modules/ai/_modules/open-ai/index.js.map +1 -0
- package/build/_modules/ai/_services/ai-embedding.service-base.d.ts +31 -0
- package/build/_modules/ai/_services/ai-embedding.service-base.d.ts.map +1 -0
- package/build/_modules/ai/_services/ai-embedding.service-base.js +12 -0
- package/build/_modules/ai/_services/ai-embedding.service-base.js.map +1 -0
- package/build/_modules/ai/_services/ai-llm-chat.service-base.d.ts +36 -0
- package/build/_modules/ai/_services/ai-llm-chat.service-base.d.ts.map +1 -0
- package/build/_modules/ai/_services/ai-llm-chat.service-base.js +12 -0
- package/build/_modules/ai/_services/ai-llm-chat.service-base.js.map +1 -0
- package/build/_modules/ai/_services/ai-llm.service-base.d.ts +45 -0
- package/build/_modules/ai/_services/ai-llm.service-base.d.ts.map +1 -0
- package/build/_modules/ai/_services/ai-llm.service-base.js +12 -0
- package/build/_modules/ai/_services/ai-llm.service-base.js.map +1 -0
- package/build/_modules/ai/_services/ai-provider.service-base.d.ts +25 -0
- package/build/_modules/ai/_services/ai-provider.service-base.d.ts.map +1 -0
- package/build/_modules/ai/_services/ai-provider.service-base.js +11 -0
- package/build/_modules/ai/_services/ai-provider.service-base.js.map +1 -0
- package/build/_modules/ai/index.d.ts +7 -0
- package/build/_modules/ai/index.d.ts.map +1 -0
- package/build/_modules/ai/index.js +13 -0
- package/build/_modules/ai/index.js.map +1 -0
- package/build/_modules/discord-assistant/_collections/dias-global-settings.const.js +2 -2
- package/build/_modules/discord-assistant/_collections/dias-global-settings.const.js.map +1 -1
- package/build/_modules/discord-assistant/_collections/dias.util.d.ts +1 -1
- package/build/_modules/discord-assistant/_collections/dias.util.d.ts.map +1 -1
- package/build/_modules/discord-assistant/_collections/dias.util.js +5 -5
- package/build/_modules/discord-assistant/_collections/dias.util.js.map +1 -1
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts +9 -9
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts.map +1 -1
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.js +11 -10
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.js.map +1 -1
- package/build/_modules/discord-assistant/_services/dias-io.control-service.d.ts +2 -2
- package/build/_modules/discord-assistant/_services/dias-io.control-service.d.ts.map +1 -1
- package/build/_modules/discord-assistant/_services/dias-io.control-service.js +2 -2
- package/build/_modules/discord-assistant/_services/dias-io.control-service.js.map +1 -1
- package/build/_modules/discord-assistant/_services/dias.service-base.d.ts +2 -2
- package/build/_modules/discord-assistant/_services/dias.service-base.d.ts.map +1 -1
- package/build/_modules/discord-assistant/_services/dias.service-base.js +1 -1
- package/build/_modules/discord-assistant/_services/dias.service-base.js.map +1 -1
- package/build/_modules/discord-assistant/index.d.ts +2 -1
- package/build/_modules/discord-assistant/index.d.ts.map +1 -1
- package/build/_modules/discord-assistant/index.js +2 -1
- package/build/_modules/discord-assistant/index.js.map +1 -1
- package/build/_services/route/routing-module.service.d.ts.map +1 -1
- package/build/_services/route/routing-module.service.js +0 -70
- package/build/_services/route/routing-module.service.js.map +1 -1
- package/build/_services/route/routing-module.service.spec.js +1 -1
- package/build/_services/server/app.server.d.ts.map +1 -1
- package/build/_services/server/app.server.js +10 -1
- package/build/_services/server/app.server.js.map +1 -1
- package/package.json +32 -12
- package/src/_collections/star.controller.ts +130 -0
- package/src/_modules/ai/_models/ai-input-interfaces.ts +79 -0
- package/src/_modules/{open-ai/_collections/oai-chunking.util.ts → ai/_modules/document-ai/_collections/dai-chunking.util.ts} +139 -90
- package/src/_modules/ai/_modules/document-ai/_collections/dai-document.util.ts +85 -0
- package/src/_modules/ai/_modules/document-ai/_enums/dai-compare-result-type.enum.ts +8 -0
- package/src/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-chunk.data-model.ts +144 -0
- package/src/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-page.data-model.ts +136 -0
- package/src/_modules/ai/_modules/document-ai/_models/data-models/dai-document.data-model.ts +93 -0
- package/src/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-chunk-compare-result.interface.ts +18 -0
- package/src/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-page-compare-result.interface.ts +19 -0
- package/src/_modules/ai/_modules/document-ai/_models/interfaces/dai-document-compare-result.interface.ts +25 -0
- package/src/_modules/ai/_modules/document-ai/index.ts +28 -0
- package/src/_modules/{open-ai → ai/_modules/open-ai}/_collections/oai-global-settings.const.ts +2 -2
- package/src/_modules/ai/_modules/open-ai/_models/interfaces/oai-global-settings.interface.ts +8 -0
- package/src/_modules/ai/_modules/open-ai/_services/oai-doc-chunk-data.service.ts +284 -0
- package/src/_modules/ai/_modules/open-ai/_services/oai-doc-page.data-service.ts +508 -0
- package/src/_modules/ai/_modules/open-ai/_services/oai-document.data-service.ts +377 -0
- package/src/_modules/{open-ai → ai/_modules/open-ai}/_services/oai-embedding.control-service.ts +6 -6
- package/src/_modules/{open-ai → ai/_modules/open-ai}/_services/oai-llm-chat.service-base.ts +20 -19
- package/src/_modules/{open-ai → ai/_modules/open-ai}/_services/oai-llm.service-base.ts +24 -24
- package/src/_modules/{open-ai → ai/_modules/open-ai}/_services/oai-vector-data.service.ts +145 -9
- package/src/_modules/ai/_modules/open-ai/index.ts +72 -0
- package/src/_modules/ai/_services/ai-embedding.service-base.ts +41 -0
- package/src/_modules/ai/_services/ai-llm-chat.service-base.ts +48 -0
- package/src/_modules/ai/_services/ai-llm.service-base.ts +81 -0
- package/src/_modules/ai/_services/ai-provider.service-base.ts +28 -0
- package/src/_modules/ai/index.ts +11 -0
- package/src/_modules/discord-assistant/_collections/dias-global-settings.const.ts +2 -2
- package/src/_modules/discord-assistant/_collections/dias.util.ts +5 -3
- package/src/_modules/discord-assistant/_services/dias-chunk.data-service.ts +25 -18
- package/src/_modules/discord-assistant/_services/dias-io.control-service.ts +5 -3
- package/src/_modules/discord-assistant/_services/dias.service-base.ts +3 -3
- package/src/_modules/discord-assistant/index.ts +2 -1
- package/src/_services/route/routing-module.service.spec.ts +1 -1
- package/src/_services/route/routing-module.service.ts +0 -98
- package/src/_services/server/app.server.ts +13 -2
- package/src/index.ts +0 -4
- package/build/_modules/open-ai/_collections/oai-chunking.util.d.ts.map +0 -1
- package/build/_modules/open-ai/_collections/oai-chunking.util.js.map +0 -1
- package/build/_modules/open-ai/_collections/oai-document.util.d.ts +0 -4
- package/build/_modules/open-ai/_collections/oai-document.util.d.ts.map +0 -1
- package/build/_modules/open-ai/_collections/oai-document.util.js +0 -12
- package/build/_modules/open-ai/_collections/oai-document.util.js.map +0 -1
- package/build/_modules/open-ai/_collections/oai-global-settings.const.d.ts.map +0 -1
- package/build/_modules/open-ai/_collections/oai-global-settings.const.js.map +0 -1
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.d.ts.map +0 -1
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.js.map +0 -1
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.d.ts.map +0 -1
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.js.map +0 -1
- package/build/_modules/open-ai/_enums/oai-compare-result-type.enum.d.ts +0 -6
- package/build/_modules/open-ai/_enums/oai-compare-result-type.enum.d.ts.map +0 -1
- package/build/_modules/open-ai/_enums/oai-compare-result-type.enum.js +0 -10
- package/build/_modules/open-ai/_enums/oai-compare-result-type.enum.js.map +0 -1
- package/build/_modules/open-ai/_enums/oai-gpt-message-role.enum.d.ts.map +0 -1
- package/build/_modules/open-ai/_enums/oai-gpt-message-role.enum.js.map +0 -1
- package/build/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.d.ts +0 -7
- package/build/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.d.ts.map +0 -1
- package/build/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.js.map +0 -1
- package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.d.ts +0 -15
- package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.d.ts.map +0 -1
- package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.js.map +0 -1
- package/build/_modules/open-ai/_models/interfaces/oai-global-settings.interface.d.ts +0 -6
- package/build/_modules/open-ai/_models/interfaces/oai-global-settings.interface.d.ts.map +0 -1
- package/build/_modules/open-ai/_models/interfaces/oai-global-settings.interface.js.map +0 -1
- package/build/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.d.ts.map +0 -1
- package/build/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.js.map +0 -1
- package/build/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.d.ts.map +0 -1
- package/build/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.js.map +0 -1
- package/build/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.d.ts +0 -13
- package/build/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.d.ts.map +0 -1
- package/build/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.js +0 -3
- package/build/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.js.map +0 -1
- package/build/_modules/open-ai/_models/oai-doc-chunk.data-model.d.ts.map +0 -1
- package/build/_modules/open-ai/_models/oai-doc-chunk.data-model.js +0 -101
- package/build/_modules/open-ai/_models/oai-doc-chunk.data-model.js.map +0 -1
- package/build/_modules/open-ai/_services/oai-chunk.service-base.d.ts +0 -16
- package/build/_modules/open-ai/_services/oai-chunk.service-base.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/oai-chunk.service-base.js +0 -200
- package/build/_modules/open-ai/_services/oai-chunk.service-base.js.map +0 -1
- package/build/_modules/open-ai/_services/oai-embedding.control-service.d.ts +0 -7
- package/build/_modules/open-ai/_services/oai-embedding.control-service.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/oai-embedding.control-service.js.map +0 -1
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js.map +0 -1
- package/build/_modules/open-ai/_services/oai-llm.service-base.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/oai-llm.service-base.js.map +0 -1
- package/build/_modules/open-ai/_services/oai-vector-data.service.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/oai-vector-data.service.js.map +0 -1
- package/build/_modules/open-ai/index.d.ts.map +0 -1
- package/build/_modules/open-ai/index.js.map +0 -1
- package/src/_modules/open-ai/_collections/oai-document.util.ts +0 -10
- package/src/_modules/open-ai/_enums/oai-compare-result-type.enum.ts +0 -7
- package/src/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.ts +0 -15
- package/src/_modules/open-ai/_models/interfaces/oai-document-page.interface.ts +0 -28
- package/src/_modules/open-ai/_models/interfaces/oai-global-settings.interface.ts +0 -8
- package/src/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.ts +0 -17
- package/src/_modules/open-ai/_models/oai-doc-chunk.data-model.ts +0 -115
- package/src/_modules/open-ai/_services/oai-chunk.service-base.ts +0 -280
- package/src/_modules/open-ai/index.ts +0 -55
- /package/build/_modules/{open-ai → ai/_modules/open-ai}/_collections/oai-global-settings.const.d.ts +0 -0
- /package/build/_modules/{open-ai → ai/_modules/open-ai}/_collections/oai-llm-predefined-requests-hu.conts.d.ts +0 -0
- /package/build/_modules/{open-ai → ai/_modules/open-ai}/_collections/oai-llm-predefined-requests-hu.conts.js +0 -0
- /package/build/_modules/{open-ai → ai/_modules/open-ai}/_collections/oai-llm-predefined-requests.conts.d.ts +0 -0
- /package/build/_modules/{open-ai → ai/_modules/open-ai}/_collections/oai-llm-predefined-requests.conts.js +0 -0
- /package/build/_modules/{open-ai → ai/_modules/open-ai}/_enums/oai-gpt-message-role.enum.d.ts +0 -0
- /package/build/_modules/{open-ai → ai/_modules/open-ai}/_enums/oai-gpt-message-role.enum.js +0 -0
- /package/build/_modules/{open-ai → ai/_modules/open-ai}/_models/interfaces/oai-global-settings.interface.js +0 -0
- /package/build/_modules/{open-ai → ai/_modules/open-ai}/_models/interfaces/oai-gpt-message.interface.d.ts +0 -0
- /package/build/_modules/{open-ai → ai/_modules/open-ai}/_models/interfaces/oai-gpt-message.interface.js +0 -0
- /package/build/_modules/{open-ai → ai/_modules/open-ai}/_models/interfaces/oai-llm-predefined-requests.interface.d.ts +0 -0
- /package/build/_modules/{open-ai → ai/_modules/open-ai}/_models/interfaces/oai-llm-predefined-requests.interface.js +0 -0
- /package/src/_modules/{open-ai → ai/_modules/open-ai}/_collections/oai-llm-predefined-requests-hu.conts.ts +0 -0
- /package/src/_modules/{open-ai → ai/_modules/open-ai}/_collections/oai-llm-predefined-requests.conts.ts +0 -0
- /package/src/_modules/{open-ai → ai/_modules/open-ai}/_enums/oai-gpt-message-role.enum.ts +0 -0
- /package/src/_modules/{open-ai → ai/_modules/open-ai}/_models/interfaces/oai-gpt-message.interface.ts +0 -0
- /package/src/_modules/{open-ai → ai/_modules/open-ai}/_models/interfaces/oai-llm-predefined-requests.interface.ts +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OpenAI } from 'openai';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { DyFM_OAI_Settings, DyFM_OAI_Model, DyFM_OAI_CallSettings } from '@futdevpro/fsm-dynamo/ai/open-ai';
|
|
4
4
|
import { DyFM_AnyError, DyFM_Error, DyFM_Error_Settings, DyFM_Log, DyFM_notNull, DyFM_Object } from '@futdevpro/fsm-dynamo';
|
|
5
5
|
|
|
6
|
-
import { DyNTS_global_settings } from '
|
|
6
|
+
import { DyNTS_global_settings } from '../../../../../_collections/global-settings.const';
|
|
7
7
|
import { DyNTS_OAI_GPT_Message } from '../_models/interfaces/oai-gpt-message.interface';
|
|
8
8
|
import { ChatCompletion } from 'openai/resources';
|
|
9
9
|
import { ChatCompletionCreateParamsBase, ChatCompletionMessageParam } from 'openai/resources/chat/completions';
|
|
@@ -32,8 +32,8 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
32
32
|
readonly openai: OpenAI;
|
|
33
33
|
|
|
34
34
|
/* readonly defaultSystemPrompt: string;
|
|
35
|
-
readonly defaultModel:
|
|
36
|
-
readonly defaultSettings:
|
|
35
|
+
readonly defaultModel: DyFM_OAI_Model | string; */
|
|
36
|
+
readonly defaultSettings: DyFM_OAI_CallSettings;
|
|
37
37
|
|
|
38
38
|
get debugLog(): boolean {
|
|
39
39
|
return this.defaultSettings.debugLog;
|
|
@@ -43,7 +43,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
43
43
|
return this.defaultSettings.systemPrompt;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
get defaultModel():
|
|
46
|
+
get defaultModel(): DyFM_OAI_Model | string {
|
|
47
47
|
return this.defaultSettings.useModel;
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -51,12 +51,12 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
51
51
|
DyNTS_OAI_LLMDefaultPredefined_Requests;
|
|
52
52
|
|
|
53
53
|
constructor(
|
|
54
|
-
set?:
|
|
54
|
+
set?: DyFM_OAI_Settings
|
|
55
55
|
) {
|
|
56
56
|
DyNTS_global_settings.openAi_settings ??= DyNTS_OAI_global_settings;
|
|
57
57
|
|
|
58
58
|
this.openai = new OpenAI(
|
|
59
|
-
set?.
|
|
59
|
+
set?.config ??
|
|
60
60
|
{
|
|
61
61
|
organization: DyNTS_global_settings.env_settings.openAi.organization,
|
|
62
62
|
apiKey: DyNTS_global_settings.env_settings.openAi.apiKey,
|
|
@@ -66,7 +66,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
66
66
|
|
|
67
67
|
this.defaultSettings = set?.defaultSettings ??
|
|
68
68
|
DyNTS_OAI_global_settings.defaultSettings ??
|
|
69
|
-
new
|
|
69
|
+
new DyFM_OAI_CallSettings();
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
readonly defaultLogReplacer: string = '...long-context...';
|
|
@@ -83,7 +83,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
83
83
|
set: {
|
|
84
84
|
question: string,
|
|
85
85
|
issuer: string,
|
|
86
|
-
settings?:
|
|
86
|
+
settings?: DyFM_OAI_CallSettings,
|
|
87
87
|
debugLog?: boolean,
|
|
88
88
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
89
89
|
replaceThisInLog?: string
|
|
@@ -107,7 +107,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
107
107
|
set: {
|
|
108
108
|
question: string,
|
|
109
109
|
issuer: string,
|
|
110
|
-
settings?:
|
|
110
|
+
settings?: DyFM_OAI_CallSettings,
|
|
111
111
|
debugLog?: boolean,
|
|
112
112
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
113
113
|
replaceThisInLog?: string,
|
|
@@ -141,7 +141,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
141
141
|
question: string,
|
|
142
142
|
selectFrom: string[],
|
|
143
143
|
issuer: string,
|
|
144
|
-
settings?:
|
|
144
|
+
settings?: DyFM_OAI_CallSettings,
|
|
145
145
|
debugLog?: boolean,
|
|
146
146
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
147
147
|
replaceThisInLog?: string,
|
|
@@ -179,7 +179,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
179
179
|
question: string,
|
|
180
180
|
selectFrom: T[],
|
|
181
181
|
issuer: string,
|
|
182
|
-
settings?:
|
|
182
|
+
settings?: DyFM_OAI_CallSettings,
|
|
183
183
|
debugLog?: boolean,
|
|
184
184
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
185
185
|
replaceThisInLog?: string,
|
|
@@ -208,7 +208,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
208
208
|
question: string,
|
|
209
209
|
options: string[],
|
|
210
210
|
issuer: string,
|
|
211
|
-
settings?:
|
|
211
|
+
settings?: DyFM_OAI_CallSettings,
|
|
212
212
|
debugLog?: boolean,
|
|
213
213
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
214
214
|
replaceThisInLog?: string,
|
|
@@ -249,7 +249,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
249
249
|
question: string,
|
|
250
250
|
options: T[],
|
|
251
251
|
issuer: string,
|
|
252
|
-
settings?:
|
|
252
|
+
settings?: DyFM_OAI_CallSettings,
|
|
253
253
|
debugLog?: boolean,
|
|
254
254
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
255
255
|
replaceThisInLog?: string,
|
|
@@ -281,7 +281,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
281
281
|
set: {
|
|
282
282
|
question: string,
|
|
283
283
|
issuer: string,
|
|
284
|
-
settings?:
|
|
284
|
+
settings?: DyFM_OAI_CallSettings,
|
|
285
285
|
debugLog?: boolean,
|
|
286
286
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
287
287
|
replaceThisInLog?: string,
|
|
@@ -310,7 +310,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
310
310
|
question: string,
|
|
311
311
|
keysDescription: string,
|
|
312
312
|
issuer: string,
|
|
313
|
-
settings?:
|
|
313
|
+
settings?: DyFM_OAI_CallSettings,
|
|
314
314
|
debugLog?: boolean,
|
|
315
315
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
316
316
|
replaceThisInLog?: string,
|
|
@@ -343,7 +343,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
343
343
|
question: string,
|
|
344
344
|
keys: string[],
|
|
345
345
|
issuer: string,
|
|
346
|
-
settings?:
|
|
346
|
+
settings?: DyFM_OAI_CallSettings,
|
|
347
347
|
debugLog?: boolean,
|
|
348
348
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
349
349
|
replaceThisInLog?: string,
|
|
@@ -375,7 +375,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
375
375
|
set: {
|
|
376
376
|
question: string,
|
|
377
377
|
issuer: string,
|
|
378
|
-
settings?:
|
|
378
|
+
settings?: DyFM_OAI_CallSettings,
|
|
379
379
|
debugLog?: boolean,
|
|
380
380
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
381
381
|
replaceThisInLog?: string,
|
|
@@ -401,7 +401,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
401
401
|
set: {
|
|
402
402
|
question: string,
|
|
403
403
|
issuer: string,
|
|
404
|
-
settings?:
|
|
404
|
+
settings?: DyFM_OAI_CallSettings,
|
|
405
405
|
debugLog?: boolean,
|
|
406
406
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
407
407
|
replaceThisInLog?: string,
|
|
@@ -433,7 +433,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
433
433
|
// async askJSONListQuestion(
|
|
434
434
|
// question: string,
|
|
435
435
|
// issuer: string,
|
|
436
|
-
// settings?:
|
|
436
|
+
// settings?: DyFM_OAI_CallSettings,
|
|
437
437
|
// debugLog?: boolean,
|
|
438
438
|
// /** this is used to readably replace too long contents to eg '...' in logs */
|
|
439
439
|
// replaceThisInLog?: string,
|
|
@@ -454,7 +454,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
454
454
|
set: {
|
|
455
455
|
message: string,
|
|
456
456
|
issuer: string,
|
|
457
|
-
settings?:
|
|
457
|
+
settings?: DyFM_OAI_CallSettings
|
|
458
458
|
}
|
|
459
459
|
): Promise<string> {
|
|
460
460
|
return this.resolveMessage({
|
|
@@ -478,7 +478,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
478
478
|
set: {
|
|
479
479
|
conversation: DyNTS_OAI_GPT_Message[],
|
|
480
480
|
issuer: string,
|
|
481
|
-
settings?:
|
|
481
|
+
settings?: DyFM_OAI_CallSettings,
|
|
482
482
|
getFullResponse?: boolean
|
|
483
483
|
}
|
|
484
484
|
): Promise<string | ChatCompletion> {
|
|
@@ -547,7 +547,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
547
547
|
set: {
|
|
548
548
|
conversation: DyNTS_OAI_GPT_Message[],
|
|
549
549
|
issuer: string,
|
|
550
|
-
settings?:
|
|
550
|
+
settings?: DyFM_OAI_CallSettings
|
|
551
551
|
}
|
|
552
552
|
): ChatCompletionCreateParamsBase {
|
|
553
553
|
try {
|
|
@@ -591,7 +591,7 @@ export class DyNTS_OAI_LLM_ServiceBase {
|
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
593
|
|
|
594
|
-
protected getDefaultSystemMessage(settings:
|
|
594
|
+
protected getDefaultSystemMessage(settings: DyFM_OAI_CallSettings): DyNTS_OAI_GPT_Message {
|
|
595
595
|
return {
|
|
596
596
|
role: DyNTS_OAI_GPT_Message_Role.system,
|
|
597
597
|
content: settings?.systemPrompt || this.defaultSystemPrompt,
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
DyFM_Metadata,
|
|
9
9
|
DyFM_Object,
|
|
10
10
|
} from '@futdevpro/fsm-dynamo';
|
|
11
|
-
import {
|
|
11
|
+
import { DyFM_OAI_Settings, DyFM_OAI_EmbeddingModel, DyFM_OAI_Model } from '@futdevpro/fsm-dynamo/ai/open-ai';
|
|
12
12
|
|
|
13
|
-
import { DyNTS_global_settings } from '
|
|
14
|
-
import { DyNTS_DataService } from '
|
|
13
|
+
import { DyNTS_global_settings } from '../../../../../_collections/global-settings.const';
|
|
14
|
+
import { DyNTS_DataService } from '../../../../../_services/base/data.service';
|
|
15
15
|
import { DyNTS_OAI_Embedding_ControlService } from './oai-embedding.control-service';
|
|
16
16
|
import { DyNTS_OAI_global_settings } from '../_collections/oai-global-settings.const';
|
|
17
17
|
|
|
@@ -39,7 +39,7 @@ import { DyNTS_OAI_global_settings } from '../_collections/oai-global-settings.c
|
|
|
39
39
|
* constructor(
|
|
40
40
|
* set: {
|
|
41
41
|
* data?: UserMatchStatistics,
|
|
42
|
-
* openAISettings?:
|
|
42
|
+
* openAISettings?: DyFM_OAI_Settings,
|
|
43
43
|
* issuer: string,
|
|
44
44
|
* }
|
|
45
45
|
* ) {
|
|
@@ -79,7 +79,7 @@ export class DyNTS_OAI_VectorDataService<T extends DyFM_Metadata> extends DyNTS_
|
|
|
79
79
|
/**
|
|
80
80
|
* OpenAI settings
|
|
81
81
|
*/
|
|
82
|
-
public readonly openAISettings:
|
|
82
|
+
public readonly openAISettings: DyFM_OAI_Settings,
|
|
83
83
|
/**
|
|
84
84
|
* Initial set for issuer to be able to follow the issuer's activity
|
|
85
85
|
*/
|
|
@@ -106,7 +106,7 @@ export class DyNTS_OAI_VectorDataService<T extends DyFM_Metadata> extends DyNTS_
|
|
|
106
106
|
(dataParams.properties[key] as DyFM_DataProperty_Params<any>).vectorizedFrom !== key
|
|
107
107
|
); */
|
|
108
108
|
|
|
109
|
-
if (!openAISettings.
|
|
109
|
+
if (!openAISettings.config.apiKey) {
|
|
110
110
|
throw new DyFM_Error({
|
|
111
111
|
...this.getDefaultErrorSettings(
|
|
112
112
|
'constructor',
|
|
@@ -115,8 +115,8 @@ export class DyNTS_OAI_VectorDataService<T extends DyFM_Metadata> extends DyNTS_
|
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
const model:
|
|
119
|
-
|
|
118
|
+
const model: DyFM_OAI_EmbeddingModel = openAISettings.defaultSettings.useModel as DyFM_OAI_EmbeddingModel ??
|
|
119
|
+
DyFM_OAI_Model.textEmbedding_3Large;
|
|
120
120
|
|
|
121
121
|
/* if (
|
|
122
122
|
!DyFM_allOpenAIEmbeddingModels.includes(model)
|
|
@@ -294,7 +294,7 @@ export class DyNTS_OAI_VectorDataService<T extends DyFM_Metadata> extends DyNTS_
|
|
|
294
294
|
*/
|
|
295
295
|
async vectorize(
|
|
296
296
|
input: string,
|
|
297
|
-
useModel:
|
|
297
|
+
useModel: DyFM_OAI_Model | string = this.openAISettings.defaultSettings.useModel
|
|
298
298
|
): Promise<number[]> {
|
|
299
299
|
try {
|
|
300
300
|
if (!input) {
|
|
@@ -469,3 +469,139 @@ export class DyNTS_OAI_VectorDataService<T extends DyFM_Metadata> extends DyNTS_
|
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
//import {
|
|
477
|
+
// DyFM_DataModel_Params,
|
|
478
|
+
// DyFM_DataProperty_Params,
|
|
479
|
+
// DyFM_Metadata,
|
|
480
|
+
//} from '@futdevpro/fsm-dynamo';
|
|
481
|
+
//import { DyFM_OAI_Settings, DyFM_OAI_EmbeddingModel, DyFM_OAI_Model } from '@futdevpro/fsm-dynamo/open-ai';
|
|
482
|
+
//
|
|
483
|
+
//import { DyNTS_DAI_VectorDataService } from '../../_modules/document-ai/_services/dai-vector-data.service-base';
|
|
484
|
+
//import { DyNTS_OAI_Embedding_Service } from './oai-embedding.service';
|
|
485
|
+
//import { DyNTS_global_settings } from '../../../../_collections/global-settings.const';
|
|
486
|
+
//import { DyNTS_OAI_global_settings } from '../_collections/oai-global-settings.const';
|
|
487
|
+
//
|
|
488
|
+
///**
|
|
489
|
+
// * OpenAI implementation of the generic Vector Data Service
|
|
490
|
+
// * Extends the generic DAI VectorDataService with OpenAI-specific functionality
|
|
491
|
+
// */
|
|
492
|
+
//export class DyNTS_OAI_VectorDataService<T extends DyFM_Metadata> extends DyNTS_DAI_VectorDataService<T> {
|
|
493
|
+
//
|
|
494
|
+
// debugLog: boolean = true;
|
|
495
|
+
// swallowVectorizedProperties: boolean = true;
|
|
496
|
+
//
|
|
497
|
+
// constructor(
|
|
498
|
+
// /** Initial data */
|
|
499
|
+
// data: T,
|
|
500
|
+
// /** DB data params */
|
|
501
|
+
// dataParams: DyFM_DataModel_Params<T>,
|
|
502
|
+
// /** OpenAI settings */
|
|
503
|
+
// public readonly openAISettings: DyFM_OAI_Settings,
|
|
504
|
+
// /** Issuer */
|
|
505
|
+
// issuer: string
|
|
506
|
+
// ) {
|
|
507
|
+
// // Create OpenAI embedding service
|
|
508
|
+
// const embeddingService = new DyNTS_OAI_Embedding_Service(openAISettings);
|
|
509
|
+
//
|
|
510
|
+
// super(data, dataParams, embeddingService, issuer);
|
|
511
|
+
//
|
|
512
|
+
// if (!openAISettings.openAIConfig.apiKey) {
|
|
513
|
+
// throw new Error('openAIConfig.apiKey is required');
|
|
514
|
+
// }
|
|
515
|
+
//
|
|
516
|
+
// const model: DyFM_OAI_EmbeddingModel = openAISettings.defaultSettings.useModel as DyFM_OAI_EmbeddingModel ??
|
|
517
|
+
// DyFM_OAI_Model.textEmbedding_3Large;
|
|
518
|
+
//
|
|
519
|
+
// // Configure vectorized properties with OpenAI-specific settings
|
|
520
|
+
// this.configureVectorizedProperties(model);
|
|
521
|
+
// }
|
|
522
|
+
//
|
|
523
|
+
// /**
|
|
524
|
+
// * Configure vectorized properties with OpenAI-specific settings
|
|
525
|
+
// */
|
|
526
|
+
// private configureVectorizedProperties(model: DyFM_OAI_EmbeddingModel): void {
|
|
527
|
+
// // Update vectorized properties with OpenAI model info
|
|
528
|
+
// this.vectorizedProperties.forEach(property => {
|
|
529
|
+
// if (property.vectorizedFrom) {
|
|
530
|
+
// // Set the embedding model for this property
|
|
531
|
+
// (property as any).embeddingModel = model;
|
|
532
|
+
// }
|
|
533
|
+
// });
|
|
534
|
+
// }
|
|
535
|
+
//
|
|
536
|
+
// /**
|
|
537
|
+
// * Perform vector search with OpenAI-specific implementation
|
|
538
|
+
// */
|
|
539
|
+
// protected override async performVectorSearch(
|
|
540
|
+
// query: string,
|
|
541
|
+
// model: string,
|
|
542
|
+
// issuer: string,
|
|
543
|
+
// options: any
|
|
544
|
+
// ): Promise<T[]> {
|
|
545
|
+
// try {
|
|
546
|
+
// // Create embedding for the query
|
|
547
|
+
// const queryEmbedding = await this.embeddingService.createEmbedding(query, model, issuer);
|
|
548
|
+
//
|
|
549
|
+
// // Get all data
|
|
550
|
+
// const allData = await this.getAllData();
|
|
551
|
+
//
|
|
552
|
+
// // Calculate similarities (simplified implementation)
|
|
553
|
+
// const results = allData.map(item => {
|
|
554
|
+
// const itemEmbedding = (item as any).chunkParentedContentVectorized;
|
|
555
|
+
// if (!itemEmbedding) return { item, similarity: 0 };
|
|
556
|
+
//
|
|
557
|
+
// const similarity = this.calculateCosineSimilarity(queryEmbedding, itemEmbedding);
|
|
558
|
+
// return { item, similarity };
|
|
559
|
+
// })
|
|
560
|
+
// .filter(result => result.similarity >= (options.minSimilarity || 0))
|
|
561
|
+
// .sort((a, b) => b.similarity - a.similarity)
|
|
562
|
+
// .slice(0, options.limit || 10)
|
|
563
|
+
// .map(result => result.item);
|
|
564
|
+
//
|
|
565
|
+
// return results;
|
|
566
|
+
// } catch (error) {
|
|
567
|
+
// throw new Error(`Vector search failed: ${error.message}`);
|
|
568
|
+
// }
|
|
569
|
+
// }
|
|
570
|
+
//
|
|
571
|
+
// /**
|
|
572
|
+
// * Calculate cosine similarity between two vectors
|
|
573
|
+
// */
|
|
574
|
+
// private calculateCosineSimilarity(vecA: number[], vecB: number[]): number {
|
|
575
|
+
// if (vecA.length !== vecB.length) return 0;
|
|
576
|
+
//
|
|
577
|
+
// let dotProduct = 0;
|
|
578
|
+
// let normA = 0;
|
|
579
|
+
// let normB = 0;
|
|
580
|
+
//
|
|
581
|
+
// for (let i = 0; i < vecA.length; i++) {
|
|
582
|
+
// dotProduct += vecA[i] * vecB[i];
|
|
583
|
+
// normA += vecA[i] * vecA[i];
|
|
584
|
+
// normB += vecB[i] * vecB[i];
|
|
585
|
+
// }
|
|
586
|
+
//
|
|
587
|
+
// if (normA === 0 || normB === 0) return 0;
|
|
588
|
+
//
|
|
589
|
+
// return dotProduct / (Math.sqrt(normA) * Math.sqrt(normB));
|
|
590
|
+
// }
|
|
591
|
+
//
|
|
592
|
+
// /**
|
|
593
|
+
// * Get default error settings
|
|
594
|
+
// */
|
|
595
|
+
// protected getDefaultErrorSettings(
|
|
596
|
+
// method: string,
|
|
597
|
+
// error: any,
|
|
598
|
+
// issuer?: string
|
|
599
|
+
// ): any {
|
|
600
|
+
// return {
|
|
601
|
+
// method,
|
|
602
|
+
// error,
|
|
603
|
+
// issuer: issuer || this.issuer,
|
|
604
|
+
// userMsg: this.defaultErrorUserMsg,
|
|
605
|
+
// };
|
|
606
|
+
// }
|
|
607
|
+
//}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/* try {
|
|
10
|
+
require.resolve('open-ai');
|
|
11
|
+
} catch {
|
|
12
|
+
console.log(
|
|
13
|
+
'❌ OpenAI package not found, please install it with: pnpm add open-ai'
|
|
14
|
+
);
|
|
15
|
+
} */
|
|
16
|
+
|
|
17
|
+
//
|
|
18
|
+
// OpenAI module
|
|
19
|
+
//
|
|
20
|
+
// This module is created to simplify the usage of OpenAI API
|
|
21
|
+
// It creates universal solutions for the most common use cases
|
|
22
|
+
//
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
// Re-export from FSM
|
|
26
|
+
export * from '@futdevpro/fsm-dynamo/ai/open-ai';
|
|
27
|
+
|
|
28
|
+
// Re-export from document-ai
|
|
29
|
+
/* export * from '../../_modules/document-ai'; */
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// COLLECTIONS
|
|
33
|
+
/* export * from './_collections/oai-chunking.util';
|
|
34
|
+
export * from './_collections/oai-document.util'; */
|
|
35
|
+
export * from './_collections/oai-global-settings.const';
|
|
36
|
+
export * from './_collections/oai-llm-predefined-requests.conts';
|
|
37
|
+
export * from './_collections/oai-llm-predefined-requests-hu.conts';
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
// ENUMS
|
|
41
|
+
//export * from './_enums/oai-compare-result-type.enum';
|
|
42
|
+
export * from './_enums/oai-gpt-message-role.enum';
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
// MODELS
|
|
46
|
+
/* export * from '../document-ai/_models/oai-doc-chunk.data-model'; */
|
|
47
|
+
|
|
48
|
+
// models/INTERFACES
|
|
49
|
+
/* export * from '../document-ai/_models/interfaces/dai-doc-chunk-compare-result.interface';
|
|
50
|
+
export * from '../document-ai/_models/interfaces/dai-doc-page-compare-result.interface'; */
|
|
51
|
+
/* export * from '../document-ai/_models/interfaces/oai-document-page.interface'; */
|
|
52
|
+
export * from './_models/interfaces/oai-global-settings.interface';
|
|
53
|
+
export * from './_models/interfaces/oai-gpt-message.interface';
|
|
54
|
+
export * from './_models/interfaces/oai-llm-predefined-requests.interface';
|
|
55
|
+
/* export * from '../document-ai/_models/interfaces/dai-doc-page-compare-result.interface'; */
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// SERVICES - New implementations
|
|
59
|
+
/* export * from './_services/oai-llm.service';
|
|
60
|
+
export * from './_services/oai-llm-chat.service';
|
|
61
|
+
export * from './_services/oai-embedding.service'; */
|
|
62
|
+
/* export * from './_services/oai-doc-chunk.service'; */
|
|
63
|
+
|
|
64
|
+
// Legacy (for backward compatibility)
|
|
65
|
+
export * from './_services/oai-doc-chunk-data.service';
|
|
66
|
+
export * from './_services/oai-doc-page.data-service';
|
|
67
|
+
export * from './_services/oai-document.data-service';
|
|
68
|
+
export * from './_services/oai-embedding.control-service';
|
|
69
|
+
export * from './_services/oai-llm-chat.service-base';
|
|
70
|
+
export * from './_services/oai-llm.service-base';
|
|
71
|
+
export * from './_services/oai-vector-data.service';
|
|
72
|
+
/* export * from './_services/oai-doc-chunk.service-base'; */
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DyNTS_AI_Provider_ServiceBase } from './ai-provider.service-base';
|
|
2
|
+
import { DyFM_DAI_EmbeddingInfo } from '@futdevpro/fsm-dynamo/ai/document-ai';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Abstract base class for embedding services
|
|
6
|
+
* Defines the interface for AI providers that support embeddings
|
|
7
|
+
*/
|
|
8
|
+
export abstract class DyNTS_AI_Embedding_ServiceBase extends DyNTS_AI_Provider_ServiceBase {
|
|
9
|
+
/**
|
|
10
|
+
* Create an embedding for a single text
|
|
11
|
+
* @param text - The text to embed
|
|
12
|
+
* @param model - The embedding model to use
|
|
13
|
+
* @param issuer - The issuer making the request
|
|
14
|
+
* @returns Promise<number[]> - The embedding vector
|
|
15
|
+
*/
|
|
16
|
+
abstract createEmbedding(
|
|
17
|
+
text: string,
|
|
18
|
+
model: string,
|
|
19
|
+
issuer: string
|
|
20
|
+
): Promise<number[]>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Create embeddings for multiple texts
|
|
24
|
+
* @param texts - Array of texts to embed
|
|
25
|
+
* @param model - The embedding model to use
|
|
26
|
+
* @param issuer - The issuer making the request
|
|
27
|
+
* @returns Promise<number[][]> - Array of embedding vectors
|
|
28
|
+
*/
|
|
29
|
+
abstract createEmbeddings(
|
|
30
|
+
texts: string[],
|
|
31
|
+
model: string,
|
|
32
|
+
issuer: string
|
|
33
|
+
): Promise<number[][]>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get embedding information for a model
|
|
37
|
+
* @param model - The model name
|
|
38
|
+
* @returns DyFM_DAI_EmbeddingInfo - Information about the model
|
|
39
|
+
*/
|
|
40
|
+
abstract getEmbeddingInfo(model: string): DyFM_DAI_EmbeddingInfo;
|
|
41
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { DyNTS_AI_LLM_ServiceBase } from './ai-llm.service-base';
|
|
2
|
+
import { DyFM_AI_Message } from '@futdevpro/fsm-dynamo/ai';
|
|
3
|
+
import {
|
|
4
|
+
DyFM_AI_ConversationQuestion_Input,
|
|
5
|
+
DyFM_AI_ConversationSelect_Input,
|
|
6
|
+
DyFM_AI_ConversationGenericSelect_Input,
|
|
7
|
+
DyFM_AI_ConversationMultiSelect_Input,
|
|
8
|
+
DyFM_AI_ConversationGenericMultiSelect_Input,
|
|
9
|
+
DyFM_AI_ConversationJSONKeysDescription_Input,
|
|
10
|
+
DyFM_AI_ConversationJSONExactKeys_Input,
|
|
11
|
+
DyFM_AI_ConversationGetAnswer_Input
|
|
12
|
+
} from '../_models/ai-input-interfaces';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Abstract base class for LLM Chat services
|
|
16
|
+
* Extends LLM service with conversation management capabilities
|
|
17
|
+
*/
|
|
18
|
+
export abstract class DyNTS_AI_LLMChat_ServiceBase extends DyNTS_AI_LLM_ServiceBase {
|
|
19
|
+
// History management
|
|
20
|
+
/**
|
|
21
|
+
* Add a message to the conversation history
|
|
22
|
+
*/
|
|
23
|
+
abstract addMessageToHistory(message: DyFM_AI_Message, issuer: string): void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Clear the conversation history for an issuer
|
|
27
|
+
*/
|
|
28
|
+
abstract clearHistory(issuer: string): void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get the conversation history for an issuer
|
|
32
|
+
*/
|
|
33
|
+
abstract getHistory(issuer: string): DyFM_AI_Message[];
|
|
34
|
+
|
|
35
|
+
// Conversation methods (from OAI_LLMChat_ServiceBase)
|
|
36
|
+
abstract yesNoQuestionInConversation(set: DyFM_AI_ConversationQuestion_Input): Promise<boolean>;
|
|
37
|
+
abstract simpleQuestionInConversation(set: DyFM_AI_ConversationQuestion_Input): Promise<string>;
|
|
38
|
+
abstract percentageQuestionInConversation(set: DyFM_AI_ConversationQuestion_Input): Promise<number>;
|
|
39
|
+
abstract selectQuestionInConversation(set: DyFM_AI_ConversationSelect_Input): Promise<string>;
|
|
40
|
+
abstract requestSelectInConversation<T>(set: DyFM_AI_ConversationGenericSelect_Input<T>): Promise<T | { unparsableResult: string }>;
|
|
41
|
+
abstract multipleSelectQuestionInConversationWithOptions(set: DyFM_AI_ConversationMultiSelect_Input): Promise<string[]>;
|
|
42
|
+
abstract requestMultiselectInConversation<T>(set: DyFM_AI_ConversationGenericMultiSelect_Input<T>): Promise<T[]>;
|
|
43
|
+
abstract JSONQuestionInConversationWithKeysDescription(set: DyFM_AI_ConversationJSONKeysDescription_Input): Promise<object>;
|
|
44
|
+
abstract JSONQuestionInConversationWithExactKeys(set: DyFM_AI_ConversationJSONExactKeys_Input): Promise<object>;
|
|
45
|
+
abstract requestJSONInConversationWithExactKeys<T>(set: DyFM_AI_ConversationJSONExactKeys_Input): Promise<T>;
|
|
46
|
+
abstract getQuestionAnswerInConversation(set: DyFM_AI_ConversationQuestion_Input): Promise<string>;
|
|
47
|
+
abstract getAnswerInConversation(set: DyFM_AI_ConversationGetAnswer_Input): Promise<string>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { DyNTS_AI_Provider_ServiceBase } from './ai-provider.service-base';
|
|
2
|
+
import { DyFM_AI_CallSettings, DyFM_AI_Message, DyFM_AI_LLM_Response } from '@futdevpro/fsm-dynamo/ai';
|
|
3
|
+
import { DyFM_Error_Settings } from '@futdevpro/fsm-dynamo';
|
|
4
|
+
import {
|
|
5
|
+
DyFM_AI_Question_Input,
|
|
6
|
+
DyFM_AI_ListSelect_Input,
|
|
7
|
+
DyFM_AI_GenericSelect_Input,
|
|
8
|
+
DyFM_AI_MultiSelect_Input,
|
|
9
|
+
DyFM_AI_GenericMultiSelect_Input,
|
|
10
|
+
DyFM_AI_JSONKeysDescription_Input,
|
|
11
|
+
DyFM_AI_JSONExactKeys_Input,
|
|
12
|
+
DyFM_AI_SimpleMessage_Input
|
|
13
|
+
} from '../_models/ai-input-interfaces';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Abstract base class for LLM services
|
|
17
|
+
* Defines all methods that must be implemented by AI providers
|
|
18
|
+
*/
|
|
19
|
+
export abstract class DyNTS_AI_LLM_ServiceBase extends DyNTS_AI_Provider_ServiceBase {
|
|
20
|
+
/** Default settings for LLM calls */
|
|
21
|
+
abstract readonly defaultSettings: DyFM_AI_CallSettings;
|
|
22
|
+
|
|
23
|
+
/** Default model to use for LLM calls */
|
|
24
|
+
abstract readonly defaultModel: string;
|
|
25
|
+
|
|
26
|
+
/** Provider-specific predefined requests */
|
|
27
|
+
abstract readonly predefinedRequests: any;
|
|
28
|
+
|
|
29
|
+
// Core abstract methods
|
|
30
|
+
/**
|
|
31
|
+
* Call LLM with system and user messages
|
|
32
|
+
*/
|
|
33
|
+
abstract callLLM(
|
|
34
|
+
systemMessage: string,
|
|
35
|
+
userMessage: string,
|
|
36
|
+
settings?: DyFM_AI_CallSettings,
|
|
37
|
+
issuer?: string
|
|
38
|
+
): Promise<string>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Call LLM with message history
|
|
42
|
+
*/
|
|
43
|
+
abstract callLLMWithHistory(
|
|
44
|
+
messages: DyFM_AI_Message[],
|
|
45
|
+
settings?: DyFM_AI_CallSettings,
|
|
46
|
+
issuer?: string
|
|
47
|
+
): Promise<string>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Call LLM and return raw response
|
|
51
|
+
*/
|
|
52
|
+
abstract callLLMRaw(
|
|
53
|
+
messages: DyFM_AI_Message[],
|
|
54
|
+
settings?: DyFM_AI_CallSettings,
|
|
55
|
+
issuer?: string
|
|
56
|
+
): Promise<DyFM_AI_LLM_Response>;
|
|
57
|
+
|
|
58
|
+
// Question methods (from OAI_LLM_ServiceBase)
|
|
59
|
+
abstract askQuestion(set: DyFM_AI_Question_Input): Promise<string>;
|
|
60
|
+
abstract askYesNoQuestion(set: DyFM_AI_Question_Input): Promise<boolean>;
|
|
61
|
+
abstract askPercentageQuestion(set: DyFM_AI_Question_Input): Promise<number>;
|
|
62
|
+
abstract askSelectQuestion(set: DyFM_AI_ListSelect_Input): Promise<string>;
|
|
63
|
+
abstract requestSelect<T>(set: DyFM_AI_GenericSelect_Input<T>): Promise<T | { unparsableResult: string }>;
|
|
64
|
+
abstract askMultipleSelectQuestionWithOptions(set: DyFM_AI_MultiSelect_Input): Promise<string[]>;
|
|
65
|
+
abstract requestMultiselect<T>(set: DyFM_AI_GenericMultiSelect_Input<T>): Promise<T[]>;
|
|
66
|
+
abstract askJSONQuestionWithKeysDescription(set: DyFM_AI_JSONKeysDescription_Input): Promise<object>;
|
|
67
|
+
abstract askJSONQuestionWithExactKeys(set: DyFM_AI_JSONExactKeys_Input): Promise<object>;
|
|
68
|
+
abstract requestJSONWithExactKeys<T>(set: DyFM_AI_JSONExactKeys_Input): Promise<T>;
|
|
69
|
+
abstract sendMessage(set: DyFM_AI_SimpleMessage_Input): Promise<string>;
|
|
70
|
+
|
|
71
|
+
// Helper methods
|
|
72
|
+
protected abstract getDefaultErrorSettings(
|
|
73
|
+
method: string,
|
|
74
|
+
error: any,
|
|
75
|
+
issuer?: string
|
|
76
|
+
): DyFM_Error_Settings;
|
|
77
|
+
|
|
78
|
+
protected abstract getTextListAsText(list: string[]): string;
|
|
79
|
+
|
|
80
|
+
protected abstract logQuestion(set: any): void;
|
|
81
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DyFM_AI_Provider } from '@futdevpro/fsm-dynamo/ai';
|
|
2
|
+
import { DyFM_AI_ProviderCapabilities } from '@futdevpro/fsm-dynamo/ai';
|
|
3
|
+
import { DyFM_AI_Config } from '@futdevpro/fsm-dynamo/ai';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Abstract base class for all AI providers
|
|
7
|
+
* Defines the common interface that all AI providers must implement
|
|
8
|
+
*/
|
|
9
|
+
export abstract class DyNTS_AI_Provider_ServiceBase {
|
|
10
|
+
/** The AI provider this service represents */
|
|
11
|
+
abstract readonly provider: DyFM_AI_Provider;
|
|
12
|
+
|
|
13
|
+
/** The capabilities supported by this provider */
|
|
14
|
+
abstract readonly capabilities: DyFM_AI_ProviderCapabilities;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Initialize the provider with configuration
|
|
18
|
+
* @param config - Provider-specific configuration
|
|
19
|
+
*/
|
|
20
|
+
abstract initialize(config: DyFM_AI_Config): void;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Test the connection to the AI provider
|
|
24
|
+
* @param issuer - The issuer making the request
|
|
25
|
+
* @returns Promise<boolean> - True if connection is successful
|
|
26
|
+
*/
|
|
27
|
+
abstract testConnection(issuer: string): Promise<boolean>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Re-export from FSM
|
|
2
|
+
export * from '@futdevpro/fsm-dynamo/ai';
|
|
3
|
+
|
|
4
|
+
// AI Input Interfaces (moved from FSM)
|
|
5
|
+
export * from './_models/ai-input-interfaces';
|
|
6
|
+
|
|
7
|
+
// Abstract Services
|
|
8
|
+
export * from './_services/ai-provider.service-base';
|
|
9
|
+
export * from './_services/ai-llm.service-base';
|
|
10
|
+
export * from './_services/ai-llm-chat.service-base';
|
|
11
|
+
export * from './_services/ai-embedding.service-base';
|