@futdevpro/nts-dynamo 1.12.15 → 1.14.2
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/_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/package.json +32 -12
- 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/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
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { DyFM_Array, DyFM_DataModel_Params, DyFM_DBFilter, DyFM_DBFilterExpressions, DyFM_DBFilterSimple, DyFM_Error, DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
2
|
+
import { DyNTS_DataService } from '../../../../../_services/base/data.service';
|
|
3
|
+
import { DyNTS_DAI_DocChunk } from '../../document-ai/_models/data-models/dai-doc-chunk.data-model';
|
|
4
|
+
import { DyNTS_DAI_DocPage } from '../../document-ai/_models/data-models/dai-doc-page.data-model';
|
|
5
|
+
import { DyNTS_DAI_Document, DyNTS_DAI_document_dataParams } from '../../document-ai/_models/data-models/dai-document.data-model';
|
|
6
|
+
import { DyNTS_OAI_DocChunkDataService } from './oai-doc-chunk-data.service';
|
|
7
|
+
import { DyNTS_OAI_DocPageDataService } from './oai-doc-page.data-service';
|
|
8
|
+
import { DyFM_OAI_Settings } from '@futdevpro/fsm-dynamo/ai/open-ai';
|
|
9
|
+
import { DyNTS_DAI_DocumentCompareResult } from '../../document-ai/_models/interfaces/dai-document-compare-result.interface';
|
|
10
|
+
import { DyNTS_DAI_DocPageCompareResult } from '../../document-ai/_models/interfaces/dai-doc-page-compare-result.interface';
|
|
11
|
+
import { DyNTS_DAI_CompareResult_Type } from '../../document-ai/_enums/dai-compare-result-type.enum';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export class DyNTS_OAI_DocumentDataService<
|
|
15
|
+
T_Chunk extends DyNTS_DAI_DocChunk = DyNTS_DAI_DocChunk,
|
|
16
|
+
T_Page extends DyNTS_DAI_DocPage<T_Chunk> = DyNTS_DAI_DocPage<T_Chunk>,
|
|
17
|
+
T_ExternalDocumentId = string,
|
|
18
|
+
T_ExternalMetadata = any,
|
|
19
|
+
T_Document extends DyNTS_DAI_Document<T_Chunk, T_Page, T_ExternalDocumentId, T_ExternalMetadata> = DyNTS_DAI_Document<T_Chunk, T_Page, T_ExternalDocumentId, T_ExternalMetadata>,
|
|
20
|
+
> extends DyNTS_DataService<T_Document> {
|
|
21
|
+
|
|
22
|
+
debugLog: boolean = true;
|
|
23
|
+
absoluteDeletesOnProcess: boolean = true;
|
|
24
|
+
|
|
25
|
+
constructor(
|
|
26
|
+
issuer: string,
|
|
27
|
+
private docChunkDataServiceOpenAiSettings: DyFM_OAI_Settings,
|
|
28
|
+
data?: T_Document,
|
|
29
|
+
dataParams: DyFM_DataModel_Params<T_Document> = DyNTS_DAI_document_dataParams as DyFM_DataModel_Params<T_Document>,
|
|
30
|
+
) {
|
|
31
|
+
super(
|
|
32
|
+
data,
|
|
33
|
+
dataParams,
|
|
34
|
+
issuer,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getDocPageDataService(): DyNTS_OAI_DocPageDataService<T_Chunk, T_Page, T_ExternalDocumentId, T_Document> {
|
|
39
|
+
return new DyNTS_OAI_DocPageDataService<T_Chunk, T_Page, T_ExternalDocumentId, T_Document>(
|
|
40
|
+
this.issuer,
|
|
41
|
+
this.docChunkDataServiceOpenAiSettings,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
getDocChunkDataService(): DyNTS_OAI_DocChunkDataService<T_Chunk, T_Page, T_ExternalDocumentId, T_Document> {
|
|
46
|
+
return new DyNTS_OAI_DocChunkDataService<T_Chunk, T_Page, T_ExternalDocumentId, T_Document>(
|
|
47
|
+
this.issuer,
|
|
48
|
+
this.docChunkDataServiceOpenAiSettings,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async processDocuments(documents: T_Document[]): Promise<
|
|
53
|
+
DyNTS_DAI_DocumentCompareResult<T_Chunk, T_Page, T_ExternalDocumentId, T_ExternalMetadata, T_Document>[]
|
|
54
|
+
> {
|
|
55
|
+
try {
|
|
56
|
+
const compareResults: DyNTS_DAI_DocumentCompareResult<T_Chunk, T_Page, T_ExternalDocumentId, T_ExternalMetadata, T_Document>[] = [];
|
|
57
|
+
|
|
58
|
+
for (const document of documents) {
|
|
59
|
+
compareResults.push(await this.processDocument(document));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const deletedDocuments: T_Document[] = await this.findDataList({
|
|
63
|
+
_id: {
|
|
64
|
+
$nin: documents.map(document => document._id),
|
|
65
|
+
},
|
|
66
|
+
} as any as DyFM_DBFilter<T_Document>);
|
|
67
|
+
|
|
68
|
+
const docPage_DS: DyNTS_OAI_DocPageDataService<T_Chunk, T_Page, T_ExternalDocumentId, T_Document> =
|
|
69
|
+
this.getDocPageDataService();
|
|
70
|
+
|
|
71
|
+
const docChunk_DS: DyNTS_OAI_DocChunkDataService<T_Chunk, T_Page, T_ExternalDocumentId, T_Document> =
|
|
72
|
+
this.getDocChunkDataService();
|
|
73
|
+
|
|
74
|
+
for (const deletedDocument of deletedDocuments) {
|
|
75
|
+
const messages: string[] = [];
|
|
76
|
+
|
|
77
|
+
const chunksToDelete: T_Chunk[] = await docChunk_DS.findDataList({
|
|
78
|
+
documentId: deletedDocument._id,
|
|
79
|
+
} as DyFM_DBFilter<T_Chunk>);
|
|
80
|
+
|
|
81
|
+
for (const chunk of chunksToDelete) {
|
|
82
|
+
await docChunk_DS.deleteData(chunk._id, this.absoluteDeletesOnProcess);
|
|
83
|
+
}
|
|
84
|
+
messages.push(`${chunksToDelete.length} chunks deleted`);
|
|
85
|
+
|
|
86
|
+
const pagesToDelete: T_Page[] = await docPage_DS.findDataList({
|
|
87
|
+
documentId: deletedDocument._id,
|
|
88
|
+
} as DyFM_DBFilter<T_Page>);
|
|
89
|
+
|
|
90
|
+
for (const page of pagesToDelete) {
|
|
91
|
+
await docPage_DS.deleteData(page._id, this.absoluteDeletesOnProcess);
|
|
92
|
+
}
|
|
93
|
+
messages.unshift(`${pagesToDelete.length} pages deleted`);
|
|
94
|
+
|
|
95
|
+
await this.deleteData(deletedDocument._id, this.absoluteDeletesOnProcess);
|
|
96
|
+
messages.unshift(`Document "${deletedDocument.name}" deleted`);
|
|
97
|
+
|
|
98
|
+
compareResults.push({
|
|
99
|
+
result: DyNTS_DAI_CompareResult_Type.deleted,
|
|
100
|
+
newDocument: null,
|
|
101
|
+
oldDocument: deletedDocument,
|
|
102
|
+
pageCompareResults: [],
|
|
103
|
+
reports: messages,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
for (const result of compareResults) {
|
|
108
|
+
// report the result
|
|
109
|
+
await this.reportDocumentProcessResult(result);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return compareResults;
|
|
113
|
+
} catch (error) {
|
|
114
|
+
throw new DyFM_Error({
|
|
115
|
+
...this.getDefaultErrorSettings('processDocuments', error),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async processDocument(document: T_Document): Promise<
|
|
121
|
+
DyNTS_DAI_DocumentCompareResult<T_Chunk, T_Page, T_ExternalDocumentId, T_ExternalMetadata, T_Document>
|
|
122
|
+
> {
|
|
123
|
+
try {
|
|
124
|
+
// ugyan a logikus az lenne, ha először compare-elnénk, és csak az után mentenénk,
|
|
125
|
+
// de akkor nem lenne id, amit a sub-element-ekhez kellenek, ezért...
|
|
126
|
+
// - először kikérjük a régi adatot,
|
|
127
|
+
// - aztán mentünk, hogy legyen id,
|
|
128
|
+
// - és utána compare-eljük
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
let existingDocument: T_Document;
|
|
132
|
+
|
|
133
|
+
if (document._id) {
|
|
134
|
+
existingDocument = await this.findData({
|
|
135
|
+
_id: document._id,
|
|
136
|
+
} as DyFM_DBFilterSimple<T_Document>);
|
|
137
|
+
} else {
|
|
138
|
+
if (!document.externalDocumentId) {
|
|
139
|
+
throw new DyFM_Error({
|
|
140
|
+
...this.getDefaultErrorSettings('processDocument', new Error('externalDocumentId is required')),
|
|
141
|
+
errorCode: 'OAI-DSB-PD0',
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
existingDocument = await this.findData({
|
|
146
|
+
externalDocumentId: document.externalDocumentId,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// save the document to ensure its id
|
|
151
|
+
let docDataToSave: T_Document;
|
|
152
|
+
if (existingDocument) {
|
|
153
|
+
docDataToSave = existingDocument;
|
|
154
|
+
Object.assign(docDataToSave, document);
|
|
155
|
+
} else {
|
|
156
|
+
docDataToSave = {
|
|
157
|
+
...document,
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
delete docDataToSave.pages;
|
|
161
|
+
|
|
162
|
+
const savedDocument: T_Document = await this.saveData(docDataToSave, true);
|
|
163
|
+
|
|
164
|
+
// set the id to the pages and the document
|
|
165
|
+
document.pages.forEach((page: T_Page) => {
|
|
166
|
+
page.documentId = savedDocument._id;
|
|
167
|
+
});
|
|
168
|
+
document._id = savedDocument._id;
|
|
169
|
+
|
|
170
|
+
let documentCompareResult: DyNTS_DAI_DocumentCompareResult<T_Chunk, T_Page, T_ExternalDocumentId, T_ExternalMetadata, T_Document>;
|
|
171
|
+
if (existingDocument) {
|
|
172
|
+
documentCompareResult = await this.compareDocument_deep(document, existingDocument);
|
|
173
|
+
} else {
|
|
174
|
+
const docPage_DS: DyNTS_OAI_DocPageDataService<T_Chunk, T_Page, T_ExternalDocumentId, T_Document> =
|
|
175
|
+
this.getDocPageDataService();
|
|
176
|
+
|
|
177
|
+
const pagesCompareResults: DyNTS_DAI_DocPageCompareResult<T_Chunk, T_Page>[] = await docPage_DS.processNewPages(
|
|
178
|
+
savedDocument.pages,
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
documentCompareResult = {
|
|
182
|
+
result: DyNTS_DAI_CompareResult_Type.new,
|
|
183
|
+
newDocument: document,
|
|
184
|
+
oldDocument: null,
|
|
185
|
+
pageCompareResults: pagesCompareResults,
|
|
186
|
+
reports: [
|
|
187
|
+
`New document: ${document.name}`,
|
|
188
|
+
`${document.pages.length} new pages in ${document.name}`,
|
|
189
|
+
],
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return documentCompareResult;
|
|
194
|
+
} catch (error) {
|
|
195
|
+
throw new DyFM_Error({
|
|
196
|
+
...this.getDefaultErrorSettings('processDocument', error),
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
async compareDocument_deep(newDocument: T_Document, oldDocument: T_Document): Promise<
|
|
202
|
+
DyNTS_DAI_DocumentCompareResult<T_Chunk, T_Page, T_ExternalDocumentId, T_ExternalMetadata, T_Document>
|
|
203
|
+
> {
|
|
204
|
+
try {
|
|
205
|
+
if (this.debugLog) {
|
|
206
|
+
DyFM_Log.info(`🔍 Comparing ${this.dataParams.dataName} document: ${newDocument.name}`);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (!oldDocument) {
|
|
210
|
+
throw new DyFM_Error({
|
|
211
|
+
...this.getDefaultErrorSettings('compareDocument_deep', new Error('oldDocument is required')),
|
|
212
|
+
errorCode: 'OAI-DSB-CD1',
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const documentCompareResult_flat: DyNTS_DAI_DocumentCompareResult<T_Chunk, T_Page, T_ExternalDocumentId, T_ExternalMetadata, T_Document> =
|
|
217
|
+
await this.compareDocument_flat(newDocument, oldDocument);
|
|
218
|
+
const messages: string[] = documentCompareResult_flat.reports;
|
|
219
|
+
|
|
220
|
+
const docPage_DS: DyNTS_OAI_DocPageDataService<T_Chunk, T_Page, T_ExternalDocumentId, T_Document> =
|
|
221
|
+
this.getDocPageDataService();
|
|
222
|
+
|
|
223
|
+
const pagesCompareResults: DyNTS_DAI_DocPageCompareResult<T_Chunk, T_Page>[] = await docPage_DS.processPages(
|
|
224
|
+
newDocument._id,
|
|
225
|
+
newDocument.pages,
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
// determine the result based on the pages
|
|
229
|
+
let pagesResult: DyNTS_DAI_CompareResult_Type;
|
|
230
|
+
if (pagesCompareResults.every(result => result.result === DyNTS_DAI_CompareResult_Type.equal)) {
|
|
231
|
+
pagesResult = DyNTS_DAI_CompareResult_Type.equal;
|
|
232
|
+
messages.push(`All pages are equal`);
|
|
233
|
+
} else if (
|
|
234
|
+
pagesCompareResults.some(
|
|
235
|
+
result => result.result === DyNTS_DAI_CompareResult_Type.new ||
|
|
236
|
+
result.result === DyNTS_DAI_CompareResult_Type.modified ||
|
|
237
|
+
result.result === DyNTS_DAI_CompareResult_Type.deleted
|
|
238
|
+
)
|
|
239
|
+
) {
|
|
240
|
+
pagesResult = DyNTS_DAI_CompareResult_Type.modified;
|
|
241
|
+
|
|
242
|
+
const modifiedPagesCount: number = pagesCompareResults.filter(
|
|
243
|
+
result => result.result === DyNTS_DAI_CompareResult_Type.modified
|
|
244
|
+
).length;
|
|
245
|
+
const deletedPagesCount: number = pagesCompareResults.filter(
|
|
246
|
+
result => result.result === DyNTS_DAI_CompareResult_Type.deleted
|
|
247
|
+
).length;
|
|
248
|
+
const newPagesCount: number = pagesCompareResults.filter(
|
|
249
|
+
result => result.result === DyNTS_DAI_CompareResult_Type.new
|
|
250
|
+
).length;
|
|
251
|
+
|
|
252
|
+
if (modifiedPagesCount > 0) {
|
|
253
|
+
messages.push(`${modifiedPagesCount} pages modified`);
|
|
254
|
+
}
|
|
255
|
+
if (newPagesCount > 0) {
|
|
256
|
+
messages.push(`${newPagesCount} pages new`);
|
|
257
|
+
}
|
|
258
|
+
if (deletedPagesCount > 0) {
|
|
259
|
+
messages.push(`${deletedPagesCount} pages deleted`);
|
|
260
|
+
}
|
|
261
|
+
} else {
|
|
262
|
+
pagesResult = DyNTS_DAI_CompareResult_Type.new;
|
|
263
|
+
const newPagesCount: number = pagesCompareResults.filter(
|
|
264
|
+
result => result.result === DyNTS_DAI_CompareResult_Type.new
|
|
265
|
+
).length;
|
|
266
|
+
messages.push(`${newPagesCount} new pages`);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// determine the result based on both the document and the pages
|
|
270
|
+
let documentResult: DyNTS_DAI_CompareResult_Type;
|
|
271
|
+
if (documentCompareResult_flat.result === DyNTS_DAI_CompareResult_Type.new) {
|
|
272
|
+
documentResult = DyNTS_DAI_CompareResult_Type.new;
|
|
273
|
+
} else if (documentCompareResult_flat.result === DyNTS_DAI_CompareResult_Type.modified) {
|
|
274
|
+
documentResult = DyNTS_DAI_CompareResult_Type.modified;
|
|
275
|
+
} else {
|
|
276
|
+
if (pagesResult === DyNTS_DAI_CompareResult_Type.equal) {
|
|
277
|
+
documentResult = DyNTS_DAI_CompareResult_Type.equal;
|
|
278
|
+
} {
|
|
279
|
+
documentResult = DyNTS_DAI_CompareResult_Type.modified;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const result: DyNTS_DAI_DocumentCompareResult<T_Chunk, T_Page, T_ExternalDocumentId, T_ExternalMetadata, T_Document> = {
|
|
284
|
+
...documentCompareResult_flat,
|
|
285
|
+
result: documentResult,
|
|
286
|
+
|
|
287
|
+
newDocument: newDocument,
|
|
288
|
+
oldDocument: oldDocument,
|
|
289
|
+
|
|
290
|
+
pageCompareResults: pagesCompareResults,
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
return result;
|
|
294
|
+
} catch (error) {
|
|
295
|
+
throw new DyFM_Error({
|
|
296
|
+
...this.getDefaultErrorSettings('compareDocument', error),
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
async compareDocument_flat(newDocument: T_Document, oldDocument: T_Document): Promise<
|
|
302
|
+
DyNTS_DAI_DocumentCompareResult<T_Chunk, T_Page, T_ExternalDocumentId, T_ExternalMetadata, T_Document>
|
|
303
|
+
> {
|
|
304
|
+
try {
|
|
305
|
+
if (!oldDocument) {
|
|
306
|
+
throw new DyFM_Error({
|
|
307
|
+
...this.getDefaultErrorSettings('compareDocument_flat', new Error('oldDocument is required')),
|
|
308
|
+
errorCode: 'OAI-DSB-CF1',
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
let result: DyNTS_DAI_CompareResult_Type;
|
|
313
|
+
const messages: string[] = [];
|
|
314
|
+
|
|
315
|
+
if (!oldDocument) {
|
|
316
|
+
result = DyNTS_DAI_CompareResult_Type.new;
|
|
317
|
+
messages.push(`New document: ${newDocument.name}`);
|
|
318
|
+
} else if (newDocument.name !== oldDocument?.name) {
|
|
319
|
+
result = DyNTS_DAI_CompareResult_Type.modified;
|
|
320
|
+
messages.push(`Document name changed from "${oldDocument?.name}" to "${newDocument.name}"`);
|
|
321
|
+
} else {
|
|
322
|
+
result = DyNTS_DAI_CompareResult_Type.equal;
|
|
323
|
+
messages.push(`Equal document: ${newDocument.name}`);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const result_flat: DyNTS_DAI_DocumentCompareResult<T_Chunk, T_Page, T_ExternalDocumentId, T_ExternalMetadata, T_Document> = {
|
|
327
|
+
result: result,
|
|
328
|
+
|
|
329
|
+
newDocument: newDocument,
|
|
330
|
+
oldDocument: oldDocument,
|
|
331
|
+
|
|
332
|
+
pageCompareResults: [],
|
|
333
|
+
reports: messages,
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return result_flat;
|
|
337
|
+
} catch (error) {
|
|
338
|
+
throw new DyFM_Error({
|
|
339
|
+
...this.getDefaultErrorSettings('compareDocument_shallow', error),
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
async reportDocumentProcessResult(
|
|
345
|
+
documentCompareResult: DyNTS_DAI_DocumentCompareResult<T_Chunk, T_Page, T_ExternalDocumentId, T_ExternalMetadata, T_Document>,
|
|
346
|
+
): Promise<void> {
|
|
347
|
+
try {
|
|
348
|
+
DyFM_Log.log(`✅ Document processed: ${documentCompareResult.newDocument.name}`);
|
|
349
|
+
|
|
350
|
+
switch (documentCompareResult.result) {
|
|
351
|
+
case DyNTS_DAI_CompareResult_Type.new:
|
|
352
|
+
DyFM_Log.info(` ✨ New document`);
|
|
353
|
+
break;
|
|
354
|
+
|
|
355
|
+
case DyNTS_DAI_CompareResult_Type.equal:
|
|
356
|
+
DyFM_Log.log(` 🟰 Equal document`);
|
|
357
|
+
break;
|
|
358
|
+
|
|
359
|
+
case DyNTS_DAI_CompareResult_Type.modified:
|
|
360
|
+
DyFM_Log.info(` 🔄 Modified document`);
|
|
361
|
+
break;
|
|
362
|
+
|
|
363
|
+
case DyNTS_DAI_CompareResult_Type.deleted:
|
|
364
|
+
DyFM_Log.warn(` ❌ Deleted document`);
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
for (const report of documentCompareResult.reports) {
|
|
369
|
+
DyFM_Log.log(` - ${report}`);
|
|
370
|
+
}
|
|
371
|
+
} catch (error) {
|
|
372
|
+
throw new DyFM_Error({
|
|
373
|
+
...this.getDefaultErrorSettings('reportDocumentProcessing', error),
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
package/src/_modules/{open-ai → ai/_modules/open-ai}/_services/oai-embedding.control-service.ts
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import { DyFM_OpenAIModel } from '@futdevpro/fsm-dynamo/open-ai';
|
|
1
|
+
import { DyFM_OAI_Model } from '@futdevpro/fsm-dynamo/ai/open-ai';
|
|
3
2
|
import { DyFM_Error } from '@futdevpro/fsm-dynamo';
|
|
4
3
|
|
|
5
4
|
import { DyNTS_OAI_LLM_ServiceBase } from './oai-llm.service-base';
|
|
6
|
-
import { DyNTS_global_settings } from '
|
|
5
|
+
import { DyNTS_global_settings } from '../../../../../_collections/global-settings.const';
|
|
6
|
+
import { DyNTS_AI_Embedding_ServiceBase } from '../../../_services/ai-embedding.service-base';
|
|
7
7
|
|
|
8
|
-
export class DyNTS_OAI_Embedding_ControlService extends DyNTS_OAI_LLM_ServiceBase {
|
|
8
|
+
export class DyNTS_OAI_Embedding_ControlService extends DyNTS_OAI_LLM_ServiceBase /* implements DyNTS_AI_Embedding_ServiceBase */ {
|
|
9
9
|
|
|
10
10
|
async createEmbedding(
|
|
11
11
|
text: string,
|
|
12
|
-
model:
|
|
12
|
+
model: DyFM_OAI_Model | string = DyFM_OAI_Model.textEmbedding_3Large,
|
|
13
13
|
issuer: string
|
|
14
14
|
): Promise<number[]> {
|
|
15
15
|
try {
|
|
@@ -38,7 +38,7 @@ export class DyNTS_OAI_Embedding_ControlService extends DyNTS_OAI_LLM_ServiceBas
|
|
|
38
38
|
|
|
39
39
|
async createEmbeddings(
|
|
40
40
|
texts: string[],
|
|
41
|
-
model:
|
|
41
|
+
model: DyFM_OAI_Model | string = DyFM_OAI_Model.textEmbedding_3Large,
|
|
42
42
|
issuer: string
|
|
43
43
|
): Promise<number[][]> {
|
|
44
44
|
try {
|
|
@@ -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_getLocalStackLocation, DyFM_Log, DyFM_notNull, DyFM_Object, DyFM_Array } 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';
|
|
@@ -11,6 +11,7 @@ import { DyNTS_OAI_GPT_Message_Role } from '../_enums/oai-gpt-message-role.enum'
|
|
|
11
11
|
import { DyNTS_OAI_LLM_Predefined_Requests } from '../_models/interfaces/oai-llm-predefined-requests.interface';
|
|
12
12
|
import { DyNTS_OAI_LLM_ServiceBase } from './oai-llm.service-base';
|
|
13
13
|
import { DyNTS_OAI_global_settings } from '../_collections/oai-global-settings.const';
|
|
14
|
+
import { DyNTS_AI_LLMChat_ServiceBase } from '../../../_services/ai-llm-chat.service-base';
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -23,7 +24,7 @@ import { DyNTS_OAI_global_settings } from '../_collections/oai-global-settings.c
|
|
|
23
24
|
|
|
24
25
|
// Di Dictionary DiModel DiEz DiAz
|
|
25
26
|
|
|
26
|
-
export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
27
|
+
export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase /* implements DyNTS_AI_LLMChat_ServiceBase */ {
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Asks the AI to answer a yes/no question
|
|
@@ -36,7 +37,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
36
37
|
conversation: DyNTS_OAI_GPT_Message[],
|
|
37
38
|
question: string,
|
|
38
39
|
issuer: string,
|
|
39
|
-
settings?:
|
|
40
|
+
settings?: DyFM_OAI_CallSettings,
|
|
40
41
|
debugLog?: boolean,
|
|
41
42
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
42
43
|
replaceThisInLog?: string,
|
|
@@ -62,7 +63,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
62
63
|
conversation: DyNTS_OAI_GPT_Message[],
|
|
63
64
|
question: string,
|
|
64
65
|
issuer: string,
|
|
65
|
-
settings?:
|
|
66
|
+
settings?: DyFM_OAI_CallSettings,
|
|
66
67
|
debugLog?: boolean,
|
|
67
68
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
68
69
|
replaceThisInLog?: string,
|
|
@@ -84,7 +85,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
84
85
|
conversation: DyNTS_OAI_GPT_Message[],
|
|
85
86
|
question: string,
|
|
86
87
|
issuer: string,
|
|
87
|
-
settings?:
|
|
88
|
+
settings?: DyFM_OAI_CallSettings,
|
|
88
89
|
debugLog?: boolean,
|
|
89
90
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
90
91
|
replaceThisInLog?: string,
|
|
@@ -121,7 +122,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
121
122
|
question: string,
|
|
122
123
|
selectFrom: string[],
|
|
123
124
|
issuer: string,
|
|
124
|
-
settings?:
|
|
125
|
+
settings?: DyFM_OAI_CallSettings,
|
|
125
126
|
debugLog?: boolean,
|
|
126
127
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
127
128
|
replaceThisInLog?: string,
|
|
@@ -161,7 +162,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
161
162
|
question: string,
|
|
162
163
|
selectFrom: T[],
|
|
163
164
|
issuer: string,
|
|
164
|
-
settings?:
|
|
165
|
+
settings?: DyFM_OAI_CallSettings,
|
|
165
166
|
debugLog?: boolean,
|
|
166
167
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
167
168
|
replaceThisInLog?: string,
|
|
@@ -192,7 +193,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
192
193
|
question: string,
|
|
193
194
|
options: string[],
|
|
194
195
|
issuer: string,
|
|
195
|
-
settings?:
|
|
196
|
+
settings?: DyFM_OAI_CallSettings,
|
|
196
197
|
debugLog?: boolean,
|
|
197
198
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
198
199
|
replaceThisInLog?: string,
|
|
@@ -233,7 +234,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
233
234
|
question: string,
|
|
234
235
|
options: T[],
|
|
235
236
|
issuer: string,
|
|
236
|
-
settings?:
|
|
237
|
+
settings?: DyFM_OAI_CallSettings,
|
|
237
238
|
debugLog?: boolean,
|
|
238
239
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
239
240
|
replaceThisInLog?: string,
|
|
@@ -267,7 +268,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
267
268
|
conversation: DyNTS_OAI_GPT_Message[],
|
|
268
269
|
question: string,
|
|
269
270
|
issuer: string,
|
|
270
|
-
settings?:
|
|
271
|
+
settings?: DyFM_OAI_CallSettings,
|
|
271
272
|
debugLog?: boolean,
|
|
272
273
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
273
274
|
replaceThisInLog?: string,
|
|
@@ -298,7 +299,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
298
299
|
question: string,
|
|
299
300
|
keysDescription: string,
|
|
300
301
|
issuer: string,
|
|
301
|
-
settings?:
|
|
302
|
+
settings?: DyFM_OAI_CallSettings,
|
|
302
303
|
debugLog?: boolean,
|
|
303
304
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
304
305
|
replaceThisInLog?: string,
|
|
@@ -333,7 +334,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
333
334
|
question: string,
|
|
334
335
|
keys: string[],
|
|
335
336
|
issuer: string,
|
|
336
|
-
settings?:
|
|
337
|
+
settings?: DyFM_OAI_CallSettings,
|
|
337
338
|
debugLog?: boolean,
|
|
338
339
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
339
340
|
replaceThisInLog?: string,
|
|
@@ -367,7 +368,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
367
368
|
conversation: DyNTS_OAI_GPT_Message[],
|
|
368
369
|
question: string,
|
|
369
370
|
issuer: string,
|
|
370
|
-
settings?:
|
|
371
|
+
settings?: DyFM_OAI_CallSettings,
|
|
371
372
|
debugLog?: boolean,
|
|
372
373
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
373
374
|
replaceThisInLog?: string,
|
|
@@ -393,7 +394,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
393
394
|
question: string,
|
|
394
395
|
issuer: string,
|
|
395
396
|
debugLog?: boolean,
|
|
396
|
-
messageSettings:
|
|
397
|
+
messageSettings: DyFM_OAI_CallSettings = this.defaultSettings
|
|
397
398
|
): Promise<string> {
|
|
398
399
|
const answer = await this.resolveSimpleUserMessageInConversation(
|
|
399
400
|
conversation,
|
|
@@ -414,7 +415,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
414
415
|
conversation: DyNTS_OAI_GPT_Message[],
|
|
415
416
|
question?: string,
|
|
416
417
|
issuer: string,
|
|
417
|
-
settings?:
|
|
418
|
+
settings?: DyFM_OAI_CallSettings,
|
|
418
419
|
debugLog?: boolean,
|
|
419
420
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
420
421
|
replaceThisInLog?: string,
|
|
@@ -442,7 +443,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
442
443
|
conversation: DyNTS_OAI_GPT_Message[],
|
|
443
444
|
newMessage?: string,
|
|
444
445
|
issuer: string,
|
|
445
|
-
settings?:
|
|
446
|
+
settings?: DyFM_OAI_CallSettings,
|
|
446
447
|
debugLog?: boolean,
|
|
447
448
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
448
449
|
replaceThisInLog?: string,
|
|
@@ -470,7 +471,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
470
471
|
set: {
|
|
471
472
|
conversation: DyNTS_OAI_GPT_Message[],
|
|
472
473
|
issuer: string,
|
|
473
|
-
settings?:
|
|
474
|
+
settings?: DyFM_OAI_CallSettings,
|
|
474
475
|
getFullResponse?: boolean,
|
|
475
476
|
debugLog?: boolean,
|
|
476
477
|
/** this is used to readably replace too long contents to eg '...' in logs */
|
|
@@ -489,7 +490,7 @@ export class DyNTS_OAI_LLMChat_ServiceBase extends DyNTS_OAI_LLM_ServiceBase {
|
|
|
489
490
|
set: {
|
|
490
491
|
conversation: DyNTS_OAI_GPT_Message[],
|
|
491
492
|
issuer: string,
|
|
492
|
-
settings?:
|
|
493
|
+
settings?: DyFM_OAI_CallSettings,
|
|
493
494
|
getFullResponse?: boolean,
|
|
494
495
|
debugLog?: boolean,
|
|
495
496
|
/** this is used to readably replace too long contents to eg '...' in logs */
|