From b611ab9a0bfedab0b6e9b647540023a38f9237ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Je=C5=BEek?= Date: Wed, 8 Jan 2025 14:56:58 +0100 Subject: [PATCH] chore(embeddings): use framework embeddings, refactor ai providers (#143) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Radek Ježek --- .env.example | 5 +- .eslintignore | 1 - README.md | 2 +- package.json | 7 +- pnpm-lock.yaml | 22 +- seeders/DatabaseSeeder.ts | 9 +- src/@types/grpc/index.d.ts | 467 ------------ src/assistants/assistants.service.ts | 5 +- src/chat/chat.service.ts | 9 +- src/config.ts | 6 +- src/embedding/adapters/bam-embedding.ts | 56 -- .../adapters/caikit/caikit-embedding.ts | 61 -- src/embedding/adapters/caikit/grpc/client.ts | 57 -- .../adapters/caikit/grpc/constants.ts | 23 - .../protos/caikit_data_model_caikit_nlp.proto | 120 --- .../protos/caikit_data_model_common.proto | 196 ----- .../caikit_data_model_common_runtime.proto | 63 -- .../grpc/protos/caikit_data_model_nlp.proto | 196 ----- .../protos/caikit_data_model_runtime.proto | 55 -- .../grpc/protos/caikit_runtime_Nlp.proto | 245 ------ .../grpc/protos/caikit_runtime_info.proto | 31 - ...StreamingTokenClassificationTaskRequest.ts | 30 - .../DataStreamSourceGenerationTrainRecord.ts | 56 -- ...reamSourceGenerationTrainRecordJsonData.ts | 27 - .../runtime/Nlp/EmbeddingTaskRequest.ts | 31 - .../runtime/Nlp/EmbeddingTasksRequest.ts | 31 - .../types/caikit/runtime/Nlp/NlpService.ts | 711 ------------------ .../caikit/runtime/Nlp/NlpTrainingService.ts | 143 ---- .../caikit/runtime/Nlp/RerankTaskRequest.ts | 50 -- .../caikit/runtime/Nlp/RerankTasksRequest.ts | 50 -- .../Nlp/SentenceSimilarityTaskRequest.ts | 33 - .../Nlp/SentenceSimilarityTasksRequest.ts | 33 - ...erverStreamingTextGenerationTaskRequest.ts | 82 -- .../Nlp/TextClassificationTaskRequest.ts | 26 - ...tionTaskPeftPromptTuningTrainParameters.ts | 91 --- ...erationTaskPeftPromptTuningTrainRequest.ts | 38 - .../runtime/Nlp/TextGenerationTaskRequest.ts | 82 -- ...rationTaskTextGenerationTrainParameters.ts | 69 -- ...enerationTaskTextGenerationTrainRequest.ts | 38 - .../Nlp/TokenClassificationTaskRequest.ts | 30 - .../runtime/Nlp/TokenizationTaskRequest.ts | 26 - .../types/caikit/runtime/info/InfoService.ts | 57 -- .../caikit_nlp/EmbeddingResult.ts | 39 - .../caikit_nlp/EmbeddingResults.ts | 39 - .../ExponentialDecayLengthPenalty.ts | 29 - .../caikit_nlp/GenerationTrainRecord.ts | 28 - .../caikit_nlp/RerankResult.ts | 39 - .../caikit_nlp/RerankResults.ts | 39 - .../caikit_nlp/RerankScore.ts | 34 - .../caikit_nlp/RerankScores.ts | 32 - .../caikit_nlp/SentenceSimilarityResult.ts | 39 - .../caikit_nlp/SentenceSimilarityResults.ts | 39 - .../caikit_nlp/SentenceSimilarityScores.ts | 26 - .../caikit_nlp/TuningConfig.ts | 35 - .../caikit_data_model/common/BoolSequence.ts | 26 - .../common/ConnectionInfo.ts | 45 -- .../common/ConnectionTlsInfo.ts | 44 -- .../caikit_data_model/common/Directory.ts | 28 - .../types/caikit_data_model/common/File.ts | 30 - .../caikit_data_model/common/FileReference.ts | 26 - .../caikit_data_model/common/FloatSequence.ts | 26 - .../caikit_data_model/common/IntSequence.ts | 27 - .../common/ListOfFileReferences.ts | 26 - .../common/ListOfVector1D.ts | 30 - .../common/NpFloat32Sequence.ts | 26 - .../common/NpFloat64Sequence.ts | 26 - .../caikit_data_model/common/ProducerId.ts | 28 - .../common/ProducerPriority.ts | 30 - .../common/PyFloatSequence.ts | 26 - .../types/caikit_data_model/common/S3Base.ts | 38 - .../types/caikit_data_model/common/S3Files.ts | 40 - .../types/caikit_data_model/common/S3Path.ts | 40 - .../caikit_data_model/common/StrSequence.ts | 26 - .../common/TrainingStatus.ts | 42 -- .../caikit_data_model/common/Vector1D.ts | 44 -- .../common/runtime/ModelInfo.ts | 40 - .../common/runtime/ModelInfoRequest.ts | 26 - .../common/runtime/ModelInfoResponse.ts | 30 - .../common/runtime/RuntimeInfoRequest.ts | 24 - .../common/runtime/RuntimeInfoResponse.ts | 28 - .../nlp/ClassificationResult.ts | 28 - .../nlp/ClassificationResults.ts | 30 - .../nlp/ClassificationTrainRecord.ts | 28 - .../nlp/ClassifiedGeneratedTextResult.ts | 59 -- .../ClassifiedGeneratedTextStreamResult.ts | 63 -- .../caikit_data_model/nlp/FinishReason.ts | 48 -- .../nlp/GeneratedTextResult.ts | 53 -- .../nlp/GeneratedTextStreamResult.ts | 46 -- .../caikit_data_model/nlp/GeneratedToken.ts | 28 - .../caikit_data_model/nlp/InputWarning.ts | 32 - .../nlp/InputWarningReason.ts | 27 - .../nlp/TextGenTokenClassificationResults.ts | 32 - .../grpc/types/caikit_data_model/nlp/Token.ts | 31 - .../nlp/TokenClassificationResult.ts | 39 - .../nlp/TokenClassificationResults.ts | 30 - .../nlp/TokenClassificationStreamResult.ts | 35 - .../nlp/TokenStreamDetails.ts | 37 - .../nlp/TokenizationResults.ts | 33 - .../nlp/TokenizationStreamResult.ts | 37 - .../caikit_data_model/runtime/ModelPointer.ts | 26 - .../runtime/TrainingInfoRequest.ts | 26 - .../caikit_data_model/runtime/TrainingJob.ts | 28 - .../runtime/TrainingStatusResponse.ts | 42 -- .../types/caikit_data_model_caikit_nlp.ts | 74 -- .../grpc/types/caikit_data_model_common.ts | 52 -- .../types/caikit_data_model_common_runtime.ts | 67 -- .../grpc/types/caikit_data_model_nlp.ts | 73 -- .../grpc/types/caikit_data_model_runtime.ts | 63 -- .../caikit/grpc/types/caikit_runtime_Nlp.ts | 130 ---- .../caikit/grpc/types/caikit_runtime_info.ts | 75 -- .../grpc/types/google/protobuf/ListValue.ts | 30 - .../grpc/types/google/protobuf/NullValue.ts | 27 - .../grpc/types/google/protobuf/Struct.ts | 30 - .../grpc/types/google/protobuf/Timestamp.ts | 29 - .../grpc/types/google/protobuf/Value.ts | 50 -- .../caikit/grpc/utils/build-client.ts | 66 -- .../adapters/caikit/grpc/utils/errors.ts | 66 -- .../adapters/caikit/grpc/utils/metadata.ts | 25 - .../adapters/caikit/grpc/utils/url.ts | 22 - .../adapters/caikit/grpc/utils/wrappers.ts | 74 -- src/embedding/adapters/embedding.ts | 44 -- src/embedding/adapters/ollama-embedding.ts | 33 - src/embedding/adapters/openai-embedding.ts | 36 - src/embedding/adapters/watsonx-embedding.ts | 50 -- src/embedding/constants.ts | 24 - src/embedding/factory.ts | 91 --- src/embedding/utilts.ts | 34 - src/errors/error.entity.ts | 10 - src/runs/execution/constants.ts | 25 +- src/runs/execution/execute.ts | 5 +- src/runs/execution/factory.ts | 183 +---- src/runs/execution/provider.ts | 285 +++++++ src/runs/execution/tools/file-search-tool.ts | 11 +- src/runs/execution/tools/helpers.ts | 20 +- .../tools/wikipedia-similarity-search-tool.ts | 116 --- src/runs/execution/tools/wikipedia-tool.ts | 93 +++ src/tools/tools.service.ts | 7 +- src/users/users.service.ts | 5 +- src/vector-store-files/execution/client.ts | 4 +- .../execution/process-file.ts | 11 +- src/vector-stores/constants.ts | 3 - 141 files changed, 438 insertions(+), 7053 deletions(-) delete mode 100644 src/@types/grpc/index.d.ts delete mode 100644 src/embedding/adapters/bam-embedding.ts delete mode 100644 src/embedding/adapters/caikit/caikit-embedding.ts delete mode 100644 src/embedding/adapters/caikit/grpc/client.ts delete mode 100644 src/embedding/adapters/caikit/grpc/constants.ts delete mode 100644 src/embedding/adapters/caikit/grpc/protos/caikit_data_model_caikit_nlp.proto delete mode 100644 src/embedding/adapters/caikit/grpc/protos/caikit_data_model_common.proto delete mode 100644 src/embedding/adapters/caikit/grpc/protos/caikit_data_model_common_runtime.proto delete mode 100644 src/embedding/adapters/caikit/grpc/protos/caikit_data_model_nlp.proto delete mode 100644 src/embedding/adapters/caikit/grpc/protos/caikit_data_model_runtime.proto delete mode 100644 src/embedding/adapters/caikit/grpc/protos/caikit_runtime_Nlp.proto delete mode 100644 src/embedding/adapters/caikit/grpc/protos/caikit_runtime_info.proto delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/BidiStreamingTokenClassificationTaskRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/DataStreamSourceGenerationTrainRecord.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/DataStreamSourceGenerationTrainRecordJsonData.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/EmbeddingTaskRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/EmbeddingTasksRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/NlpService.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/NlpTrainingService.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/RerankTaskRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/RerankTasksRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/SentenceSimilarityTaskRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/SentenceSimilarityTasksRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/ServerStreamingTextGenerationTaskRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextClassificationTaskRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskPeftPromptTuningTrainParameters.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskPeftPromptTuningTrainRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskTextGenerationTrainParameters.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskTextGenerationTrainRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TokenClassificationTaskRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TokenizationTaskRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit/runtime/info/InfoService.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/EmbeddingResult.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/EmbeddingResults.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/ExponentialDecayLengthPenalty.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/GenerationTrainRecord.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankResult.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankResults.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankScore.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankScores.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/SentenceSimilarityResult.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/SentenceSimilarityResults.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/SentenceSimilarityScores.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/TuningConfig.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/BoolSequence.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ConnectionInfo.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ConnectionTlsInfo.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/Directory.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/File.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/FileReference.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/FloatSequence.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/IntSequence.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ListOfFileReferences.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ListOfVector1D.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/NpFloat32Sequence.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/NpFloat64Sequence.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ProducerId.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ProducerPriority.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/PyFloatSequence.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/S3Base.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/S3Files.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/S3Path.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/StrSequence.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/TrainingStatus.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/Vector1D.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/ModelInfo.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/ModelInfoRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/ModelInfoResponse.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/RuntimeInfoRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/RuntimeInfoResponse.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassificationResult.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassificationResults.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassificationTrainRecord.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassifiedGeneratedTextResult.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassifiedGeneratedTextStreamResult.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/FinishReason.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/GeneratedTextResult.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/GeneratedTextStreamResult.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/GeneratedToken.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/InputWarning.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/InputWarningReason.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TextGenTokenClassificationResults.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/Token.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenClassificationResult.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenClassificationResults.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenClassificationStreamResult.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenStreamDetails.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenizationResults.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenizationStreamResult.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/ModelPointer.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/TrainingInfoRequest.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/TrainingJob.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/TrainingStatusResponse.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model_caikit_nlp.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model_common.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model_common_runtime.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model_nlp.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_data_model_runtime.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_runtime_Nlp.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/caikit_runtime_info.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/google/protobuf/ListValue.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/google/protobuf/NullValue.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/google/protobuf/Struct.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/google/protobuf/Timestamp.ts delete mode 100644 src/embedding/adapters/caikit/grpc/types/google/protobuf/Value.ts delete mode 100644 src/embedding/adapters/caikit/grpc/utils/build-client.ts delete mode 100644 src/embedding/adapters/caikit/grpc/utils/errors.ts delete mode 100644 src/embedding/adapters/caikit/grpc/utils/metadata.ts delete mode 100644 src/embedding/adapters/caikit/grpc/utils/url.ts delete mode 100644 src/embedding/adapters/caikit/grpc/utils/wrappers.ts delete mode 100644 src/embedding/adapters/embedding.ts delete mode 100644 src/embedding/adapters/ollama-embedding.ts delete mode 100644 src/embedding/adapters/openai-embedding.ts delete mode 100644 src/embedding/adapters/watsonx-embedding.ts delete mode 100644 src/embedding/constants.ts delete mode 100644 src/embedding/factory.ts delete mode 100644 src/embedding/utilts.ts create mode 100644 src/runs/execution/provider.ts delete mode 100644 src/runs/execution/tools/wikipedia-similarity-search-tool.ts create mode 100644 src/runs/execution/tools/wikipedia-tool.ts diff --git a/.env.example b/.env.example index 50fe713..1ebbda3 100644 --- a/.env.example +++ b/.env.example @@ -45,10 +45,7 @@ RUN_BULLMQ_WORKERS=runs,runs-cleanup,vectorStores-cleanup,vectorStores-fileProce # --- BACKEND SECTION --- # LLM backend, possible values are: ollama, openai, watsonx, bam, ibm-vllm -LLM_BACKEND=watsonx - -# Embedding backend, possible values are: ollama, openai, watsonx, bam, caikit -EMBEDDING_BACKEND=watsonx +AI_BACKEND=watsonx # Extraction backend, possible values are: docling, unstructured-opensource, unstructured-api EXTRACTION_BACKEND=docling diff --git a/.eslintignore b/.eslintignore index 6e38f8b..a0c161a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,2 @@ -src/**/grpc/types/** dist/ playground/ diff --git a/README.md b/README.md index 041fdf2..39bae6d 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ pnpm mikro-orm seeder:run cp .env.example .env ``` -- Add values the env vars: CRYPTO_CIPHER_KEY, LLM_BACKEND, EMBEDDING_BACKEND and API key for which ever provider you have chosen. +- Add values the env vars: CRYPTO_CIPHER_KEY, AI_BACKEND and API key for which ever provider you have chosen. - Run the bee-api: diff --git a/package.json b/package.json index 9bdd7a2..739c1a3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "author": "IBM Corp.", "type": "module", "scripts": { - "build": "vite build && cp -R src/embedding/adapters/caikit/grpc/protos dist/embedding/adapters/caikit/grpc/protos", + "build": "vite build", "start": "node --enable-source-maps --experimental-loader=@opentelemetry/instrumentation/hook.mjs --import ./dist/opentelemetry.js ./dist/server.js", "start:dev": "tsx watch src/server.ts | pino-pretty --singleLine", "start:dev:nowatch": "tsx src/server.ts | pino-pretty --singleLine", @@ -20,7 +20,6 @@ "lint": "eslint ./", "lint:fix": "eslint --fix ./", "ts:check": "tsc --noEmit", - "grpc:generate-types": "proto-loader-gen-types --defaults --keepCase --oneofs --longs=Number --enums=String --grpcLib=@grpc/grpc-js --outDir=./src/embedding/adapters/caikit/grpc/types ./src/embedding/adapters/caikit/grpc/protos/*.proto", "copyright": "./scripts/copyright.sh", "release": "release-it" }, @@ -33,8 +32,6 @@ "@fastify/type-provider-json-schema-to-ts": "^3.0.0", "@godaddy/terminus": "^4.12.1", "@googleapis/customsearch": "^3.2.0", - "@grpc/grpc-js": "^1.12.2", - "@grpc/proto-loader": "^0.7.13", "@ibm-generative-ai/node-sdk": "^3.2.4", "@mikro-orm/core": "6.2.9", "@mikro-orm/migrations-mongodb": "6.2.9", @@ -49,7 +46,7 @@ "@zilliz/milvus2-sdk-node": "^2.4.4", "ajv": "^8.17.1", "axios": "^1.7.7", - "bee-agent-framework": "0.0.54", + "bee-agent-framework": "0.0.55", "bullmq": "^5.34.6", "bullmq-otel": "^1.0.1", "cache-manager": "^5.7.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 883ee95..4ab886f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,12 +32,6 @@ importers: '@googleapis/customsearch': specifier: ^3.2.0 version: 3.2.0(encoding@0.1.13) - '@grpc/grpc-js': - specifier: ^1.12.2 - version: 1.12.2 - '@grpc/proto-loader': - specifier: ^0.7.13 - version: 0.7.13 '@ibm-generative-ai/node-sdk': specifier: ^3.2.4 version: 3.2.4(encoding@0.1.13) @@ -81,8 +75,8 @@ importers: specifier: ^1.7.7 version: 1.7.7 bee-agent-framework: - specifier: 0.0.54 - version: 0.0.54(@bufbuild/protobuf@1.10.0)(@googleapis/customsearch@3.2.0(encoding@0.1.13))(@grpc/grpc-js@1.12.2)(@grpc/proto-loader@0.7.13)(@ibm-generative-ai/node-sdk@3.2.4(encoding@0.1.13))(@zilliz/milvus2-sdk-node@2.4.4)(encoding@0.1.13)(google-auth-library@9.15.0(encoding@0.1.13))(ollama@0.5.9)(openai-chat-tokens@0.2.8)(openai@4.67.3(encoding@0.1.13)(zod@3.23.8)) + specifier: 0.0.55 + version: 0.0.55(@bufbuild/protobuf@1.10.0)(@googleapis/customsearch@3.2.0(encoding@0.1.13))(@grpc/grpc-js@1.12.2)(@grpc/proto-loader@0.7.13)(@ibm-generative-ai/node-sdk@3.2.4(encoding@0.1.13))(@zilliz/milvus2-sdk-node@2.4.4)(encoding@0.1.13)(google-auth-library@9.15.0(encoding@0.1.13))(ollama@0.5.9)(openai-chat-tokens@0.2.8)(openai@4.67.3(encoding@0.1.13)(zod@3.23.8))(yaml@2.6.0) bullmq: specifier: ^5.34.6 version: 5.34.6 @@ -2130,8 +2124,8 @@ packages: resolution: {integrity: sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==} engines: {node: '>=10.0.0'} - bee-agent-framework@0.0.54: - resolution: {integrity: sha512-/WBAgEP2EZGIcjDMSBEXIcZqH0nE6E1Zqfj137T6Uago3/KT1hk3806txJGA3iTRhPWBwztP0XPXeLWpldf9zg==} + bee-agent-framework@0.0.55: + resolution: {integrity: sha512-4peuteFKgJ7HFj0m0N59EftIVpWm4FjkdLbJjuO1zJ4fL3nZZgCQZfv0Xn++McuuZwYC9DL5TbjzX29yNQngVw==} peerDependencies: '@aws-sdk/client-bedrock-runtime': ^3.687.0 '@elastic/elasticsearch': ^8.0.0 @@ -2149,6 +2143,7 @@ packages: openai: ^4.67.3 openai-chat-tokens: ^0.2.8 sequelize: ^6.37.3 + yaml: ^2.6.1 peerDependenciesMeta: '@aws-sdk/client-bedrock-runtime': optional: true @@ -2182,6 +2177,8 @@ packages: optional: true sequelize: optional: true + yaml: + optional: true bee-proto@0.0.2: resolution: {integrity: sha512-UgBcejkBslLdR39ozpDtX6gjD3OgB1pZS7GDO4v2CfthZhddwfzco/BdEd5IdeMX9d+srX7LgsBGOtn48djNWg==} @@ -7835,7 +7832,7 @@ snapshots: ast-types@0.13.4: dependencies: - tslib: 2.8.0 + tslib: 2.8.1 async-retry@1.3.3: dependencies: @@ -7875,7 +7872,7 @@ snapshots: basic-ftp@5.0.5: {} - bee-agent-framework@0.0.54(@bufbuild/protobuf@1.10.0)(@googleapis/customsearch@3.2.0(encoding@0.1.13))(@grpc/grpc-js@1.12.2)(@grpc/proto-loader@0.7.13)(@ibm-generative-ai/node-sdk@3.2.4(encoding@0.1.13))(@zilliz/milvus2-sdk-node@2.4.4)(encoding@0.1.13)(google-auth-library@9.15.0(encoding@0.1.13))(ollama@0.5.9)(openai-chat-tokens@0.2.8)(openai@4.67.3(encoding@0.1.13)(zod@3.23.8)): + bee-agent-framework@0.0.55(@bufbuild/protobuf@1.10.0)(@googleapis/customsearch@3.2.0(encoding@0.1.13))(@grpc/grpc-js@1.12.2)(@grpc/proto-loader@0.7.13)(@ibm-generative-ai/node-sdk@3.2.4(encoding@0.1.13))(@zilliz/milvus2-sdk-node@2.4.4)(encoding@0.1.13)(google-auth-library@9.15.0(encoding@0.1.13))(ollama@0.5.9)(openai-chat-tokens@0.2.8)(openai@4.67.3(encoding@0.1.13)(zod@3.23.8))(yaml@2.6.0): dependencies: '@ai-zen/node-fetch-event-source': 2.1.4(encoding@0.1.13) '@connectrpc/connect': 1.6.1(@bufbuild/protobuf@1.10.0) @@ -7917,6 +7914,7 @@ snapshots: ollama: 0.5.9 openai: 4.67.3(encoding@0.1.13)(zod@3.23.8) openai-chat-tokens: 0.2.8 + yaml: 2.6.0 transitivePeerDependencies: - '@bufbuild/protobuf' - debug diff --git a/seeders/DatabaseSeeder.ts b/seeders/DatabaseSeeder.ts index be006bb..56dcd7a 100644 --- a/seeders/DatabaseSeeder.ts +++ b/seeders/DatabaseSeeder.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { ref, type EntityManager } from '@mikro-orm/core'; +import { type EntityManager, ref } from '@mikro-orm/core'; import { Seeder } from '@mikro-orm/seeder'; import { OrganizationUserRole, ProjectRole } from '@/administration/entities/constants'; @@ -30,7 +30,8 @@ import { ProjectApiKey } from '@/administration/entities/project-api-key.entity' import { API_KEY_PREFIX, scryptSecret } from '@/auth/utils'; import { IBM_ORGANIZATION_OWNER_ID } from '@/config'; import { redactProjectKeyValue } from '@/administration/helpers'; -import { Agent, getDefaultModel } from '@/runs/execution/constants'; +import { Agent } from '@/runs/execution/constants'; +import { defaultAIProvider } from '@/runs/execution/provider'; const USER_EXTERNAL_ID = 'test'; const PROJECT_API_KEY = `${API_KEY_PREFIX}testkey`; @@ -91,7 +92,7 @@ export class DatabaseSeeder extends Seeder { redactedValue: redactProjectKeyValue(PROJECT_API_KEY) }); const beeAssistant = new Assistant({ - model: getDefaultModel(), + model: defaultAIProvider.createAssistantBackend().modelId, agent: Agent.BEE, tools: [ { @@ -120,7 +121,7 @@ export class DatabaseSeeder extends Seeder { } }); const streamlitAssistant = new Assistant({ - model: getDefaultModel(), + model: defaultAIProvider.createAssistantBackend().modelId, agent: Agent.STREAMLIT, tools: [], name: 'Builder Assistant', diff --git a/src/@types/grpc/index.d.ts b/src/@types/grpc/index.d.ts deleted file mode 100644 index a5ac075..0000000 --- a/src/@types/grpc/index.d.ts +++ /dev/null @@ -1,467 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import '@grpc/proto-loader'; - -declare module '@grpc/proto-loader' { - declare class Long { - /** - * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs. - */ - constructor(low: number, high?: number, unsigned?: boolean); - - /** - * Maximum unsigned value. - */ - static MAX_UNSIGNED_VALUE: Long; - - /** - * Maximum signed value. - */ - static MAX_VALUE: Long; - - /** - * Minimum signed value. - */ - static MIN_VALUE: Long; - - /** - * Signed negative one. - */ - static NEG_ONE: Long; - - /** - * Signed one. - */ - static ONE: Long; - - /** - * Unsigned one. - */ - static UONE: Long; - - /** - * Unsigned zero. - */ - static UZERO: Long; - - /** - * Signed zero - */ - static ZERO: Long; - - /** - * The high 32 bits as a signed value. - */ - high: number; - - /** - * The low 32 bits as a signed value. - */ - low: number; - - /** - * Whether unsigned or not. - */ - unsigned: boolean; - - /** - * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits. - */ - static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long; - - /** - * Returns a Long representing the given 32 bit integer value. - */ - static fromInt(value: number, unsigned?: boolean): Long; - - /** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - */ - static fromNumber(value: number, unsigned?: boolean): Long; - - /** - * Returns a Long representation of the given string, written using the specified radix. - */ - static fromString(str: string, unsigned?: boolean | number, radix?: number): Long; - - /** - * Creates a Long from its byte representation. - */ - static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long; - - /** - * Creates a Long from its little endian byte representation. - */ - static fromBytesLE(bytes: number[], unsigned?: boolean): Long; - - /** - * Creates a Long from its big endian byte representation. - */ - static fromBytesBE(bytes: number[], unsigned?: boolean): Long; - - /** - * Tests if the specified object is a Long. - */ - static isLong(obj: any): obj is Long; - - /** - * Converts the specified value to a Long. - */ - static fromValue( - val: Long | number | string | { low: number; high: number; unsigned: boolean }, - unsigned?: boolean - ): Long; - - /** - * Returns the sum of this and the specified Long. - */ - add(addend: number | Long | string): Long; - - /** - * Returns the bitwise AND of this Long and the specified. - */ - and(other: Long | number | string): Long; - - /** - * Compares this Long's value with the specified's. - */ - compare(other: Long | number | string): number; - - /** - * Compares this Long's value with the specified's. - */ - comp(other: Long | number | string): number; - - /** - * Returns this Long divided by the specified. - */ - divide(divisor: Long | number | string): Long; - - /** - * Returns this Long divided by the specified. - */ - div(divisor: Long | number | string): Long; - - /** - * Tests if this Long's value equals the specified's. - */ - equals(other: Long | number | string): boolean; - - /** - * Tests if this Long's value equals the specified's. - */ - eq(other: Long | number | string): boolean; - - /** - * Gets the high 32 bits as a signed integer. - */ - getHighBits(): number; - - /** - * Gets the high 32 bits as an unsigned integer. - */ - getHighBitsUnsigned(): number; - - /** - * Gets the low 32 bits as a signed integer. - */ - getLowBits(): number; - - /** - * Gets the low 32 bits as an unsigned integer. - */ - getLowBitsUnsigned(): number; - - /** - * Gets the number of bits needed to represent the absolute value of this Long. - */ - getNumBitsAbs(): number; - - /** - * Tests if this Long's value is greater than the specified's. - */ - greaterThan(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is greater than the specified's. - */ - gt(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is greater than or equal the specified's. - */ - greaterThanOrEqual(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is greater than or equal the specified's. - */ - gte(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is greater than or equal the specified's. - */ - ge(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is even. - */ - isEven(): boolean; - - /** - * Tests if this Long's value is negative. - */ - isNegative(): boolean; - - /** - * Tests if this Long's value is odd. - */ - isOdd(): boolean; - - /** - * Tests if this Long's value is positive or zero. - */ - isPositive(): boolean; - - /** - * Tests if this Long's value equals zero. - */ - isZero(): boolean; - - /** - * Tests if this Long's value equals zero. - */ - eqz(): boolean; - - /** - * Tests if this Long's value is less than the specified's. - */ - lessThan(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is less than the specified's. - */ - lt(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is less than or equal the specified's. - */ - lessThanOrEqual(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is less than or equal the specified's. - */ - lte(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is less than or equal the specified's. - */ - le(other: Long | number | string): boolean; - - /** - * Returns this Long modulo the specified. - */ - modulo(other: Long | number | string): Long; - - /** - * Returns this Long modulo the specified. - */ - mod(other: Long | number | string): Long; - - /** - * Returns this Long modulo the specified. - */ - rem(other: Long | number | string): Long; - - /** - * Returns the product of this and the specified Long. - */ - multiply(multiplier: Long | number | string): Long; - - /** - * Returns the product of this and the specified Long. - */ - mul(multiplier: Long | number | string): Long; - - /** - * Negates this Long's value. - */ - negate(): Long; - - /** - * Negates this Long's value. - */ - neg(): Long; - - /** - * Returns the bitwise NOT of this Long. - */ - not(): Long; - - /** - * Returns count leading zeros of this Long. - */ - countLeadingZeros(): number; - - /** - * Returns count leading zeros of this Long. - */ - clz(): number; - - /** - * Returns count trailing zeros of this Long. - */ - countTrailingZeros(): number; - - /** - * Returns count trailing zeros of this Long. - */ - ctz(): number; - - /** - * Tests if this Long's value differs from the specified's. - */ - notEquals(other: Long | number | string): boolean; - - /** - * Tests if this Long's value differs from the specified's. - */ - neq(other: Long | number | string): boolean; - - /** - * Tests if this Long's value differs from the specified's. - */ - ne(other: Long | number | string): boolean; - - /** - * Returns the bitwise OR of this Long and the specified. - */ - or(other: Long | number | string): Long; - - /** - * Returns this Long with bits shifted to the left by the given amount. - */ - shiftLeft(numBits: number | Long): Long; - - /** - * Returns this Long with bits shifted to the left by the given amount. - */ - shl(numBits: number | Long): Long; - - /** - * Returns this Long with bits arithmetically shifted to the right by the given amount. - */ - shiftRight(numBits: number | Long): Long; - - /** - * Returns this Long with bits arithmetically shifted to the right by the given amount. - */ - shr(numBits: number | Long): Long; - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - */ - shiftRightUnsigned(numBits: number | Long): Long; - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - */ - shru(numBits: number | Long): Long; - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - */ - shr_u(numBits: number | Long): Long; - - /** - * Returns this Long with bits rotated to the left by the given amount. - */ - rotateLeft(numBits: number | Long): Long; - - /** - * Returns this Long with bits rotated to the left by the given amount. - */ - rotl(numBits: number | Long): Long; - - /** - * Returns this Long with bits rotated to the right by the given amount. - */ - rotateRight(numBits: number | Long): Long; - - /** - * Returns this Long with bits rotated to the right by the given amount. - */ - rotr(numBits: number | Long): Long; - - /** - * Returns the difference of this and the specified Long. - */ - subtract(subtrahend: number | Long | string): Long; - - /** - * Returns the difference of this and the specified Long. - */ - sub(subtrahend: number | Long | string): Long; - - /** - * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. - */ - toInt(): number; - - /** - * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). - */ - toNumber(): number; - - /** - * Converts this Long to its byte representation. - */ - - toBytes(le?: boolean): number[]; - - /** - * Converts this Long to its little endian byte representation. - */ - - toBytesLE(): number[]; - - /** - * Converts this Long to its big endian byte representation. - */ - - toBytesBE(): number[]; - - /** - * Converts this Long to signed. - */ - toSigned(): Long; - - /** - * Converts the Long to a string written in the specified radix. - */ - toString(radix?: number): string; - - /** - * Converts this Long to unsigned. - */ - toUnsigned(): Long; - - /** - * Returns the bitwise XOR of this Long and the given one. - */ - xor(other: Long | number | string): Long; - } -} diff --git a/src/assistants/assistants.service.ts b/src/assistants/assistants.service.ts index ad44af2..47613f7 100644 --- a/src/assistants/assistants.service.ts +++ b/src/assistants/assistants.service.ts @@ -41,7 +41,8 @@ import { APIError, APIErrorCode } from '@/errors/error.entity.js'; import { Tool, ToolType } from '@/tools/entities/tool/tool.entity.js'; import { getUpdatedValue } from '@/utils/update.js'; import { createDeleteResponse } from '@/utils/delete.js'; -import { Agent, getDefaultModel } from '@/runs/execution/constants.js'; +import { Agent } from '@/runs/execution/constants.js'; +import { defaultAIProvider } from '@/runs/execution/provider'; export function toDto(assistant: Loaded): AssistantDto { return { @@ -113,7 +114,7 @@ export async function createAssistant({ description: description ?? undefined, metadata, topP: top_p ?? undefined, - model: model ?? getDefaultModel(), + model: model ?? defaultAIProvider.createAssistantBackend().modelId, agent, temperature: temperature ?? undefined, systemPromptOverwrite: system_prompt_overwrite ?? undefined diff --git a/src/chat/chat.service.ts b/src/chat/chat.service.ts index da78c55..0f326b9 100644 --- a/src/chat/chat.service.ts +++ b/src/chat/chat.service.ts @@ -26,11 +26,10 @@ import { import { ChatMessageRole } from './constants'; import { Chat } from './entities/chat.entity'; -import { createChatLLM } from '@/runs/execution/factory'; import { getLogger } from '@/logger'; import { APIError, APIErrorCode } from '@/errors/error.entity'; -import { getDefaultModel } from '@/runs/execution/constants'; import { ORM } from '@/database'; +import { defaultAIProvider } from '@/runs/execution/provider'; const getChatLogger = () => getLogger(); @@ -52,12 +51,12 @@ export function toDto(chat: Loaded): ChatCompletionCreateResponse { } export async function createChatCompletion({ - model = getDefaultModel(), + model, messages, response_format }: ChatCompletionCreateBody): Promise { - const llm = createChatLLM({ model }); - const chat = new Chat({ model, messages, responseFormat: response_format }); + const llm = defaultAIProvider.createChatBackend({ model }); + const chat = new Chat({ model: llm.modelId, messages, responseFormat: response_format }); await ORM.em.persistAndFlush(chat); try { const schema = response_format?.json_schema.schema; diff --git a/src/config.ts b/src/config.ts index 1bfc585..ccb1038 100644 --- a/src/config.ts +++ b/src/config.ts @@ -18,11 +18,10 @@ import 'dotenv/config'; import { difference } from 'remeda'; import { + AIBackend, CodeInterpreterStorageBackend, - LLMBackend, SearchToolBackend } from './runs/execution/constants'; -import { EmbeddingBackend } from './embedding/constants'; import { ExtractionBackend } from './files/extraction/constants'; import { QueueName } from '@/jobs/constants.js'; @@ -81,8 +80,7 @@ export const AUTH_CLIENT_SECRET = getEnv('AUTH_CLIENT_SECRET'); export const AUTH_AUDIENCE = getEnv('AUTH_AUDIENCE'); // Backends -export const LLM_BACKEND = getEnum('LLM_BACKEND', Object.values(LLMBackend)); -export const EMBEDDING_BACKEND = getEnum('EMBEDDING_BACKEND', Object.values(EmbeddingBackend)); +export const AI_BACKEND = getEnum('AI_BACKEND', Object.values(AIBackend)); export const EXTRACTION_BACKEND = getEnum('EXTRACTION_BACKEND', Object.values(ExtractionBackend)); export const OLLAMA_URL = getEnv('OLLAMA_URL', null); diff --git a/src/embedding/adapters/bam-embedding.ts b/src/embedding/adapters/bam-embedding.ts deleted file mode 100644 index f05804f..0000000 --- a/src/embedding/adapters/bam-embedding.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Client } from '@ibm-generative-ai/node-sdk'; -import pLimit from 'p-limit'; -import { chunk } from 'remeda'; - -import { Embedding, EmbeddingOptions } from './embedding'; - -const MAX_EMBEDDING_INPUTS = 20; - -export class BAMEmbedding extends Embedding { - protected static limit = pLimit(5); - - constructor( - public readonly model: string, - public readonly client: Client - ) { - super(model); - } - - async embedMany(texts: string[], options?: EmbeddingOptions): Promise { - const results = await Promise.all( - chunk(texts, MAX_EMBEDDING_INPUTS).map((texts) => - BAMEmbedding.limit(async () => { - const response = await this.client.text.embedding.create( - { - model_id: this.model, - input: texts, - parameters: { - truncate_input_tokens: true - } - }, - { signal: options?.signal } - ); - if (response.results?.length !== texts.length) throw new Error('Missing embedding'); - return response.results.map((result) => result.embedding); - }) - ) - ); - return results.flat(); - } -} diff --git a/src/embedding/adapters/caikit/caikit-embedding.ts b/src/embedding/adapters/caikit/caikit-embedding.ts deleted file mode 100644 index 84ac675..0000000 --- a/src/embedding/adapters/caikit/caikit-embedding.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import pLimit from 'p-limit'; -import { chunk } from 'remeda'; - -import { Embedding, EmbeddingOptions } from '../embedding'; - -import { EmbeddingResults__Output } from './grpc/types/caikit_data_model/caikit_nlp/EmbeddingResults'; -import { createGrpcMetadata } from './grpc/utils/metadata'; -import { wrapGrpcCall } from './grpc/utils/wrappers'; -import { EmbeddingTasksRequest } from './grpc/types/caikit/runtime/Nlp/EmbeddingTasksRequest'; -import { NlpServiceClient } from './grpc/types/caikit/runtime/Nlp/NlpService'; - -const MAX_EMBEDDING_INPUTS = 100; - -export class CaikitEmbedding extends Embedding { - protected static limit = pLimit(5); - - constructor( - public readonly model: string, - public readonly client: NlpServiceClient - ) { - super(model); - } - - async embedMany(texts: string[], options?: EmbeddingOptions): Promise { - const results = await Promise.all( - chunk(texts, MAX_EMBEDDING_INPUTS).map((texts) => - CaikitEmbedding.limit(async () => { - const output = await wrapGrpcCall( - this.client.embeddingTasksPredict.bind(this.client) - )({ texts, truncate_input_tokens: 512 }, createGrpcMetadata({ modelId: this.model }), { - signal: options?.signal - }); - const embeddings = output.results?.vectors.map((vector) => { - const embedding = vector[vector.data]?.values; - if (!embedding) throw new Error('Missing embedding'); - return embedding; - }); - if (embeddings?.length !== texts.length) throw new Error('Missing embedding'); - return embeddings; - }) - ) - ); - return results.flat(); - } -} diff --git a/src/embedding/adapters/caikit/grpc/client.ts b/src/embedding/adapters/caikit/grpc/client.ts deleted file mode 100644 index 94da739..0000000 --- a/src/embedding/adapters/caikit/grpc/client.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import protoLoader from '@grpc/proto-loader'; -import grpc from '@grpc/grpc-js'; -import { createCache, memoryStore } from 'cache-manager'; - -import { ProtoGrpcType as EmbeddingsProtoGentypes } from './types/caikit_runtime_Nlp.js'; -import { buildClient } from './utils/build-client.js'; -import { NlpServiceClient } from './types/caikit/runtime/Nlp/NlpService.js'; -import { GRPC_CLIENT_TTL } from './constants.js'; - -const embeddingsProtoPath = './protos/caikit_runtime_Nlp.proto'; // separate variable to avoid Vite transformation https://vitejs.dev/guide/assets#new-url-url-import-meta-url -const EMBEDDINGS_PROTO_PATH = new URL(embeddingsProtoPath, import.meta.url); - -const packageOptions = { - longs: Number, - enums: String, - arrays: true, - objects: true, - oneofs: true, - keepCase: true, - defaults: true -} as const; - -const embeddingsPackageObject = grpc.loadPackageDefinition( - protoLoader.loadSync([EMBEDDINGS_PROTO_PATH.pathname], { - ...packageOptions - }) -) as unknown as EmbeddingsProtoGentypes; - -const embeddingsCache = createCache( - memoryStore({ - max: 100, - ttl: GRPC_CLIENT_TTL - }) -); -export const createEmbeddingsClient = async (modelId: string): Promise => { - return buildClient({ - cache: embeddingsCache, - modelId, - service: embeddingsPackageObject.caikit.runtime.Nlp.NlpService - }); -}; diff --git a/src/embedding/adapters/caikit/grpc/constants.ts b/src/embedding/adapters/caikit/grpc/constants.ts deleted file mode 100644 index d518063..0000000 --- a/src/embedding/adapters/caikit/grpc/constants.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export const GRPC_CLIENT_TTL = 15 * 60 * 1000; -export const GRPC_CLIENT_SHUTDOWN_TIMEOUT = GRPC_CLIENT_TTL + 5 * 60 * 1000; - -export const GrpcEmbeddingModel = { - BGE_LARGE_EN_V_1_5: 'baai/bge-large-en-v1.5' -} as const; -export type GrpcEmbeddingModel = (typeof GrpcEmbeddingModel)[keyof typeof GrpcEmbeddingModel]; diff --git a/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_caikit_nlp.proto b/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_caikit_nlp.proto deleted file mode 100644 index feda79d..0000000 --- a/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_caikit_nlp.proto +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2024 IBM Corp. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/*------------------------------------------------------------------------------ - * AUTO GENERATED - *----------------------------------------------------------------------------*/ - -syntax = "proto3"; -package caikit_data_model.caikit_nlp; -import "google/protobuf/struct.proto"; -import "caikit_data_model_common.proto"; - - -/*-- MESSAGES ----------------------------------------------------------------*/ - -message EmbeddingResult { - - /*-- fields --*/ - caikit_data_model.common.Vector1D result = 1; - caikit_data_model.common.ProducerId producer_id = 2; - int64 input_token_count = 3; -} - -message EmbeddingResults { - - /*-- fields --*/ - caikit_data_model.common.ListOfVector1D results = 1; - caikit_data_model.common.ProducerId producer_id = 2; - int64 input_token_count = 3; -} - -message ExponentialDecayLengthPenalty { - - /*-- fields --*/ - int64 start_index = 1; - double decay_factor = 2; -} - -message GenerationTrainRecord { - - /*-- fields --*/ - string input = 1; - string output = 2; -} - -message RerankResult { - - /*-- fields --*/ - caikit_data_model.caikit_nlp.RerankScores result = 1; - caikit_data_model.common.ProducerId producer_id = 2; - int64 input_token_count = 3; -} - -message RerankResults { - - /*-- fields --*/ - repeated caikit_data_model.caikit_nlp.RerankScores results = 1; - caikit_data_model.common.ProducerId producer_id = 2; - int64 input_token_count = 3; -} - -message RerankScore { - - /*-- fields --*/ - google.protobuf.Struct document = 1; - int64 index = 2; - double score = 3; - string text = 4; -} - -message RerankScores { - - /*-- fields --*/ - string query = 1; - repeated caikit_data_model.caikit_nlp.RerankScore scores = 2; -} - -message SentenceSimilarityResult { - - /*-- fields --*/ - caikit_data_model.caikit_nlp.SentenceSimilarityScores result = 1; - caikit_data_model.common.ProducerId producer_id = 2; - int64 input_token_count = 3; -} - -message SentenceSimilarityResults { - - /*-- fields --*/ - repeated caikit_data_model.caikit_nlp.SentenceSimilarityScores results = 1; - caikit_data_model.common.ProducerId producer_id = 2; - int64 input_token_count = 3; -} - -message SentenceSimilarityScores { - - /*-- fields --*/ - repeated double scores = 1; -} - -message TuningConfig { - - /*-- fields --*/ - int64 num_virtual_tokens = 1; - string prompt_tuning_init_text = 2; - string prompt_tuning_init_method = 3; - string prompt_tuning_init_source_model = 4; - repeated string output_model_types = 5; -} diff --git a/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_common.proto b/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_common.proto deleted file mode 100644 index b4003b5..0000000 --- a/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_common.proto +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2024 IBM Corp. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/*------------------------------------------------------------------------------ - * AUTO GENERATED - *----------------------------------------------------------------------------*/ - -syntax = "proto3"; -package caikit_data_model.common; - - -/*-- ENUMS -------------------------------------------------------------------*/ - -enum TrainingStatus { - PLACEHOLDER_UNSET = 0; - QUEUED = 1; - RUNNING = 2; - COMPLETED = 3; - CANCELED = 4; - ERRORED = 5; -} - - -/*-- MESSAGES ----------------------------------------------------------------*/ - -message BoolSequence { - - /*-- fields --*/ - repeated bool values = 1; -} - -message ConnectionInfo { - - /*-- nested messages --*/ - - /*-- fields --*/ - string hostname = 1; - optional int64 port = 2; - optional caikit_data_model.common.ConnectionTlsInfo tls = 3; - optional int64 timeout = 4; - map options = 5; -} - -message ConnectionTlsInfo { - - /*-- fields --*/ - optional bool enabled = 1; - optional bool insecure_verify = 2; - optional string ca_file = 3; - optional string cert_file = 4; - optional string key_file = 5; -} - -message Directory { - - /*-- fields --*/ - string dirname = 1; - string extension = 2; -} - -message File { - - /*-- fields --*/ - bytes data = 1; - string filename = 2; - string type = 3; -} - -message FileReference { - - /*-- fields --*/ - string filename = 1; -} - -message FloatSequence { - - /*-- fields --*/ - repeated double values = 1; -} - -message IntSequence { - - /*-- fields --*/ - repeated int64 values = 1; -} - -message ListOfFileReferences { - - /*-- fields --*/ - repeated string files = 1; -} - -message ListOfVector1D { - - /*-- fields --*/ - repeated caikit_data_model.common.Vector1D vectors = 1; -} - -message NpFloat32Sequence { - - /*-- fields --*/ - repeated float values = 1; -} - -message NpFloat64Sequence { - - /*-- fields --*/ - repeated double values = 1; -} - -message ProducerId { - - /*-- fields --*/ - string name = 1; - string version = 2; -} - -message ProducerPriority { - - /*-- fields --*/ - repeated caikit_data_model.common.ProducerId producers = 1; -} - -message PyFloatSequence { - - /*-- fields --*/ - repeated double values = 1; -} - -message S3Base { - - /*-- fields --*/ - string endpoint = 2; - string region = 3; - string bucket = 4; - string accessKey = 5; - string secretKey = 6; - string IAM_id = 7; - string IAM_api_key = 8; -} - -message S3Files { - - /*-- fields --*/ - string endpoint = 2; - string region = 3; - string bucket = 4; - string accessKey = 5; - string secretKey = 6; - string IAM_id = 7; - string IAM_api_key = 8; - repeated string files = 1; -} - -message S3Path { - - /*-- fields --*/ - string endpoint = 2; - string region = 3; - string bucket = 4; - string accessKey = 5; - string secretKey = 6; - string IAM_id = 7; - string IAM_api_key = 8; - string path = 1; -} - -message StrSequence { - - /*-- fields --*/ - repeated string values = 1; -} - -message Vector1D { - - /*-- fields --*/ - - /*-- oneofs --*/ - oneof data { - caikit_data_model.common.PyFloatSequence data_pyfloatsequence = 1; - caikit_data_model.common.NpFloat32Sequence data_npfloat32sequence = 2; - caikit_data_model.common.NpFloat64Sequence data_npfloat64sequence = 3; - } -} diff --git a/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_common_runtime.proto b/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_common_runtime.proto deleted file mode 100644 index 15616a1..0000000 --- a/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_common_runtime.proto +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2024 IBM Corp. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/*------------------------------------------------------------------------------ - * AUTO GENERATED - *----------------------------------------------------------------------------*/ - -syntax = "proto3"; -package caikit_data_model.common.runtime; -import "caikit_data_model_common.proto"; -import "google/protobuf/struct.proto"; - -/*-- MESSAGES ----------------------------------------------------------------*/ - -message ModelInfo { - - /*-- nested messages --*/ - - /*-- fields --*/ - string model_path = 1; - string name = 2; - int64 size = 3; - google.protobuf.Struct metadata = 4; - bool loaded = 7; - string module_id = 5; - map module_metadata = 6; -} - -message ModelInfoRequest { - - /*-- fields --*/ - repeated string model_ids = 1; -} - -message ModelInfoResponse { - - /*-- fields --*/ - repeated caikit_data_model.common.runtime.ModelInfo models = 1; -} - -message RuntimeInfoRequest { -} - -message RuntimeInfoResponse { - - /*-- nested messages --*/ - - /*-- fields --*/ - string runtime_version = 1; - map python_packages = 2; -} diff --git a/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_nlp.proto b/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_nlp.proto deleted file mode 100644 index 132d844..0000000 --- a/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_nlp.proto +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2024 IBM Corp. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/*------------------------------------------------------------------------------ - * AUTO GENERATED - *----------------------------------------------------------------------------*/ - -syntax = "proto3"; -package caikit_data_model.nlp; -import "caikit_data_model_common.proto"; - - -/*-- ENUMS -------------------------------------------------------------------*/ - -enum FinishReason { - NOT_FINISHED = 0; - MAX_TOKENS = 1; - EOS_TOKEN = 2; - CANCELLED = 3; - TIME_LIMIT = 4; - STOP_SEQUENCE = 5; - TOKEN_LIMIT = 6; - ERROR = 7; -} - -enum InputWarningReason { - UNSUITABLE_INPUT = 0; -} - - -/*-- MESSAGES ----------------------------------------------------------------*/ - -message ClassificationResult { - - /*-- fields --*/ - string label = 1; - double score = 2; -} - -message ClassificationResults { - - /*-- fields --*/ - repeated caikit_data_model.nlp.ClassificationResult results = 1; -} - -message ClassificationTrainRecord { - - /*-- fields --*/ - string text = 1; - repeated string labels = 2; -} - -message ClassifiedGeneratedTextResult { - - /*-- fields --*/ - string generated_text = 1; - caikit_data_model.nlp.TextGenTokenClassificationResults token_classification_results = 2; - caikit_data_model.nlp.FinishReason finish_reason = 3; - int64 generated_token_count = 4; - uint64 seed = 5; - int64 input_token_count = 6; - repeated caikit_data_model.nlp.InputWarning warnings = 9; - repeated caikit_data_model.nlp.GeneratedToken tokens = 10; - repeated caikit_data_model.nlp.GeneratedToken input_tokens = 11; -} - -message ClassifiedGeneratedTextStreamResult { - - /*-- fields --*/ - string generated_text = 1; - caikit_data_model.nlp.TextGenTokenClassificationResults token_classification_results = 2; - caikit_data_model.nlp.FinishReason finish_reason = 3; - int64 generated_token_count = 4; - uint64 seed = 5; - int64 input_token_count = 6; - repeated caikit_data_model.nlp.InputWarning warnings = 9; - repeated caikit_data_model.nlp.GeneratedToken tokens = 10; - repeated caikit_data_model.nlp.GeneratedToken input_tokens = 11; - int64 processed_index = 7; - int64 start_index = 8; -} - -message GeneratedTextResult { - - /*-- fields --*/ - string generated_text = 1; - int64 generated_tokens = 2; - caikit_data_model.nlp.FinishReason finish_reason = 3; - caikit_data_model.common.ProducerId producer_id = 4; - int64 input_token_count = 5; - uint64 seed = 6; - repeated caikit_data_model.nlp.GeneratedToken tokens = 7; - repeated caikit_data_model.nlp.GeneratedToken input_tokens = 8; -} - -message GeneratedTextStreamResult { - - /*-- fields --*/ - string generated_text = 1; - repeated caikit_data_model.nlp.GeneratedToken tokens = 2; - caikit_data_model.nlp.TokenStreamDetails details = 3; - caikit_data_model.common.ProducerId producer_id = 4; - repeated caikit_data_model.nlp.GeneratedToken input_tokens = 5; -} - -message GeneratedToken { - - /*-- fields --*/ - string text = 1; - double logprob = 3; -} - -message InputWarning { - - /*-- fields --*/ - caikit_data_model.nlp.InputWarningReason id = 1; - string message = 2; -} - -message TextGenTokenClassificationResults { - - /*-- fields --*/ - repeated caikit_data_model.nlp.TokenClassificationResult input = 10; - repeated caikit_data_model.nlp.TokenClassificationResult output = 20; -} - -message Token { - - /*-- fields --*/ - int64 start = 1; - int64 end = 2; - string text = 3; -} - -message TokenClassificationResult { - - /*-- fields --*/ - int64 start = 1; - int64 end = 2; - string word = 3; - string entity = 4; - string entity_group = 5; - double score = 6; - int64 token_count = 7; -} - -message TokenClassificationResults { - - /*-- fields --*/ - repeated caikit_data_model.nlp.TokenClassificationResult results = 1; -} - -message TokenClassificationStreamResult { - - /*-- fields --*/ - repeated caikit_data_model.nlp.TokenClassificationResult results = 1; - int64 processed_index = 2; - int64 start_index = 3; -} - -message TokenStreamDetails { - - /*-- fields --*/ - caikit_data_model.nlp.FinishReason finish_reason = 1; - uint32 generated_tokens = 2; - uint64 seed = 3; - int64 input_token_count = 4; -} - -message TokenizationResults { - - /*-- fields --*/ - repeated caikit_data_model.nlp.Token results = 1; - int64 token_count = 4; -} - -message TokenizationStreamResult { - - /*-- fields --*/ - repeated caikit_data_model.nlp.Token results = 1; - int64 token_count = 4; - int64 processed_index = 2; - int64 start_index = 3; -} diff --git a/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_runtime.proto b/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_runtime.proto deleted file mode 100644 index 57c7d53..0000000 --- a/src/embedding/adapters/caikit/grpc/protos/caikit_data_model_runtime.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2024 IBM Corp. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/*------------------------------------------------------------------------------ - * AUTO GENERATED - *----------------------------------------------------------------------------*/ - -syntax = "proto3"; -package caikit_data_model.runtime; -import "google/protobuf/timestamp.proto"; -import "caikit_data_model_common.proto"; - - -/*-- MESSAGES ----------------------------------------------------------------*/ - -message ModelPointer { - - /*-- fields --*/ - string model_id = 1; -} - -message TrainingInfoRequest { - - /*-- fields --*/ - string training_id = 1; -} - -message TrainingJob { - - /*-- fields --*/ - string training_id = 1; - string model_name = 2; -} - -message TrainingStatusResponse { - - /*-- fields --*/ - string training_id = 1; - caikit_data_model.common.TrainingStatus state = 2; - google.protobuf.Timestamp submission_timestamp = 3; - google.protobuf.Timestamp completion_timestamp = 4; - repeated string reasons = 5; -} diff --git a/src/embedding/adapters/caikit/grpc/protos/caikit_runtime_Nlp.proto b/src/embedding/adapters/caikit/grpc/protos/caikit_runtime_Nlp.proto deleted file mode 100644 index 02fe48c..0000000 --- a/src/embedding/adapters/caikit/grpc/protos/caikit_runtime_Nlp.proto +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright 2024 IBM Corp. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/*------------------------------------------------------------------------------ - * AUTO GENERATED - *----------------------------------------------------------------------------*/ - -syntax = "proto3"; -package caikit.runtime.Nlp; -import "google/protobuf/struct.proto"; -import "caikit_data_model_caikit_nlp.proto"; -import "caikit_data_model_common.proto"; -import "caikit_data_model_nlp.proto"; -import "caikit_data_model_runtime.proto"; - - -/*-- MESSAGES ----------------------------------------------------------------*/ - -message BidiStreamingTokenClassificationTaskRequest { - - /*-- fields --*/ - string text_stream = 1; - optional double threshold = 2; -} - -message DataStreamSourceGenerationTrainRecord { - - /*-- fields --*/ - - /*-- oneofs --*/ - oneof data_stream { - caikit.runtime.Nlp.DataStreamSourceGenerationTrainRecordJsonData jsondata = 1; - caikit_data_model.common.FileReference file = 2; - caikit_data_model.common.ListOfFileReferences list_of_files = 3; - caikit_data_model.common.Directory directory = 4; - caikit_data_model.common.S3Files s3files = 5; - } -} - -message DataStreamSourceGenerationTrainRecordJsonData { - - /*-- fields --*/ - repeated caikit_data_model.caikit_nlp.GenerationTrainRecord data = 1; -} - -message EmbeddingTaskRequest { - - /*-- fields --*/ - string text = 1; - optional int64 truncate_input_tokens = 2; -} - -message EmbeddingTasksRequest { - - /*-- fields --*/ - repeated string texts = 1; - optional int64 truncate_input_tokens = 2; -} - -message RerankTaskRequest { - - /*-- fields --*/ - string query = 1; - repeated google.protobuf.Struct documents = 2; - optional int64 top_n = 3; - optional int64 truncate_input_tokens = 4; - optional bool return_documents = 5; - optional bool return_query = 6; - optional bool return_text = 7; -} - -message RerankTasksRequest { - - /*-- fields --*/ - repeated string queries = 1; - repeated google.protobuf.Struct documents = 2; - optional int64 top_n = 3; - optional int64 truncate_input_tokens = 4; - optional bool return_documents = 5; - optional bool return_queries = 6; - optional bool return_text = 7; -} - -message SentenceSimilarityTaskRequest { - - /*-- fields --*/ - string source_sentence = 1; - repeated string sentences = 2; - optional int64 truncate_input_tokens = 3; -} - -message SentenceSimilarityTasksRequest { - - /*-- fields --*/ - repeated string source_sentences = 1; - repeated string sentences = 2; - optional int64 truncate_input_tokens = 3; -} - -message ServerStreamingTextGenerationTaskRequest { - - /*-- fields --*/ - string text = 1; - optional int64 max_new_tokens = 2; - optional int64 min_new_tokens = 3; - optional int64 truncate_input_tokens = 4; - optional string decoding_method = 5; - optional int64 top_k = 6; - optional double top_p = 7; - optional double typical_p = 8; - optional double temperature = 9; - optional double repetition_penalty = 10; - optional double max_time = 11; - optional caikit_data_model.caikit_nlp.ExponentialDecayLengthPenalty exponential_decay_length_penalty = 12; - repeated string stop_sequences = 13; - optional uint64 seed = 14; - optional bool preserve_input_text = 15; -} - -message TextClassificationTaskRequest { - - /*-- fields --*/ - string text = 1; -} - -message TextGenerationTaskPeftPromptTuningTrainParameters { - - /*-- fields --*/ - string base_model = 1; - caikit.runtime.Nlp.DataStreamSourceGenerationTrainRecord train_stream = 2; - caikit_data_model.caikit_nlp.TuningConfig tuning_config = 3; - optional caikit.runtime.Nlp.DataStreamSourceGenerationTrainRecord val_stream = 4; - optional string device = 5; - optional string tuning_type = 6; - optional int64 num_epochs = 7; - optional double learning_rate = 8; - optional string verbalizer = 9; - optional int64 batch_size = 10; - optional int64 max_source_length = 11; - optional int64 max_target_length = 12; - optional int64 accumulate_steps = 13; - optional string torch_dtype = 14; - optional bool silence_progress_bars = 15; - optional int64 seed = 16; -} - -message TextGenerationTaskPeftPromptTuningTrainRequest { - - /*-- fields --*/ - string model_name = 1; - caikit_data_model.common.S3Path output_path = 2; - caikit.runtime.Nlp.TextGenerationTaskPeftPromptTuningTrainParameters parameters = 3; -} - -message TextGenerationTaskRequest { - - /*-- fields --*/ - string text = 1; - optional int64 max_new_tokens = 2; - optional int64 min_new_tokens = 3; - optional int64 truncate_input_tokens = 4; - optional string decoding_method = 5; - optional int64 top_k = 6; - optional double top_p = 7; - optional double typical_p = 8; - optional double temperature = 9; - optional double repetition_penalty = 10; - optional double max_time = 11; - optional caikit_data_model.caikit_nlp.ExponentialDecayLengthPenalty exponential_decay_length_penalty = 12; - repeated string stop_sequences = 13; - optional uint64 seed = 14; - optional bool preserve_input_text = 15; -} - -message TextGenerationTaskTextGenerationTrainParameters { - - /*-- fields --*/ - string base_model = 1; - caikit.runtime.Nlp.DataStreamSourceGenerationTrainRecord train_stream = 2; - optional string torch_dtype = 3; - optional int64 max_source_length = 4; - optional int64 max_target_length = 5; - optional int64 batch_size = 6; - optional int64 num_epochs = 7; - optional int64 accumulate_steps = 8; - optional int64 random_seed = 9; - optional double lr = 10; - optional bool use_iterable_dataset = 11; -} - -message TextGenerationTaskTextGenerationTrainRequest { - - /*-- fields --*/ - string model_name = 1; - caikit_data_model.common.S3Path output_path = 2; - caikit.runtime.Nlp.TextGenerationTaskTextGenerationTrainParameters parameters = 3; -} - -message TokenClassificationTaskRequest { - - /*-- fields --*/ - string text = 1; - optional double threshold = 2; -} - -message TokenizationTaskRequest { - - /*-- fields --*/ - string text = 1; -} - - -/*-- SERVICES ----------------------------------------------------------------*/ - -service NlpService { - rpc BidiStreamingTokenClassificationTaskPredict(stream caikit.runtime.Nlp.BidiStreamingTokenClassificationTaskRequest) returns (stream caikit_data_model.nlp.TokenClassificationStreamResult); - rpc EmbeddingTaskPredict(caikit.runtime.Nlp.EmbeddingTaskRequest) returns (caikit_data_model.caikit_nlp.EmbeddingResult); - rpc EmbeddingTasksPredict(caikit.runtime.Nlp.EmbeddingTasksRequest) returns (caikit_data_model.caikit_nlp.EmbeddingResults); - rpc RerankTaskPredict(caikit.runtime.Nlp.RerankTaskRequest) returns (caikit_data_model.caikit_nlp.RerankResult); - rpc RerankTasksPredict(caikit.runtime.Nlp.RerankTasksRequest) returns (caikit_data_model.caikit_nlp.RerankResults); - rpc SentenceSimilarityTaskPredict(caikit.runtime.Nlp.SentenceSimilarityTaskRequest) returns (caikit_data_model.caikit_nlp.SentenceSimilarityResult); - rpc SentenceSimilarityTasksPredict(caikit.runtime.Nlp.SentenceSimilarityTasksRequest) returns (caikit_data_model.caikit_nlp.SentenceSimilarityResults); - rpc ServerStreamingTextGenerationTaskPredict(caikit.runtime.Nlp.ServerStreamingTextGenerationTaskRequest) returns (stream caikit_data_model.nlp.GeneratedTextStreamResult); - rpc TextClassificationTaskPredict(caikit.runtime.Nlp.TextClassificationTaskRequest) returns (caikit_data_model.nlp.ClassificationResults); - rpc TextGenerationTaskPredict(caikit.runtime.Nlp.TextGenerationTaskRequest) returns (caikit_data_model.nlp.GeneratedTextResult); - rpc TokenClassificationTaskPredict(caikit.runtime.Nlp.TokenClassificationTaskRequest) returns (caikit_data_model.nlp.TokenClassificationResults); - rpc TokenizationTaskPredict(caikit.runtime.Nlp.TokenizationTaskRequest) returns (caikit_data_model.nlp.TokenizationResults); -} - -service NlpTrainingService { - rpc TextGenerationTaskPeftPromptTuningTrain(caikit.runtime.Nlp.TextGenerationTaskPeftPromptTuningTrainRequest) returns (caikit_data_model.runtime.TrainingJob); - rpc TextGenerationTaskTextGenerationTrain(caikit.runtime.Nlp.TextGenerationTaskTextGenerationTrainRequest) returns (caikit_data_model.runtime.TrainingJob); -} diff --git a/src/embedding/adapters/caikit/grpc/protos/caikit_runtime_info.proto b/src/embedding/adapters/caikit/grpc/protos/caikit_runtime_info.proto deleted file mode 100644 index 754b48d..0000000 --- a/src/embedding/adapters/caikit/grpc/protos/caikit_runtime_info.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2024 IBM Corp. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -/*------------------------------------------------------------------------------ - * AUTO GENERATED - *----------------------------------------------------------------------------*/ - -syntax = "proto3"; -package caikit.runtime.info; -import "caikit_data_model_common.proto"; -import "caikit_data_model_common_runtime.proto"; - - -/*-- SERVICES ----------------------------------------------------------------*/ - -service InfoService { - rpc GetRuntimeInfo(caikit_data_model.common.runtime.RuntimeInfoRequest) returns (caikit_data_model.common.runtime.RuntimeInfoResponse); - rpc GetModelsInfo(caikit_data_model.common.runtime.ModelInfoRequest) returns (caikit_data_model.common.runtime.ModelInfoResponse); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/BidiStreamingTokenClassificationTaskRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/BidiStreamingTokenClassificationTaskRequest.ts deleted file mode 100644 index 3214aae..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/BidiStreamingTokenClassificationTaskRequest.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - - -export interface BidiStreamingTokenClassificationTaskRequest { - 'text_stream'?: (string); - 'threshold'?: (number | string); - '_threshold'?: "threshold"; -} - -export interface BidiStreamingTokenClassificationTaskRequest__Output { - 'text_stream': (string); - 'threshold'?: (number); - '_threshold': "threshold"; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/DataStreamSourceGenerationTrainRecord.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/DataStreamSourceGenerationTrainRecord.ts deleted file mode 100644 index 4417e64..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/DataStreamSourceGenerationTrainRecord.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { - DataStreamSourceGenerationTrainRecordJsonData as _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecordJsonData, - DataStreamSourceGenerationTrainRecordJsonData__Output as _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecordJsonData__Output -} from './DataStreamSourceGenerationTrainRecordJsonData'; -import type { - FileReference as _caikit_data_model_common_FileReference, - FileReference__Output as _caikit_data_model_common_FileReference__Output -} from '../../../caikit_data_model/common/FileReference'; -import type { - ListOfFileReferences as _caikit_data_model_common_ListOfFileReferences, - ListOfFileReferences__Output as _caikit_data_model_common_ListOfFileReferences__Output -} from '../../../caikit_data_model/common/ListOfFileReferences'; -import type { - Directory as _caikit_data_model_common_Directory, - Directory__Output as _caikit_data_model_common_Directory__Output -} from '../../../caikit_data_model/common/Directory'; -import type { - S3Files as _caikit_data_model_common_S3Files, - S3Files__Output as _caikit_data_model_common_S3Files__Output -} from '../../../caikit_data_model/common/S3Files'; - -export interface DataStreamSourceGenerationTrainRecord { - jsondata?: _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecordJsonData | null; - file?: _caikit_data_model_common_FileReference | null; - list_of_files?: _caikit_data_model_common_ListOfFileReferences | null; - directory?: _caikit_data_model_common_Directory | null; - s3files?: _caikit_data_model_common_S3Files | null; - data_stream?: 'jsondata' | 'file' | 'list_of_files' | 'directory' | 's3files'; -} - -export interface DataStreamSourceGenerationTrainRecord__Output { - jsondata?: _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecordJsonData__Output | null; - file?: _caikit_data_model_common_FileReference__Output | null; - list_of_files?: _caikit_data_model_common_ListOfFileReferences__Output | null; - directory?: _caikit_data_model_common_Directory__Output | null; - s3files?: _caikit_data_model_common_S3Files__Output | null; - data_stream: 'jsondata' | 'file' | 'list_of_files' | 'directory' | 's3files'; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/DataStreamSourceGenerationTrainRecordJsonData.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/DataStreamSourceGenerationTrainRecordJsonData.ts deleted file mode 100644 index ca07998..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/DataStreamSourceGenerationTrainRecordJsonData.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { GenerationTrainRecord as _caikit_data_model_caikit_nlp_GenerationTrainRecord, GenerationTrainRecord__Output as _caikit_data_model_caikit_nlp_GenerationTrainRecord__Output } from '../../../caikit_data_model/caikit_nlp/GenerationTrainRecord'; - -export interface DataStreamSourceGenerationTrainRecordJsonData { - 'data'?: (_caikit_data_model_caikit_nlp_GenerationTrainRecord)[]; -} - -export interface DataStreamSourceGenerationTrainRecordJsonData__Output { - 'data': (_caikit_data_model_caikit_nlp_GenerationTrainRecord__Output)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/EmbeddingTaskRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/EmbeddingTaskRequest.ts deleted file mode 100644 index 9e16440..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/EmbeddingTaskRequest.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { Long } from '@grpc/proto-loader'; - -export interface EmbeddingTaskRequest { - 'text'?: (string); - 'truncate_input_tokens'?: (number | string | Long); - '_truncate_input_tokens'?: "truncate_input_tokens"; -} - -export interface EmbeddingTaskRequest__Output { - 'text': (string); - 'truncate_input_tokens'?: (number); - '_truncate_input_tokens': "truncate_input_tokens"; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/EmbeddingTasksRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/EmbeddingTasksRequest.ts deleted file mode 100644 index 486f632..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/EmbeddingTasksRequest.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { Long } from '@grpc/proto-loader'; - -export interface EmbeddingTasksRequest { - 'texts'?: (string)[]; - 'truncate_input_tokens'?: (number | string | Long); - '_truncate_input_tokens'?: "truncate_input_tokens"; -} - -export interface EmbeddingTasksRequest__Output { - 'texts': (string)[]; - 'truncate_input_tokens'?: (number); - '_truncate_input_tokens': "truncate_input_tokens"; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/NlpService.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/NlpService.ts deleted file mode 100644 index 3090f7c..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/NlpService.ts +++ /dev/null @@ -1,711 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type * as grpc from '@grpc/grpc-js'; -import type { MethodDefinition } from '@grpc/proto-loader'; -import type { - BidiStreamingTokenClassificationTaskRequest as _caikit_runtime_Nlp_BidiStreamingTokenClassificationTaskRequest, - BidiStreamingTokenClassificationTaskRequest__Output as _caikit_runtime_Nlp_BidiStreamingTokenClassificationTaskRequest__Output -} from './BidiStreamingTokenClassificationTaskRequest'; -import type { - ClassificationResults as _caikit_data_model_nlp_ClassificationResults, - ClassificationResults__Output as _caikit_data_model_nlp_ClassificationResults__Output -} from '../../../caikit_data_model/nlp/ClassificationResults'; -import type { - EmbeddingResult as _caikit_data_model_caikit_nlp_EmbeddingResult, - EmbeddingResult__Output as _caikit_data_model_caikit_nlp_EmbeddingResult__Output -} from '../../../caikit_data_model/caikit_nlp/EmbeddingResult'; -import type { - EmbeddingResults as _caikit_data_model_caikit_nlp_EmbeddingResults, - EmbeddingResults__Output as _caikit_data_model_caikit_nlp_EmbeddingResults__Output -} from '../../../caikit_data_model/caikit_nlp/EmbeddingResults'; -import type { - EmbeddingTaskRequest as _caikit_runtime_Nlp_EmbeddingTaskRequest, - EmbeddingTaskRequest__Output as _caikit_runtime_Nlp_EmbeddingTaskRequest__Output -} from './EmbeddingTaskRequest'; -import type { - EmbeddingTasksRequest as _caikit_runtime_Nlp_EmbeddingTasksRequest, - EmbeddingTasksRequest__Output as _caikit_runtime_Nlp_EmbeddingTasksRequest__Output -} from './EmbeddingTasksRequest'; -import type { - GeneratedTextResult as _caikit_data_model_nlp_GeneratedTextResult, - GeneratedTextResult__Output as _caikit_data_model_nlp_GeneratedTextResult__Output -} from '../../../caikit_data_model/nlp/GeneratedTextResult'; -import type { - GeneratedTextStreamResult as _caikit_data_model_nlp_GeneratedTextStreamResult, - GeneratedTextStreamResult__Output as _caikit_data_model_nlp_GeneratedTextStreamResult__Output -} from '../../../caikit_data_model/nlp/GeneratedTextStreamResult'; -import type { - RerankResult as _caikit_data_model_caikit_nlp_RerankResult, - RerankResult__Output as _caikit_data_model_caikit_nlp_RerankResult__Output -} from '../../../caikit_data_model/caikit_nlp/RerankResult'; -import type { - RerankResults as _caikit_data_model_caikit_nlp_RerankResults, - RerankResults__Output as _caikit_data_model_caikit_nlp_RerankResults__Output -} from '../../../caikit_data_model/caikit_nlp/RerankResults'; -import type { - RerankTaskRequest as _caikit_runtime_Nlp_RerankTaskRequest, - RerankTaskRequest__Output as _caikit_runtime_Nlp_RerankTaskRequest__Output -} from './RerankTaskRequest'; -import type { - RerankTasksRequest as _caikit_runtime_Nlp_RerankTasksRequest, - RerankTasksRequest__Output as _caikit_runtime_Nlp_RerankTasksRequest__Output -} from './RerankTasksRequest'; -import type { - SentenceSimilarityResult as _caikit_data_model_caikit_nlp_SentenceSimilarityResult, - SentenceSimilarityResult__Output as _caikit_data_model_caikit_nlp_SentenceSimilarityResult__Output -} from '../../../caikit_data_model/caikit_nlp/SentenceSimilarityResult'; -import type { - SentenceSimilarityResults as _caikit_data_model_caikit_nlp_SentenceSimilarityResults, - SentenceSimilarityResults__Output as _caikit_data_model_caikit_nlp_SentenceSimilarityResults__Output -} from '../../../caikit_data_model/caikit_nlp/SentenceSimilarityResults'; -import type { - SentenceSimilarityTaskRequest as _caikit_runtime_Nlp_SentenceSimilarityTaskRequest, - SentenceSimilarityTaskRequest__Output as _caikit_runtime_Nlp_SentenceSimilarityTaskRequest__Output -} from './SentenceSimilarityTaskRequest'; -import type { - SentenceSimilarityTasksRequest as _caikit_runtime_Nlp_SentenceSimilarityTasksRequest, - SentenceSimilarityTasksRequest__Output as _caikit_runtime_Nlp_SentenceSimilarityTasksRequest__Output -} from './SentenceSimilarityTasksRequest'; -import type { - ServerStreamingTextGenerationTaskRequest as _caikit_runtime_Nlp_ServerStreamingTextGenerationTaskRequest, - ServerStreamingTextGenerationTaskRequest__Output as _caikit_runtime_Nlp_ServerStreamingTextGenerationTaskRequest__Output -} from './ServerStreamingTextGenerationTaskRequest'; -import type { - TextClassificationTaskRequest as _caikit_runtime_Nlp_TextClassificationTaskRequest, - TextClassificationTaskRequest__Output as _caikit_runtime_Nlp_TextClassificationTaskRequest__Output -} from './TextClassificationTaskRequest'; -import type { - TextGenerationTaskRequest as _caikit_runtime_Nlp_TextGenerationTaskRequest, - TextGenerationTaskRequest__Output as _caikit_runtime_Nlp_TextGenerationTaskRequest__Output -} from './TextGenerationTaskRequest'; -import type { - TokenClassificationResults as _caikit_data_model_nlp_TokenClassificationResults, - TokenClassificationResults__Output as _caikit_data_model_nlp_TokenClassificationResults__Output -} from '../../../caikit_data_model/nlp/TokenClassificationResults'; -import type { - TokenClassificationStreamResult as _caikit_data_model_nlp_TokenClassificationStreamResult, - TokenClassificationStreamResult__Output as _caikit_data_model_nlp_TokenClassificationStreamResult__Output -} from '../../../caikit_data_model/nlp/TokenClassificationStreamResult'; -import type { - TokenClassificationTaskRequest as _caikit_runtime_Nlp_TokenClassificationTaskRequest, - TokenClassificationTaskRequest__Output as _caikit_runtime_Nlp_TokenClassificationTaskRequest__Output -} from './TokenClassificationTaskRequest'; -import type { - TokenizationResults as _caikit_data_model_nlp_TokenizationResults, - TokenizationResults__Output as _caikit_data_model_nlp_TokenizationResults__Output -} from '../../../caikit_data_model/nlp/TokenizationResults'; -import type { - TokenizationTaskRequest as _caikit_runtime_Nlp_TokenizationTaskRequest, - TokenizationTaskRequest__Output as _caikit_runtime_Nlp_TokenizationTaskRequest__Output -} from './TokenizationTaskRequest'; - -export interface NlpServiceClient extends grpc.Client { - BidiStreamingTokenClassificationTaskPredict( - metadata: grpc.Metadata, - options?: grpc.CallOptions - ): grpc.ClientDuplexStream< - _caikit_runtime_Nlp_BidiStreamingTokenClassificationTaskRequest, - _caikit_data_model_nlp_TokenClassificationStreamResult__Output - >; - BidiStreamingTokenClassificationTaskPredict( - options?: grpc.CallOptions - ): grpc.ClientDuplexStream< - _caikit_runtime_Nlp_BidiStreamingTokenClassificationTaskRequest, - _caikit_data_model_nlp_TokenClassificationStreamResult__Output - >; - bidiStreamingTokenClassificationTaskPredict( - metadata: grpc.Metadata, - options?: grpc.CallOptions - ): grpc.ClientDuplexStream< - _caikit_runtime_Nlp_BidiStreamingTokenClassificationTaskRequest, - _caikit_data_model_nlp_TokenClassificationStreamResult__Output - >; - bidiStreamingTokenClassificationTaskPredict( - options?: grpc.CallOptions - ): grpc.ClientDuplexStream< - _caikit_runtime_Nlp_BidiStreamingTokenClassificationTaskRequest, - _caikit_data_model_nlp_TokenClassificationStreamResult__Output - >; - - EmbeddingTaskPredict( - argument: _caikit_runtime_Nlp_EmbeddingTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResult__Output> - ): grpc.ClientUnaryCall; - EmbeddingTaskPredict( - argument: _caikit_runtime_Nlp_EmbeddingTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResult__Output> - ): grpc.ClientUnaryCall; - EmbeddingTaskPredict( - argument: _caikit_runtime_Nlp_EmbeddingTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResult__Output> - ): grpc.ClientUnaryCall; - EmbeddingTaskPredict( - argument: _caikit_runtime_Nlp_EmbeddingTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResult__Output> - ): grpc.ClientUnaryCall; - embeddingTaskPredict( - argument: _caikit_runtime_Nlp_EmbeddingTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResult__Output> - ): grpc.ClientUnaryCall; - embeddingTaskPredict( - argument: _caikit_runtime_Nlp_EmbeddingTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResult__Output> - ): grpc.ClientUnaryCall; - embeddingTaskPredict( - argument: _caikit_runtime_Nlp_EmbeddingTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResult__Output> - ): grpc.ClientUnaryCall; - embeddingTaskPredict( - argument: _caikit_runtime_Nlp_EmbeddingTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResult__Output> - ): grpc.ClientUnaryCall; - - EmbeddingTasksPredict( - argument: _caikit_runtime_Nlp_EmbeddingTasksRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResults__Output> - ): grpc.ClientUnaryCall; - EmbeddingTasksPredict( - argument: _caikit_runtime_Nlp_EmbeddingTasksRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResults__Output> - ): grpc.ClientUnaryCall; - EmbeddingTasksPredict( - argument: _caikit_runtime_Nlp_EmbeddingTasksRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResults__Output> - ): grpc.ClientUnaryCall; - EmbeddingTasksPredict( - argument: _caikit_runtime_Nlp_EmbeddingTasksRequest, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResults__Output> - ): grpc.ClientUnaryCall; - embeddingTasksPredict( - argument: _caikit_runtime_Nlp_EmbeddingTasksRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResults__Output> - ): grpc.ClientUnaryCall; - embeddingTasksPredict( - argument: _caikit_runtime_Nlp_EmbeddingTasksRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResults__Output> - ): grpc.ClientUnaryCall; - embeddingTasksPredict( - argument: _caikit_runtime_Nlp_EmbeddingTasksRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResults__Output> - ): grpc.ClientUnaryCall; - embeddingTasksPredict( - argument: _caikit_runtime_Nlp_EmbeddingTasksRequest, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_EmbeddingResults__Output> - ): grpc.ClientUnaryCall; - - RerankTaskPredict( - argument: _caikit_runtime_Nlp_RerankTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResult__Output> - ): grpc.ClientUnaryCall; - RerankTaskPredict( - argument: _caikit_runtime_Nlp_RerankTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResult__Output> - ): grpc.ClientUnaryCall; - RerankTaskPredict( - argument: _caikit_runtime_Nlp_RerankTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResult__Output> - ): grpc.ClientUnaryCall; - RerankTaskPredict( - argument: _caikit_runtime_Nlp_RerankTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResult__Output> - ): grpc.ClientUnaryCall; - rerankTaskPredict( - argument: _caikit_runtime_Nlp_RerankTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResult__Output> - ): grpc.ClientUnaryCall; - rerankTaskPredict( - argument: _caikit_runtime_Nlp_RerankTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResult__Output> - ): grpc.ClientUnaryCall; - rerankTaskPredict( - argument: _caikit_runtime_Nlp_RerankTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResult__Output> - ): grpc.ClientUnaryCall; - rerankTaskPredict( - argument: _caikit_runtime_Nlp_RerankTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResult__Output> - ): grpc.ClientUnaryCall; - - RerankTasksPredict( - argument: _caikit_runtime_Nlp_RerankTasksRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResults__Output> - ): grpc.ClientUnaryCall; - RerankTasksPredict( - argument: _caikit_runtime_Nlp_RerankTasksRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResults__Output> - ): grpc.ClientUnaryCall; - RerankTasksPredict( - argument: _caikit_runtime_Nlp_RerankTasksRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResults__Output> - ): grpc.ClientUnaryCall; - RerankTasksPredict( - argument: _caikit_runtime_Nlp_RerankTasksRequest, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResults__Output> - ): grpc.ClientUnaryCall; - rerankTasksPredict( - argument: _caikit_runtime_Nlp_RerankTasksRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResults__Output> - ): grpc.ClientUnaryCall; - rerankTasksPredict( - argument: _caikit_runtime_Nlp_RerankTasksRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResults__Output> - ): grpc.ClientUnaryCall; - rerankTasksPredict( - argument: _caikit_runtime_Nlp_RerankTasksRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResults__Output> - ): grpc.ClientUnaryCall; - rerankTasksPredict( - argument: _caikit_runtime_Nlp_RerankTasksRequest, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_RerankResults__Output> - ): grpc.ClientUnaryCall; - - SentenceSimilarityTaskPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResult__Output> - ): grpc.ClientUnaryCall; - SentenceSimilarityTaskPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResult__Output> - ): grpc.ClientUnaryCall; - SentenceSimilarityTaskPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResult__Output> - ): grpc.ClientUnaryCall; - SentenceSimilarityTaskPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResult__Output> - ): grpc.ClientUnaryCall; - sentenceSimilarityTaskPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResult__Output> - ): grpc.ClientUnaryCall; - sentenceSimilarityTaskPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResult__Output> - ): grpc.ClientUnaryCall; - sentenceSimilarityTaskPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResult__Output> - ): grpc.ClientUnaryCall; - sentenceSimilarityTaskPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResult__Output> - ): grpc.ClientUnaryCall; - - SentenceSimilarityTasksPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTasksRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResults__Output> - ): grpc.ClientUnaryCall; - SentenceSimilarityTasksPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTasksRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResults__Output> - ): grpc.ClientUnaryCall; - SentenceSimilarityTasksPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTasksRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResults__Output> - ): grpc.ClientUnaryCall; - SentenceSimilarityTasksPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTasksRequest, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResults__Output> - ): grpc.ClientUnaryCall; - sentenceSimilarityTasksPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTasksRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResults__Output> - ): grpc.ClientUnaryCall; - sentenceSimilarityTasksPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTasksRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResults__Output> - ): grpc.ClientUnaryCall; - sentenceSimilarityTasksPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTasksRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResults__Output> - ): grpc.ClientUnaryCall; - sentenceSimilarityTasksPredict( - argument: _caikit_runtime_Nlp_SentenceSimilarityTasksRequest, - callback: grpc.requestCallback<_caikit_data_model_caikit_nlp_SentenceSimilarityResults__Output> - ): grpc.ClientUnaryCall; - - ServerStreamingTextGenerationTaskPredict( - argument: _caikit_runtime_Nlp_ServerStreamingTextGenerationTaskRequest, - metadata: grpc.Metadata, - options?: grpc.CallOptions - ): grpc.ClientReadableStream<_caikit_data_model_nlp_GeneratedTextStreamResult__Output>; - ServerStreamingTextGenerationTaskPredict( - argument: _caikit_runtime_Nlp_ServerStreamingTextGenerationTaskRequest, - options?: grpc.CallOptions - ): grpc.ClientReadableStream<_caikit_data_model_nlp_GeneratedTextStreamResult__Output>; - serverStreamingTextGenerationTaskPredict( - argument: _caikit_runtime_Nlp_ServerStreamingTextGenerationTaskRequest, - metadata: grpc.Metadata, - options?: grpc.CallOptions - ): grpc.ClientReadableStream<_caikit_data_model_nlp_GeneratedTextStreamResult__Output>; - serverStreamingTextGenerationTaskPredict( - argument: _caikit_runtime_Nlp_ServerStreamingTextGenerationTaskRequest, - options?: grpc.CallOptions - ): grpc.ClientReadableStream<_caikit_data_model_nlp_GeneratedTextStreamResult__Output>; - - TextClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TextClassificationTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_ClassificationResults__Output> - ): grpc.ClientUnaryCall; - TextClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TextClassificationTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_nlp_ClassificationResults__Output> - ): grpc.ClientUnaryCall; - TextClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TextClassificationTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_ClassificationResults__Output> - ): grpc.ClientUnaryCall; - TextClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TextClassificationTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_nlp_ClassificationResults__Output> - ): grpc.ClientUnaryCall; - textClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TextClassificationTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_ClassificationResults__Output> - ): grpc.ClientUnaryCall; - textClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TextClassificationTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_nlp_ClassificationResults__Output> - ): grpc.ClientUnaryCall; - textClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TextClassificationTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_ClassificationResults__Output> - ): grpc.ClientUnaryCall; - textClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TextClassificationTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_nlp_ClassificationResults__Output> - ): grpc.ClientUnaryCall; - - TextGenerationTaskPredict( - argument: _caikit_runtime_Nlp_TextGenerationTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_GeneratedTextResult__Output> - ): grpc.ClientUnaryCall; - TextGenerationTaskPredict( - argument: _caikit_runtime_Nlp_TextGenerationTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_nlp_GeneratedTextResult__Output> - ): grpc.ClientUnaryCall; - TextGenerationTaskPredict( - argument: _caikit_runtime_Nlp_TextGenerationTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_GeneratedTextResult__Output> - ): grpc.ClientUnaryCall; - TextGenerationTaskPredict( - argument: _caikit_runtime_Nlp_TextGenerationTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_nlp_GeneratedTextResult__Output> - ): grpc.ClientUnaryCall; - textGenerationTaskPredict( - argument: _caikit_runtime_Nlp_TextGenerationTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_GeneratedTextResult__Output> - ): grpc.ClientUnaryCall; - textGenerationTaskPredict( - argument: _caikit_runtime_Nlp_TextGenerationTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_nlp_GeneratedTextResult__Output> - ): grpc.ClientUnaryCall; - textGenerationTaskPredict( - argument: _caikit_runtime_Nlp_TextGenerationTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_GeneratedTextResult__Output> - ): grpc.ClientUnaryCall; - textGenerationTaskPredict( - argument: _caikit_runtime_Nlp_TextGenerationTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_nlp_GeneratedTextResult__Output> - ): grpc.ClientUnaryCall; - - TokenClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TokenClassificationTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenClassificationResults__Output> - ): grpc.ClientUnaryCall; - TokenClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TokenClassificationTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenClassificationResults__Output> - ): grpc.ClientUnaryCall; - TokenClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TokenClassificationTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenClassificationResults__Output> - ): grpc.ClientUnaryCall; - TokenClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TokenClassificationTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenClassificationResults__Output> - ): grpc.ClientUnaryCall; - tokenClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TokenClassificationTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenClassificationResults__Output> - ): grpc.ClientUnaryCall; - tokenClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TokenClassificationTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenClassificationResults__Output> - ): grpc.ClientUnaryCall; - tokenClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TokenClassificationTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenClassificationResults__Output> - ): grpc.ClientUnaryCall; - tokenClassificationTaskPredict( - argument: _caikit_runtime_Nlp_TokenClassificationTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenClassificationResults__Output> - ): grpc.ClientUnaryCall; - - TokenizationTaskPredict( - argument: _caikit_runtime_Nlp_TokenizationTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenizationResults__Output> - ): grpc.ClientUnaryCall; - TokenizationTaskPredict( - argument: _caikit_runtime_Nlp_TokenizationTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenizationResults__Output> - ): grpc.ClientUnaryCall; - TokenizationTaskPredict( - argument: _caikit_runtime_Nlp_TokenizationTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenizationResults__Output> - ): grpc.ClientUnaryCall; - TokenizationTaskPredict( - argument: _caikit_runtime_Nlp_TokenizationTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenizationResults__Output> - ): grpc.ClientUnaryCall; - tokenizationTaskPredict( - argument: _caikit_runtime_Nlp_TokenizationTaskRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenizationResults__Output> - ): grpc.ClientUnaryCall; - tokenizationTaskPredict( - argument: _caikit_runtime_Nlp_TokenizationTaskRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenizationResults__Output> - ): grpc.ClientUnaryCall; - tokenizationTaskPredict( - argument: _caikit_runtime_Nlp_TokenizationTaskRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenizationResults__Output> - ): grpc.ClientUnaryCall; - tokenizationTaskPredict( - argument: _caikit_runtime_Nlp_TokenizationTaskRequest, - callback: grpc.requestCallback<_caikit_data_model_nlp_TokenizationResults__Output> - ): grpc.ClientUnaryCall; -} - -export interface NlpServiceHandlers extends grpc.UntypedServiceImplementation { - BidiStreamingTokenClassificationTaskPredict: grpc.handleBidiStreamingCall< - _caikit_runtime_Nlp_BidiStreamingTokenClassificationTaskRequest__Output, - _caikit_data_model_nlp_TokenClassificationStreamResult - >; - - EmbeddingTaskPredict: grpc.handleUnaryCall< - _caikit_runtime_Nlp_EmbeddingTaskRequest__Output, - _caikit_data_model_caikit_nlp_EmbeddingResult - >; - - EmbeddingTasksPredict: grpc.handleUnaryCall< - _caikit_runtime_Nlp_EmbeddingTasksRequest__Output, - _caikit_data_model_caikit_nlp_EmbeddingResults - >; - - RerankTaskPredict: grpc.handleUnaryCall< - _caikit_runtime_Nlp_RerankTaskRequest__Output, - _caikit_data_model_caikit_nlp_RerankResult - >; - - RerankTasksPredict: grpc.handleUnaryCall< - _caikit_runtime_Nlp_RerankTasksRequest__Output, - _caikit_data_model_caikit_nlp_RerankResults - >; - - SentenceSimilarityTaskPredict: grpc.handleUnaryCall< - _caikit_runtime_Nlp_SentenceSimilarityTaskRequest__Output, - _caikit_data_model_caikit_nlp_SentenceSimilarityResult - >; - - SentenceSimilarityTasksPredict: grpc.handleUnaryCall< - _caikit_runtime_Nlp_SentenceSimilarityTasksRequest__Output, - _caikit_data_model_caikit_nlp_SentenceSimilarityResults - >; - - ServerStreamingTextGenerationTaskPredict: grpc.handleServerStreamingCall< - _caikit_runtime_Nlp_ServerStreamingTextGenerationTaskRequest__Output, - _caikit_data_model_nlp_GeneratedTextStreamResult - >; - - TextClassificationTaskPredict: grpc.handleUnaryCall< - _caikit_runtime_Nlp_TextClassificationTaskRequest__Output, - _caikit_data_model_nlp_ClassificationResults - >; - - TextGenerationTaskPredict: grpc.handleUnaryCall< - _caikit_runtime_Nlp_TextGenerationTaskRequest__Output, - _caikit_data_model_nlp_GeneratedTextResult - >; - - TokenClassificationTaskPredict: grpc.handleUnaryCall< - _caikit_runtime_Nlp_TokenClassificationTaskRequest__Output, - _caikit_data_model_nlp_TokenClassificationResults - >; - - TokenizationTaskPredict: grpc.handleUnaryCall< - _caikit_runtime_Nlp_TokenizationTaskRequest__Output, - _caikit_data_model_nlp_TokenizationResults - >; -} - -export interface NlpServiceDefinition extends grpc.ServiceDefinition { - BidiStreamingTokenClassificationTaskPredict: MethodDefinition< - _caikit_runtime_Nlp_BidiStreamingTokenClassificationTaskRequest, - _caikit_data_model_nlp_TokenClassificationStreamResult, - _caikit_runtime_Nlp_BidiStreamingTokenClassificationTaskRequest__Output, - _caikit_data_model_nlp_TokenClassificationStreamResult__Output - >; - EmbeddingTaskPredict: MethodDefinition< - _caikit_runtime_Nlp_EmbeddingTaskRequest, - _caikit_data_model_caikit_nlp_EmbeddingResult, - _caikit_runtime_Nlp_EmbeddingTaskRequest__Output, - _caikit_data_model_caikit_nlp_EmbeddingResult__Output - >; - EmbeddingTasksPredict: MethodDefinition< - _caikit_runtime_Nlp_EmbeddingTasksRequest, - _caikit_data_model_caikit_nlp_EmbeddingResults, - _caikit_runtime_Nlp_EmbeddingTasksRequest__Output, - _caikit_data_model_caikit_nlp_EmbeddingResults__Output - >; - RerankTaskPredict: MethodDefinition< - _caikit_runtime_Nlp_RerankTaskRequest, - _caikit_data_model_caikit_nlp_RerankResult, - _caikit_runtime_Nlp_RerankTaskRequest__Output, - _caikit_data_model_caikit_nlp_RerankResult__Output - >; - RerankTasksPredict: MethodDefinition< - _caikit_runtime_Nlp_RerankTasksRequest, - _caikit_data_model_caikit_nlp_RerankResults, - _caikit_runtime_Nlp_RerankTasksRequest__Output, - _caikit_data_model_caikit_nlp_RerankResults__Output - >; - SentenceSimilarityTaskPredict: MethodDefinition< - _caikit_runtime_Nlp_SentenceSimilarityTaskRequest, - _caikit_data_model_caikit_nlp_SentenceSimilarityResult, - _caikit_runtime_Nlp_SentenceSimilarityTaskRequest__Output, - _caikit_data_model_caikit_nlp_SentenceSimilarityResult__Output - >; - SentenceSimilarityTasksPredict: MethodDefinition< - _caikit_runtime_Nlp_SentenceSimilarityTasksRequest, - _caikit_data_model_caikit_nlp_SentenceSimilarityResults, - _caikit_runtime_Nlp_SentenceSimilarityTasksRequest__Output, - _caikit_data_model_caikit_nlp_SentenceSimilarityResults__Output - >; - ServerStreamingTextGenerationTaskPredict: MethodDefinition< - _caikit_runtime_Nlp_ServerStreamingTextGenerationTaskRequest, - _caikit_data_model_nlp_GeneratedTextStreamResult, - _caikit_runtime_Nlp_ServerStreamingTextGenerationTaskRequest__Output, - _caikit_data_model_nlp_GeneratedTextStreamResult__Output - >; - TextClassificationTaskPredict: MethodDefinition< - _caikit_runtime_Nlp_TextClassificationTaskRequest, - _caikit_data_model_nlp_ClassificationResults, - _caikit_runtime_Nlp_TextClassificationTaskRequest__Output, - _caikit_data_model_nlp_ClassificationResults__Output - >; - TextGenerationTaskPredict: MethodDefinition< - _caikit_runtime_Nlp_TextGenerationTaskRequest, - _caikit_data_model_nlp_GeneratedTextResult, - _caikit_runtime_Nlp_TextGenerationTaskRequest__Output, - _caikit_data_model_nlp_GeneratedTextResult__Output - >; - TokenClassificationTaskPredict: MethodDefinition< - _caikit_runtime_Nlp_TokenClassificationTaskRequest, - _caikit_data_model_nlp_TokenClassificationResults, - _caikit_runtime_Nlp_TokenClassificationTaskRequest__Output, - _caikit_data_model_nlp_TokenClassificationResults__Output - >; - TokenizationTaskPredict: MethodDefinition< - _caikit_runtime_Nlp_TokenizationTaskRequest, - _caikit_data_model_nlp_TokenizationResults, - _caikit_runtime_Nlp_TokenizationTaskRequest__Output, - _caikit_data_model_nlp_TokenizationResults__Output - >; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/NlpTrainingService.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/NlpTrainingService.ts deleted file mode 100644 index 40b6723..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/NlpTrainingService.ts +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type * as grpc from '@grpc/grpc-js'; -import type { MethodDefinition } from '@grpc/proto-loader'; -import type { - TextGenerationTaskPeftPromptTuningTrainRequest as _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest, - TextGenerationTaskPeftPromptTuningTrainRequest__Output as _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest__Output -} from './TextGenerationTaskPeftPromptTuningTrainRequest'; -import type { - TextGenerationTaskTextGenerationTrainRequest as _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest, - TextGenerationTaskTextGenerationTrainRequest__Output as _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest__Output -} from './TextGenerationTaskTextGenerationTrainRequest'; -import type { - TrainingJob as _caikit_data_model_runtime_TrainingJob, - TrainingJob__Output as _caikit_data_model_runtime_TrainingJob__Output -} from '../../../caikit_data_model/runtime/TrainingJob'; - -export interface NlpTrainingServiceClient extends grpc.Client { - TextGenerationTaskPeftPromptTuningTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - TextGenerationTaskPeftPromptTuningTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - TextGenerationTaskPeftPromptTuningTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - TextGenerationTaskPeftPromptTuningTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - textGenerationTaskPeftPromptTuningTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - textGenerationTaskPeftPromptTuningTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - textGenerationTaskPeftPromptTuningTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - textGenerationTaskPeftPromptTuningTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - - TextGenerationTaskTextGenerationTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - TextGenerationTaskTextGenerationTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - TextGenerationTaskTextGenerationTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - TextGenerationTaskTextGenerationTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - textGenerationTaskTextGenerationTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest, - metadata: grpc.Metadata, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - textGenerationTaskTextGenerationTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest, - metadata: grpc.Metadata, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - textGenerationTaskTextGenerationTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest, - options: grpc.CallOptions, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; - textGenerationTaskTextGenerationTrain( - argument: _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest, - callback: grpc.requestCallback<_caikit_data_model_runtime_TrainingJob__Output> - ): grpc.ClientUnaryCall; -} - -export interface NlpTrainingServiceHandlers extends grpc.UntypedServiceImplementation { - TextGenerationTaskPeftPromptTuningTrain: grpc.handleUnaryCall< - _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest__Output, - _caikit_data_model_runtime_TrainingJob - >; - - TextGenerationTaskTextGenerationTrain: grpc.handleUnaryCall< - _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest__Output, - _caikit_data_model_runtime_TrainingJob - >; -} - -export interface NlpTrainingServiceDefinition extends grpc.ServiceDefinition { - TextGenerationTaskPeftPromptTuningTrain: MethodDefinition< - _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest, - _caikit_data_model_runtime_TrainingJob, - _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainRequest__Output, - _caikit_data_model_runtime_TrainingJob__Output - >; - TextGenerationTaskTextGenerationTrain: MethodDefinition< - _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest, - _caikit_data_model_runtime_TrainingJob, - _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainRequest__Output, - _caikit_data_model_runtime_TrainingJob__Output - >; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/RerankTaskRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/RerankTaskRequest.ts deleted file mode 100644 index ef76366..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/RerankTaskRequest.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { Struct as _google_protobuf_Struct, Struct__Output as _google_protobuf_Struct__Output } from '../../../google/protobuf/Struct'; -import type { Long } from '@grpc/proto-loader'; - -export interface RerankTaskRequest { - 'query'?: (string); - 'documents'?: (_google_protobuf_Struct)[]; - 'top_n'?: (number | string | Long); - 'truncate_input_tokens'?: (number | string | Long); - 'return_documents'?: (boolean); - 'return_query'?: (boolean); - 'return_text'?: (boolean); - '_top_n'?: "top_n"; - '_truncate_input_tokens'?: "truncate_input_tokens"; - '_return_documents'?: "return_documents"; - '_return_query'?: "return_query"; - '_return_text'?: "return_text"; -} - -export interface RerankTaskRequest__Output { - 'query': (string); - 'documents': (_google_protobuf_Struct__Output)[]; - 'top_n'?: (number); - 'truncate_input_tokens'?: (number); - 'return_documents'?: (boolean); - 'return_query'?: (boolean); - 'return_text'?: (boolean); - '_top_n': "top_n"; - '_truncate_input_tokens': "truncate_input_tokens"; - '_return_documents': "return_documents"; - '_return_query': "return_query"; - '_return_text': "return_text"; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/RerankTasksRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/RerankTasksRequest.ts deleted file mode 100644 index ce780a6..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/RerankTasksRequest.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { Struct as _google_protobuf_Struct, Struct__Output as _google_protobuf_Struct__Output } from '../../../google/protobuf/Struct'; -import type { Long } from '@grpc/proto-loader'; - -export interface RerankTasksRequest { - 'queries'?: (string)[]; - 'documents'?: (_google_protobuf_Struct)[]; - 'top_n'?: (number | string | Long); - 'truncate_input_tokens'?: (number | string | Long); - 'return_documents'?: (boolean); - 'return_queries'?: (boolean); - 'return_text'?: (boolean); - '_top_n'?: "top_n"; - '_truncate_input_tokens'?: "truncate_input_tokens"; - '_return_documents'?: "return_documents"; - '_return_queries'?: "return_queries"; - '_return_text'?: "return_text"; -} - -export interface RerankTasksRequest__Output { - 'queries': (string)[]; - 'documents': (_google_protobuf_Struct__Output)[]; - 'top_n'?: (number); - 'truncate_input_tokens'?: (number); - 'return_documents'?: (boolean); - 'return_queries'?: (boolean); - 'return_text'?: (boolean); - '_top_n': "top_n"; - '_truncate_input_tokens': "truncate_input_tokens"; - '_return_documents': "return_documents"; - '_return_queries': "return_queries"; - '_return_text': "return_text"; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/SentenceSimilarityTaskRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/SentenceSimilarityTaskRequest.ts deleted file mode 100644 index 7926d87..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/SentenceSimilarityTaskRequest.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { Long } from '@grpc/proto-loader'; - -export interface SentenceSimilarityTaskRequest { - 'source_sentence'?: (string); - 'sentences'?: (string)[]; - 'truncate_input_tokens'?: (number | string | Long); - '_truncate_input_tokens'?: "truncate_input_tokens"; -} - -export interface SentenceSimilarityTaskRequest__Output { - 'source_sentence': (string); - 'sentences': (string)[]; - 'truncate_input_tokens'?: (number); - '_truncate_input_tokens': "truncate_input_tokens"; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/SentenceSimilarityTasksRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/SentenceSimilarityTasksRequest.ts deleted file mode 100644 index 97ae70f..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/SentenceSimilarityTasksRequest.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { Long } from '@grpc/proto-loader'; - -export interface SentenceSimilarityTasksRequest { - 'source_sentences'?: (string)[]; - 'sentences'?: (string)[]; - 'truncate_input_tokens'?: (number | string | Long); - '_truncate_input_tokens'?: "truncate_input_tokens"; -} - -export interface SentenceSimilarityTasksRequest__Output { - 'source_sentences': (string)[]; - 'sentences': (string)[]; - 'truncate_input_tokens'?: (number); - '_truncate_input_tokens': "truncate_input_tokens"; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/ServerStreamingTextGenerationTaskRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/ServerStreamingTextGenerationTaskRequest.ts deleted file mode 100644 index 9fd2494..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/ServerStreamingTextGenerationTaskRequest.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { ExponentialDecayLengthPenalty as _caikit_data_model_caikit_nlp_ExponentialDecayLengthPenalty, ExponentialDecayLengthPenalty__Output as _caikit_data_model_caikit_nlp_ExponentialDecayLengthPenalty__Output } from '../../../caikit_data_model/caikit_nlp/ExponentialDecayLengthPenalty'; -import type { Long } from '@grpc/proto-loader'; - -export interface ServerStreamingTextGenerationTaskRequest { - 'text'?: (string); - 'max_new_tokens'?: (number | string | Long); - 'min_new_tokens'?: (number | string | Long); - 'truncate_input_tokens'?: (number | string | Long); - 'decoding_method'?: (string); - 'top_k'?: (number | string | Long); - 'top_p'?: (number | string); - 'typical_p'?: (number | string); - 'temperature'?: (number | string); - 'repetition_penalty'?: (number | string); - 'max_time'?: (number | string); - 'exponential_decay_length_penalty'?: (_caikit_data_model_caikit_nlp_ExponentialDecayLengthPenalty | null); - 'stop_sequences'?: (string)[]; - 'seed'?: (number | string | Long); - 'preserve_input_text'?: (boolean); - '_max_new_tokens'?: "max_new_tokens"; - '_min_new_tokens'?: "min_new_tokens"; - '_truncate_input_tokens'?: "truncate_input_tokens"; - '_decoding_method'?: "decoding_method"; - '_top_k'?: "top_k"; - '_top_p'?: "top_p"; - '_typical_p'?: "typical_p"; - '_temperature'?: "temperature"; - '_repetition_penalty'?: "repetition_penalty"; - '_max_time'?: "max_time"; - '_exponential_decay_length_penalty'?: "exponential_decay_length_penalty"; - '_seed'?: "seed"; - '_preserve_input_text'?: "preserve_input_text"; -} - -export interface ServerStreamingTextGenerationTaskRequest__Output { - 'text': (string); - 'max_new_tokens'?: (number); - 'min_new_tokens'?: (number); - 'truncate_input_tokens'?: (number); - 'decoding_method'?: (string); - 'top_k'?: (number); - 'top_p'?: (number); - 'typical_p'?: (number); - 'temperature'?: (number); - 'repetition_penalty'?: (number); - 'max_time'?: (number); - 'exponential_decay_length_penalty'?: (_caikit_data_model_caikit_nlp_ExponentialDecayLengthPenalty__Output | null); - 'stop_sequences': (string)[]; - 'seed'?: (number); - 'preserve_input_text'?: (boolean); - '_max_new_tokens': "max_new_tokens"; - '_min_new_tokens': "min_new_tokens"; - '_truncate_input_tokens': "truncate_input_tokens"; - '_decoding_method': "decoding_method"; - '_top_k': "top_k"; - '_top_p': "top_p"; - '_typical_p': "typical_p"; - '_temperature': "temperature"; - '_repetition_penalty': "repetition_penalty"; - '_max_time': "max_time"; - '_exponential_decay_length_penalty': "exponential_decay_length_penalty"; - '_seed': "seed"; - '_preserve_input_text': "preserve_input_text"; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextClassificationTaskRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextClassificationTaskRequest.ts deleted file mode 100644 index c898b13..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextClassificationTaskRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - - -export interface TextClassificationTaskRequest { - 'text'?: (string); -} - -export interface TextClassificationTaskRequest__Output { - 'text': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskPeftPromptTuningTrainParameters.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskPeftPromptTuningTrainParameters.ts deleted file mode 100644 index 681343d..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskPeftPromptTuningTrainParameters.ts +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { - DataStreamSourceGenerationTrainRecord as _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecord, - DataStreamSourceGenerationTrainRecord__Output as _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecord__Output -} from './DataStreamSourceGenerationTrainRecord'; -import type { - TuningConfig as _caikit_data_model_caikit_nlp_TuningConfig, - TuningConfig__Output as _caikit_data_model_caikit_nlp_TuningConfig__Output -} from '../../../caikit_data_model/caikit_nlp/TuningConfig'; -import type { Long } from '@grpc/proto-loader'; - -export interface TextGenerationTaskPeftPromptTuningTrainParameters { - base_model?: string; - train_stream?: _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecord | null; - tuning_config?: _caikit_data_model_caikit_nlp_TuningConfig | null; - val_stream?: _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecord | null; - device?: string; - tuning_type?: string; - num_epochs?: number | string | Long; - learning_rate?: number | string; - verbalizer?: string; - batch_size?: number | string | Long; - max_source_length?: number | string | Long; - max_target_length?: number | string | Long; - accumulate_steps?: number | string | Long; - torch_dtype?: string; - silence_progress_bars?: boolean; - seed?: number | string | Long; - _val_stream?: 'val_stream'; - _device?: 'device'; - _tuning_type?: 'tuning_type'; - _num_epochs?: 'num_epochs'; - _learning_rate?: 'learning_rate'; - _verbalizer?: 'verbalizer'; - _batch_size?: 'batch_size'; - _max_source_length?: 'max_source_length'; - _max_target_length?: 'max_target_length'; - _accumulate_steps?: 'accumulate_steps'; - _torch_dtype?: 'torch_dtype'; - _silence_progress_bars?: 'silence_progress_bars'; - _seed?: 'seed'; -} - -export interface TextGenerationTaskPeftPromptTuningTrainParameters__Output { - base_model: string; - train_stream: _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecord__Output | null; - tuning_config: _caikit_data_model_caikit_nlp_TuningConfig__Output | null; - val_stream?: _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecord__Output | null; - device?: string; - tuning_type?: string; - num_epochs?: number; - learning_rate?: number; - verbalizer?: string; - batch_size?: number; - max_source_length?: number; - max_target_length?: number; - accumulate_steps?: number; - torch_dtype?: string; - silence_progress_bars?: boolean; - seed?: number; - _val_stream: 'val_stream'; - _device: 'device'; - _tuning_type: 'tuning_type'; - _num_epochs: 'num_epochs'; - _learning_rate: 'learning_rate'; - _verbalizer: 'verbalizer'; - _batch_size: 'batch_size'; - _max_source_length: 'max_source_length'; - _max_target_length: 'max_target_length'; - _accumulate_steps: 'accumulate_steps'; - _torch_dtype: 'torch_dtype'; - _silence_progress_bars: 'silence_progress_bars'; - _seed: 'seed'; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskPeftPromptTuningTrainRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskPeftPromptTuningTrainRequest.ts deleted file mode 100644 index 783de41..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskPeftPromptTuningTrainRequest.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { - S3Path as _caikit_data_model_common_S3Path, - S3Path__Output as _caikit_data_model_common_S3Path__Output -} from '../../../caikit_data_model/common/S3Path'; -import type { - TextGenerationTaskPeftPromptTuningTrainParameters as _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainParameters, - TextGenerationTaskPeftPromptTuningTrainParameters__Output as _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainParameters__Output -} from './TextGenerationTaskPeftPromptTuningTrainParameters'; - -export interface TextGenerationTaskPeftPromptTuningTrainRequest { - model_name?: string; - output_path?: _caikit_data_model_common_S3Path | null; - parameters?: _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainParameters | null; -} - -export interface TextGenerationTaskPeftPromptTuningTrainRequest__Output { - model_name: string; - output_path: _caikit_data_model_common_S3Path__Output | null; - parameters: _caikit_runtime_Nlp_TextGenerationTaskPeftPromptTuningTrainParameters__Output | null; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskRequest.ts deleted file mode 100644 index 41f7efd..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskRequest.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { ExponentialDecayLengthPenalty as _caikit_data_model_caikit_nlp_ExponentialDecayLengthPenalty, ExponentialDecayLengthPenalty__Output as _caikit_data_model_caikit_nlp_ExponentialDecayLengthPenalty__Output } from '../../../caikit_data_model/caikit_nlp/ExponentialDecayLengthPenalty'; -import type { Long } from '@grpc/proto-loader'; - -export interface TextGenerationTaskRequest { - 'text'?: (string); - 'max_new_tokens'?: (number | string | Long); - 'min_new_tokens'?: (number | string | Long); - 'truncate_input_tokens'?: (number | string | Long); - 'decoding_method'?: (string); - 'top_k'?: (number | string | Long); - 'top_p'?: (number | string); - 'typical_p'?: (number | string); - 'temperature'?: (number | string); - 'repetition_penalty'?: (number | string); - 'max_time'?: (number | string); - 'exponential_decay_length_penalty'?: (_caikit_data_model_caikit_nlp_ExponentialDecayLengthPenalty | null); - 'stop_sequences'?: (string)[]; - 'seed'?: (number | string | Long); - 'preserve_input_text'?: (boolean); - '_max_new_tokens'?: "max_new_tokens"; - '_min_new_tokens'?: "min_new_tokens"; - '_truncate_input_tokens'?: "truncate_input_tokens"; - '_decoding_method'?: "decoding_method"; - '_top_k'?: "top_k"; - '_top_p'?: "top_p"; - '_typical_p'?: "typical_p"; - '_temperature'?: "temperature"; - '_repetition_penalty'?: "repetition_penalty"; - '_max_time'?: "max_time"; - '_exponential_decay_length_penalty'?: "exponential_decay_length_penalty"; - '_seed'?: "seed"; - '_preserve_input_text'?: "preserve_input_text"; -} - -export interface TextGenerationTaskRequest__Output { - 'text': (string); - 'max_new_tokens'?: (number); - 'min_new_tokens'?: (number); - 'truncate_input_tokens'?: (number); - 'decoding_method'?: (string); - 'top_k'?: (number); - 'top_p'?: (number); - 'typical_p'?: (number); - 'temperature'?: (number); - 'repetition_penalty'?: (number); - 'max_time'?: (number); - 'exponential_decay_length_penalty'?: (_caikit_data_model_caikit_nlp_ExponentialDecayLengthPenalty__Output | null); - 'stop_sequences': (string)[]; - 'seed'?: (number); - 'preserve_input_text'?: (boolean); - '_max_new_tokens': "max_new_tokens"; - '_min_new_tokens': "min_new_tokens"; - '_truncate_input_tokens': "truncate_input_tokens"; - '_decoding_method': "decoding_method"; - '_top_k': "top_k"; - '_top_p': "top_p"; - '_typical_p': "typical_p"; - '_temperature': "temperature"; - '_repetition_penalty': "repetition_penalty"; - '_max_time': "max_time"; - '_exponential_decay_length_penalty': "exponential_decay_length_penalty"; - '_seed': "seed"; - '_preserve_input_text': "preserve_input_text"; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskTextGenerationTrainParameters.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskTextGenerationTrainParameters.ts deleted file mode 100644 index 68b1bdb..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskTextGenerationTrainParameters.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { - DataStreamSourceGenerationTrainRecord as _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecord, - DataStreamSourceGenerationTrainRecord__Output as _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecord__Output -} from './DataStreamSourceGenerationTrainRecord'; -import type { Long } from '@grpc/proto-loader'; - -export interface TextGenerationTaskTextGenerationTrainParameters { - base_model?: string; - train_stream?: _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecord | null; - torch_dtype?: string; - max_source_length?: number | string | Long; - max_target_length?: number | string | Long; - batch_size?: number | string | Long; - num_epochs?: number | string | Long; - accumulate_steps?: number | string | Long; - random_seed?: number | string | Long; - lr?: number | string; - use_iterable_dataset?: boolean; - _torch_dtype?: 'torch_dtype'; - _max_source_length?: 'max_source_length'; - _max_target_length?: 'max_target_length'; - _batch_size?: 'batch_size'; - _num_epochs?: 'num_epochs'; - _accumulate_steps?: 'accumulate_steps'; - _random_seed?: 'random_seed'; - _lr?: 'lr'; - _use_iterable_dataset?: 'use_iterable_dataset'; -} - -export interface TextGenerationTaskTextGenerationTrainParameters__Output { - base_model: string; - train_stream: _caikit_runtime_Nlp_DataStreamSourceGenerationTrainRecord__Output | null; - torch_dtype?: string; - max_source_length?: number; - max_target_length?: number; - batch_size?: number; - num_epochs?: number; - accumulate_steps?: number; - random_seed?: number; - lr?: number; - use_iterable_dataset?: boolean; - _torch_dtype: 'torch_dtype'; - _max_source_length: 'max_source_length'; - _max_target_length: 'max_target_length'; - _batch_size: 'batch_size'; - _num_epochs: 'num_epochs'; - _accumulate_steps: 'accumulate_steps'; - _random_seed: 'random_seed'; - _lr: 'lr'; - _use_iterable_dataset: 'use_iterable_dataset'; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskTextGenerationTrainRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskTextGenerationTrainRequest.ts deleted file mode 100644 index 51e875b..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TextGenerationTaskTextGenerationTrainRequest.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - -import type { - S3Path as _caikit_data_model_common_S3Path, - S3Path__Output as _caikit_data_model_common_S3Path__Output -} from '../../../caikit_data_model/common/S3Path'; -import type { - TextGenerationTaskTextGenerationTrainParameters as _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainParameters, - TextGenerationTaskTextGenerationTrainParameters__Output as _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainParameters__Output -} from './TextGenerationTaskTextGenerationTrainParameters'; - -export interface TextGenerationTaskTextGenerationTrainRequest { - model_name?: string; - output_path?: _caikit_data_model_common_S3Path | null; - parameters?: _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainParameters | null; -} - -export interface TextGenerationTaskTextGenerationTrainRequest__Output { - model_name: string; - output_path: _caikit_data_model_common_S3Path__Output | null; - parameters: _caikit_runtime_Nlp_TextGenerationTaskTextGenerationTrainParameters__Output | null; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TokenClassificationTaskRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TokenClassificationTaskRequest.ts deleted file mode 100644 index c270d53..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TokenClassificationTaskRequest.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - - -export interface TokenClassificationTaskRequest { - 'text'?: (string); - 'threshold'?: (number | string); - '_threshold'?: "threshold"; -} - -export interface TokenClassificationTaskRequest__Output { - 'text': (string); - 'threshold'?: (number); - '_threshold': "threshold"; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TokenizationTaskRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TokenizationTaskRequest.ts deleted file mode 100644 index be670ff..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/Nlp/TokenizationTaskRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_Nlp.proto - - -export interface TokenizationTaskRequest { - 'text'?: (string); -} - -export interface TokenizationTaskRequest__Output { - 'text': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/info/InfoService.ts b/src/embedding/adapters/caikit/grpc/types/caikit/runtime/info/InfoService.ts deleted file mode 100644 index 3bec099..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit/runtime/info/InfoService.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_runtime_info.proto - -import type * as grpc from '@grpc/grpc-js' -import type { MethodDefinition } from '@grpc/proto-loader' -import type { ModelInfoRequest as _caikit_data_model_common_runtime_ModelInfoRequest, ModelInfoRequest__Output as _caikit_data_model_common_runtime_ModelInfoRequest__Output } from '../../../caikit_data_model/common/runtime/ModelInfoRequest'; -import type { ModelInfoResponse as _caikit_data_model_common_runtime_ModelInfoResponse, ModelInfoResponse__Output as _caikit_data_model_common_runtime_ModelInfoResponse__Output } from '../../../caikit_data_model/common/runtime/ModelInfoResponse'; -import type { RuntimeInfoRequest as _caikit_data_model_common_runtime_RuntimeInfoRequest, RuntimeInfoRequest__Output as _caikit_data_model_common_runtime_RuntimeInfoRequest__Output } from '../../../caikit_data_model/common/runtime/RuntimeInfoRequest'; -import type { RuntimeInfoResponse as _caikit_data_model_common_runtime_RuntimeInfoResponse, RuntimeInfoResponse__Output as _caikit_data_model_common_runtime_RuntimeInfoResponse__Output } from '../../../caikit_data_model/common/runtime/RuntimeInfoResponse'; - -export interface InfoServiceClient extends grpc.Client { - GetModelsInfo(argument: _caikit_data_model_common_runtime_ModelInfoRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_caikit_data_model_common_runtime_ModelInfoResponse__Output>): grpc.ClientUnaryCall; - GetModelsInfo(argument: _caikit_data_model_common_runtime_ModelInfoRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_caikit_data_model_common_runtime_ModelInfoResponse__Output>): grpc.ClientUnaryCall; - GetModelsInfo(argument: _caikit_data_model_common_runtime_ModelInfoRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_caikit_data_model_common_runtime_ModelInfoResponse__Output>): grpc.ClientUnaryCall; - GetModelsInfo(argument: _caikit_data_model_common_runtime_ModelInfoRequest, callback: grpc.requestCallback<_caikit_data_model_common_runtime_ModelInfoResponse__Output>): grpc.ClientUnaryCall; - getModelsInfo(argument: _caikit_data_model_common_runtime_ModelInfoRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_caikit_data_model_common_runtime_ModelInfoResponse__Output>): grpc.ClientUnaryCall; - getModelsInfo(argument: _caikit_data_model_common_runtime_ModelInfoRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_caikit_data_model_common_runtime_ModelInfoResponse__Output>): grpc.ClientUnaryCall; - getModelsInfo(argument: _caikit_data_model_common_runtime_ModelInfoRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_caikit_data_model_common_runtime_ModelInfoResponse__Output>): grpc.ClientUnaryCall; - getModelsInfo(argument: _caikit_data_model_common_runtime_ModelInfoRequest, callback: grpc.requestCallback<_caikit_data_model_common_runtime_ModelInfoResponse__Output>): grpc.ClientUnaryCall; - - GetRuntimeInfo(argument: _caikit_data_model_common_runtime_RuntimeInfoRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_caikit_data_model_common_runtime_RuntimeInfoResponse__Output>): grpc.ClientUnaryCall; - GetRuntimeInfo(argument: _caikit_data_model_common_runtime_RuntimeInfoRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_caikit_data_model_common_runtime_RuntimeInfoResponse__Output>): grpc.ClientUnaryCall; - GetRuntimeInfo(argument: _caikit_data_model_common_runtime_RuntimeInfoRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_caikit_data_model_common_runtime_RuntimeInfoResponse__Output>): grpc.ClientUnaryCall; - GetRuntimeInfo(argument: _caikit_data_model_common_runtime_RuntimeInfoRequest, callback: grpc.requestCallback<_caikit_data_model_common_runtime_RuntimeInfoResponse__Output>): grpc.ClientUnaryCall; - getRuntimeInfo(argument: _caikit_data_model_common_runtime_RuntimeInfoRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_caikit_data_model_common_runtime_RuntimeInfoResponse__Output>): grpc.ClientUnaryCall; - getRuntimeInfo(argument: _caikit_data_model_common_runtime_RuntimeInfoRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_caikit_data_model_common_runtime_RuntimeInfoResponse__Output>): grpc.ClientUnaryCall; - getRuntimeInfo(argument: _caikit_data_model_common_runtime_RuntimeInfoRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_caikit_data_model_common_runtime_RuntimeInfoResponse__Output>): grpc.ClientUnaryCall; - getRuntimeInfo(argument: _caikit_data_model_common_runtime_RuntimeInfoRequest, callback: grpc.requestCallback<_caikit_data_model_common_runtime_RuntimeInfoResponse__Output>): grpc.ClientUnaryCall; - -} - -export interface InfoServiceHandlers extends grpc.UntypedServiceImplementation { - GetModelsInfo: grpc.handleUnaryCall<_caikit_data_model_common_runtime_ModelInfoRequest__Output, _caikit_data_model_common_runtime_ModelInfoResponse>; - - GetRuntimeInfo: grpc.handleUnaryCall<_caikit_data_model_common_runtime_RuntimeInfoRequest__Output, _caikit_data_model_common_runtime_RuntimeInfoResponse>; - -} - -export interface InfoServiceDefinition extends grpc.ServiceDefinition { - GetModelsInfo: MethodDefinition<_caikit_data_model_common_runtime_ModelInfoRequest, _caikit_data_model_common_runtime_ModelInfoResponse, _caikit_data_model_common_runtime_ModelInfoRequest__Output, _caikit_data_model_common_runtime_ModelInfoResponse__Output> - GetRuntimeInfo: MethodDefinition<_caikit_data_model_common_runtime_RuntimeInfoRequest, _caikit_data_model_common_runtime_RuntimeInfoResponse, _caikit_data_model_common_runtime_RuntimeInfoRequest__Output, _caikit_data_model_common_runtime_RuntimeInfoResponse__Output> -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/EmbeddingResult.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/EmbeddingResult.ts deleted file mode 100644 index 66e7019..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/EmbeddingResult.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_caikit_nlp.proto - -import type { - Vector1D as _caikit_data_model_common_Vector1D, - Vector1D__Output as _caikit_data_model_common_Vector1D__Output -} from '../common/Vector1D'; -import type { - ProducerId as _caikit_data_model_common_ProducerId, - ProducerId__Output as _caikit_data_model_common_ProducerId__Output -} from '../common/ProducerId'; -import type { Long } from '@grpc/proto-loader'; - -export interface EmbeddingResult { - result?: _caikit_data_model_common_Vector1D | null; - producer_id?: _caikit_data_model_common_ProducerId | null; - input_token_count?: number | string | Long; -} - -export interface EmbeddingResult__Output { - result: _caikit_data_model_common_Vector1D__Output | null; - producer_id: _caikit_data_model_common_ProducerId__Output | null; - input_token_count: number; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/EmbeddingResults.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/EmbeddingResults.ts deleted file mode 100644 index 69c689f..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/EmbeddingResults.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_caikit_nlp.proto - -import type { - ListOfVector1D as _caikit_data_model_common_ListOfVector1D, - ListOfVector1D__Output as _caikit_data_model_common_ListOfVector1D__Output -} from '../common/ListOfVector1D'; -import type { - ProducerId as _caikit_data_model_common_ProducerId, - ProducerId__Output as _caikit_data_model_common_ProducerId__Output -} from '../common/ProducerId'; -import type { Long } from '@grpc/proto-loader'; - -export interface EmbeddingResults { - results?: _caikit_data_model_common_ListOfVector1D | null; - producer_id?: _caikit_data_model_common_ProducerId | null; - input_token_count?: number | string | Long; -} - -export interface EmbeddingResults__Output { - results: _caikit_data_model_common_ListOfVector1D__Output | null; - producer_id: _caikit_data_model_common_ProducerId__Output | null; - input_token_count: number; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/ExponentialDecayLengthPenalty.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/ExponentialDecayLengthPenalty.ts deleted file mode 100644 index 2a02b8e..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/ExponentialDecayLengthPenalty.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_caikit_nlp.proto - -import type { Long } from '@grpc/proto-loader'; - -export interface ExponentialDecayLengthPenalty { - 'start_index'?: (number | string | Long); - 'decay_factor'?: (number | string); -} - -export interface ExponentialDecayLengthPenalty__Output { - 'start_index': (number); - 'decay_factor': (number); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/GenerationTrainRecord.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/GenerationTrainRecord.ts deleted file mode 100644 index 6630f99..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/GenerationTrainRecord.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_caikit_nlp.proto - - -export interface GenerationTrainRecord { - 'input'?: (string); - 'output'?: (string); -} - -export interface GenerationTrainRecord__Output { - 'input': (string); - 'output': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankResult.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankResult.ts deleted file mode 100644 index 917fe46..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankResult.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_caikit_nlp.proto - -import type { - RerankScores as _caikit_data_model_caikit_nlp_RerankScores, - RerankScores__Output as _caikit_data_model_caikit_nlp_RerankScores__Output -} from './RerankScores'; -import type { - ProducerId as _caikit_data_model_common_ProducerId, - ProducerId__Output as _caikit_data_model_common_ProducerId__Output -} from '../common/ProducerId'; -import type { Long } from '@grpc/proto-loader'; - -export interface RerankResult { - result?: _caikit_data_model_caikit_nlp_RerankScores | null; - producer_id?: _caikit_data_model_common_ProducerId | null; - input_token_count?: number | string | Long; -} - -export interface RerankResult__Output { - result: _caikit_data_model_caikit_nlp_RerankScores__Output | null; - producer_id: _caikit_data_model_common_ProducerId__Output | null; - input_token_count: number; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankResults.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankResults.ts deleted file mode 100644 index ca890ff..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankResults.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_caikit_nlp.proto - -import type { - RerankScores as _caikit_data_model_caikit_nlp_RerankScores, - RerankScores__Output as _caikit_data_model_caikit_nlp_RerankScores__Output -} from './RerankScores'; -import type { - ProducerId as _caikit_data_model_common_ProducerId, - ProducerId__Output as _caikit_data_model_common_ProducerId__Output -} from '../common/ProducerId'; -import type { Long } from '@grpc/proto-loader'; - -export interface RerankResults { - results?: _caikit_data_model_caikit_nlp_RerankScores[]; - producer_id?: _caikit_data_model_common_ProducerId | null; - input_token_count?: number | string | Long; -} - -export interface RerankResults__Output { - results: _caikit_data_model_caikit_nlp_RerankScores__Output[]; - producer_id: _caikit_data_model_common_ProducerId__Output | null; - input_token_count: number; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankScore.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankScore.ts deleted file mode 100644 index ba8f6de..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankScore.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_caikit_nlp.proto - -import type { Struct as _google_protobuf_Struct, Struct__Output as _google_protobuf_Struct__Output } from '../../google/protobuf/Struct'; -import type { Long } from '@grpc/proto-loader'; - -export interface RerankScore { - 'document'?: (_google_protobuf_Struct | null); - 'index'?: (number | string | Long); - 'score'?: (number | string); - 'text'?: (string); -} - -export interface RerankScore__Output { - 'document': (_google_protobuf_Struct__Output | null); - 'index': (number); - 'score': (number); - 'text': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankScores.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankScores.ts deleted file mode 100644 index aa1a6b7..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/RerankScores.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_caikit_nlp.proto - -import type { - RerankScore as _caikit_data_model_caikit_nlp_RerankScore, - RerankScore__Output as _caikit_data_model_caikit_nlp_RerankScore__Output -} from './RerankScore'; - -export interface RerankScores { - query?: string; - scores?: _caikit_data_model_caikit_nlp_RerankScore[]; -} - -export interface RerankScores__Output { - query: string; - scores: _caikit_data_model_caikit_nlp_RerankScore__Output[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/SentenceSimilarityResult.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/SentenceSimilarityResult.ts deleted file mode 100644 index d91e58c..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/SentenceSimilarityResult.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_caikit_nlp.proto - -import type { - SentenceSimilarityScores as _caikit_data_model_caikit_nlp_SentenceSimilarityScores, - SentenceSimilarityScores__Output as _caikit_data_model_caikit_nlp_SentenceSimilarityScores__Output -} from './SentenceSimilarityScores'; -import type { - ProducerId as _caikit_data_model_common_ProducerId, - ProducerId__Output as _caikit_data_model_common_ProducerId__Output -} from '../common/ProducerId'; -import type { Long } from '@grpc/proto-loader'; - -export interface SentenceSimilarityResult { - result?: _caikit_data_model_caikit_nlp_SentenceSimilarityScores | null; - producer_id?: _caikit_data_model_common_ProducerId | null; - input_token_count?: number | string | Long; -} - -export interface SentenceSimilarityResult__Output { - result: _caikit_data_model_caikit_nlp_SentenceSimilarityScores__Output | null; - producer_id: _caikit_data_model_common_ProducerId__Output | null; - input_token_count: number; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/SentenceSimilarityResults.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/SentenceSimilarityResults.ts deleted file mode 100644 index f0e9024..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/SentenceSimilarityResults.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_caikit_nlp.proto - -import type { - SentenceSimilarityScores as _caikit_data_model_caikit_nlp_SentenceSimilarityScores, - SentenceSimilarityScores__Output as _caikit_data_model_caikit_nlp_SentenceSimilarityScores__Output -} from './SentenceSimilarityScores'; -import type { - ProducerId as _caikit_data_model_common_ProducerId, - ProducerId__Output as _caikit_data_model_common_ProducerId__Output -} from '../common/ProducerId'; -import type { Long } from '@grpc/proto-loader'; - -export interface SentenceSimilarityResults { - results?: _caikit_data_model_caikit_nlp_SentenceSimilarityScores[]; - producer_id?: _caikit_data_model_common_ProducerId | null; - input_token_count?: number | string | Long; -} - -export interface SentenceSimilarityResults__Output { - results: _caikit_data_model_caikit_nlp_SentenceSimilarityScores__Output[]; - producer_id: _caikit_data_model_common_ProducerId__Output | null; - input_token_count: number; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/SentenceSimilarityScores.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/SentenceSimilarityScores.ts deleted file mode 100644 index 0959b61..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/SentenceSimilarityScores.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_caikit_nlp.proto - - -export interface SentenceSimilarityScores { - 'scores'?: (number | string)[]; -} - -export interface SentenceSimilarityScores__Output { - 'scores': (number)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/TuningConfig.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/TuningConfig.ts deleted file mode 100644 index 97cc7ef..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/caikit_nlp/TuningConfig.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_caikit_nlp.proto - -import type { Long } from '@grpc/proto-loader'; - -export interface TuningConfig { - 'num_virtual_tokens'?: (number | string | Long); - 'prompt_tuning_init_text'?: (string); - 'prompt_tuning_init_method'?: (string); - 'prompt_tuning_init_source_model'?: (string); - 'output_model_types'?: (string)[]; -} - -export interface TuningConfig__Output { - 'num_virtual_tokens': (number); - 'prompt_tuning_init_text': (string); - 'prompt_tuning_init_method': (string); - 'prompt_tuning_init_source_model': (string); - 'output_model_types': (string)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/BoolSequence.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/BoolSequence.ts deleted file mode 100644 index 24c8f9e..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/BoolSequence.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface BoolSequence { - 'values'?: (boolean)[]; -} - -export interface BoolSequence__Output { - 'values': (boolean)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ConnectionInfo.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ConnectionInfo.ts deleted file mode 100644 index 3aeabcd..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ConnectionInfo.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - -import type { - ConnectionTlsInfo as _caikit_data_model_common_ConnectionTlsInfo, - ConnectionTlsInfo__Output as _caikit_data_model_common_ConnectionTlsInfo__Output -} from './ConnectionTlsInfo'; -import type { Long } from '@grpc/proto-loader'; - -export interface ConnectionInfo { - hostname?: string; - port?: number | string | Long; - tls?: _caikit_data_model_common_ConnectionTlsInfo | null; - timeout?: number | string | Long; - options?: { [key: string]: string }; - _port?: 'port'; - _tls?: 'tls'; - _timeout?: 'timeout'; -} - -export interface ConnectionInfo__Output { - hostname: string; - port?: number; - tls?: _caikit_data_model_common_ConnectionTlsInfo__Output | null; - timeout?: number; - options: { [key: string]: string }; - _port: 'port'; - _tls: 'tls'; - _timeout: 'timeout'; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ConnectionTlsInfo.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ConnectionTlsInfo.ts deleted file mode 100644 index 7982f92..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ConnectionTlsInfo.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface ConnectionTlsInfo { - 'enabled'?: (boolean); - 'insecure_verify'?: (boolean); - 'ca_file'?: (string); - 'cert_file'?: (string); - 'key_file'?: (string); - '_enabled'?: "enabled"; - '_insecure_verify'?: "insecure_verify"; - '_ca_file'?: "ca_file"; - '_cert_file'?: "cert_file"; - '_key_file'?: "key_file"; -} - -export interface ConnectionTlsInfo__Output { - 'enabled'?: (boolean); - 'insecure_verify'?: (boolean); - 'ca_file'?: (string); - 'cert_file'?: (string); - 'key_file'?: (string); - '_enabled': "enabled"; - '_insecure_verify': "insecure_verify"; - '_ca_file': "ca_file"; - '_cert_file': "cert_file"; - '_key_file': "key_file"; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/Directory.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/Directory.ts deleted file mode 100644 index 7dcaae7..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/Directory.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface Directory { - 'dirname'?: (string); - 'extension'?: (string); -} - -export interface Directory__Output { - 'dirname': (string); - 'extension': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/File.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/File.ts deleted file mode 100644 index 6c3dffb..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/File.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface File { - 'data'?: (Buffer | Uint8Array | string); - 'filename'?: (string); - 'type'?: (string); -} - -export interface File__Output { - 'data': (Buffer); - 'filename': (string); - 'type': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/FileReference.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/FileReference.ts deleted file mode 100644 index e43209d..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/FileReference.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface FileReference { - 'filename'?: (string); -} - -export interface FileReference__Output { - 'filename': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/FloatSequence.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/FloatSequence.ts deleted file mode 100644 index b3b35dd..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/FloatSequence.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface FloatSequence { - 'values'?: (number | string)[]; -} - -export interface FloatSequence__Output { - 'values': (number)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/IntSequence.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/IntSequence.ts deleted file mode 100644 index d82cacb..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/IntSequence.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - -import type { Long } from '@grpc/proto-loader'; - -export interface IntSequence { - 'values'?: (number | string | Long)[]; -} - -export interface IntSequence__Output { - 'values': (number)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ListOfFileReferences.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ListOfFileReferences.ts deleted file mode 100644 index 4b94c7a..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ListOfFileReferences.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface ListOfFileReferences { - 'files'?: (string)[]; -} - -export interface ListOfFileReferences__Output { - 'files': (string)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ListOfVector1D.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ListOfVector1D.ts deleted file mode 100644 index 5244ce9..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ListOfVector1D.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - -import type { - Vector1D as _caikit_data_model_common_Vector1D, - Vector1D__Output as _caikit_data_model_common_Vector1D__Output -} from './Vector1D'; - -export interface ListOfVector1D { - vectors?: _caikit_data_model_common_Vector1D[]; -} - -export interface ListOfVector1D__Output { - vectors: _caikit_data_model_common_Vector1D__Output[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/NpFloat32Sequence.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/NpFloat32Sequence.ts deleted file mode 100644 index d1d1faa..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/NpFloat32Sequence.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface NpFloat32Sequence { - 'values'?: (number | string)[]; -} - -export interface NpFloat32Sequence__Output { - 'values': (number)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/NpFloat64Sequence.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/NpFloat64Sequence.ts deleted file mode 100644 index 9b92837..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/NpFloat64Sequence.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface NpFloat64Sequence { - 'values'?: (number | string)[]; -} - -export interface NpFloat64Sequence__Output { - 'values': (number)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ProducerId.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ProducerId.ts deleted file mode 100644 index 3b60909..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ProducerId.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface ProducerId { - 'name'?: (string); - 'version'?: (string); -} - -export interface ProducerId__Output { - 'name': (string); - 'version': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ProducerPriority.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ProducerPriority.ts deleted file mode 100644 index 27f119e..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/ProducerPriority.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - -import type { - ProducerId as _caikit_data_model_common_ProducerId, - ProducerId__Output as _caikit_data_model_common_ProducerId__Output -} from './ProducerId'; - -export interface ProducerPriority { - producers?: _caikit_data_model_common_ProducerId[]; -} - -export interface ProducerPriority__Output { - producers: _caikit_data_model_common_ProducerId__Output[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/PyFloatSequence.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/PyFloatSequence.ts deleted file mode 100644 index 8b7a885..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/PyFloatSequence.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface PyFloatSequence { - 'values'?: (number | string)[]; -} - -export interface PyFloatSequence__Output { - 'values': (number)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/S3Base.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/S3Base.ts deleted file mode 100644 index 6688974..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/S3Base.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface S3Base { - 'endpoint'?: (string); - 'region'?: (string); - 'bucket'?: (string); - 'accessKey'?: (string); - 'secretKey'?: (string); - 'IAM_id'?: (string); - 'IAM_api_key'?: (string); -} - -export interface S3Base__Output { - 'endpoint': (string); - 'region': (string); - 'bucket': (string); - 'accessKey': (string); - 'secretKey': (string); - 'IAM_id': (string); - 'IAM_api_key': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/S3Files.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/S3Files.ts deleted file mode 100644 index 03cf7e2..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/S3Files.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface S3Files { - 'files'?: (string)[]; - 'endpoint'?: (string); - 'region'?: (string); - 'bucket'?: (string); - 'accessKey'?: (string); - 'secretKey'?: (string); - 'IAM_id'?: (string); - 'IAM_api_key'?: (string); -} - -export interface S3Files__Output { - 'files': (string)[]; - 'endpoint': (string); - 'region': (string); - 'bucket': (string); - 'accessKey': (string); - 'secretKey': (string); - 'IAM_id': (string); - 'IAM_api_key': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/S3Path.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/S3Path.ts deleted file mode 100644 index 6ddb2e8..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/S3Path.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface S3Path { - 'path'?: (string); - 'endpoint'?: (string); - 'region'?: (string); - 'bucket'?: (string); - 'accessKey'?: (string); - 'secretKey'?: (string); - 'IAM_id'?: (string); - 'IAM_api_key'?: (string); -} - -export interface S3Path__Output { - 'path': (string); - 'endpoint': (string); - 'region': (string); - 'bucket': (string); - 'accessKey': (string); - 'secretKey': (string); - 'IAM_id': (string); - 'IAM_api_key': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/StrSequence.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/StrSequence.ts deleted file mode 100644 index 965e453..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/StrSequence.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - - -export interface StrSequence { - 'values'?: (string)[]; -} - -export interface StrSequence__Output { - 'values': (string)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/TrainingStatus.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/TrainingStatus.ts deleted file mode 100644 index 3b713a3..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/TrainingStatus.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - -export const TrainingStatus = { - PLACEHOLDER_UNSET: 'PLACEHOLDER_UNSET', - QUEUED: 'QUEUED', - RUNNING: 'RUNNING', - COMPLETED: 'COMPLETED', - CANCELED: 'CANCELED', - ERRORED: 'ERRORED', -} as const; - -export type TrainingStatus = - | 'PLACEHOLDER_UNSET' - | 0 - | 'QUEUED' - | 1 - | 'RUNNING' - | 2 - | 'COMPLETED' - | 3 - | 'CANCELED' - | 4 - | 'ERRORED' - | 5 - -export type TrainingStatus__Output = typeof TrainingStatus[keyof typeof TrainingStatus] diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/Vector1D.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/Vector1D.ts deleted file mode 100644 index 7e8b299..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/Vector1D.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common.proto - -import type { - PyFloatSequence as _caikit_data_model_common_PyFloatSequence, - PyFloatSequence__Output as _caikit_data_model_common_PyFloatSequence__Output -} from './PyFloatSequence'; -import type { - NpFloat32Sequence as _caikit_data_model_common_NpFloat32Sequence, - NpFloat32Sequence__Output as _caikit_data_model_common_NpFloat32Sequence__Output -} from './NpFloat32Sequence'; -import type { - NpFloat64Sequence as _caikit_data_model_common_NpFloat64Sequence, - NpFloat64Sequence__Output as _caikit_data_model_common_NpFloat64Sequence__Output -} from './NpFloat64Sequence'; - -export interface Vector1D { - data_pyfloatsequence?: _caikit_data_model_common_PyFloatSequence | null; - data_npfloat32sequence?: _caikit_data_model_common_NpFloat32Sequence | null; - data_npfloat64sequence?: _caikit_data_model_common_NpFloat64Sequence | null; - data?: 'data_pyfloatsequence' | 'data_npfloat32sequence' | 'data_npfloat64sequence'; -} - -export interface Vector1D__Output { - data_pyfloatsequence?: _caikit_data_model_common_PyFloatSequence__Output | null; - data_npfloat32sequence?: _caikit_data_model_common_NpFloat32Sequence__Output | null; - data_npfloat64sequence?: _caikit_data_model_common_NpFloat64Sequence__Output | null; - data: 'data_pyfloatsequence' | 'data_npfloat32sequence' | 'data_npfloat64sequence'; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/ModelInfo.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/ModelInfo.ts deleted file mode 100644 index c427419..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/ModelInfo.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common_runtime.proto - -import type { Struct as _google_protobuf_Struct, Struct__Output as _google_protobuf_Struct__Output } from '../../../google/protobuf/Struct'; -import type { Long } from '@grpc/proto-loader'; - -export interface ModelInfo { - 'model_path'?: (string); - 'name'?: (string); - 'size'?: (number | string | Long); - 'metadata'?: (_google_protobuf_Struct | null); - 'module_id'?: (string); - 'module_metadata'?: ({[key: string]: string}); - 'loaded'?: (boolean); -} - -export interface ModelInfo__Output { - 'model_path': (string); - 'name': (string); - 'size': (number); - 'metadata': (_google_protobuf_Struct__Output | null); - 'module_id': (string); - 'module_metadata': ({[key: string]: string}); - 'loaded': (boolean); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/ModelInfoRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/ModelInfoRequest.ts deleted file mode 100644 index bd2aab5..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/ModelInfoRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common_runtime.proto - - -export interface ModelInfoRequest { - 'model_ids'?: (string)[]; -} - -export interface ModelInfoRequest__Output { - 'model_ids': (string)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/ModelInfoResponse.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/ModelInfoResponse.ts deleted file mode 100644 index 609ccd7..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/ModelInfoResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common_runtime.proto - -import type { - ModelInfo as _caikit_data_model_common_runtime_ModelInfo, - ModelInfo__Output as _caikit_data_model_common_runtime_ModelInfo__Output -} from './ModelInfo'; - -export interface ModelInfoResponse { - models?: _caikit_data_model_common_runtime_ModelInfo[]; -} - -export interface ModelInfoResponse__Output { - models: _caikit_data_model_common_runtime_ModelInfo__Output[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/RuntimeInfoRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/RuntimeInfoRequest.ts deleted file mode 100644 index 9963f45..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/RuntimeInfoRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common_runtime.proto - - -export interface RuntimeInfoRequest { -} - -export interface RuntimeInfoRequest__Output { -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/RuntimeInfoResponse.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/RuntimeInfoResponse.ts deleted file mode 100644 index 4a08dd0..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/common/runtime/RuntimeInfoResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_common_runtime.proto - - -export interface RuntimeInfoResponse { - 'runtime_version'?: (string); - 'python_packages'?: ({[key: string]: string}); -} - -export interface RuntimeInfoResponse__Output { - 'runtime_version': (string); - 'python_packages': ({[key: string]: string}); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassificationResult.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassificationResult.ts deleted file mode 100644 index 24862c0..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassificationResult.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - - -export interface ClassificationResult { - 'label'?: (string); - 'score'?: (number | string); -} - -export interface ClassificationResult__Output { - 'label': (string); - 'score': (number); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassificationResults.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassificationResults.ts deleted file mode 100644 index f3f035f..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassificationResults.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { - ClassificationResult as _caikit_data_model_nlp_ClassificationResult, - ClassificationResult__Output as _caikit_data_model_nlp_ClassificationResult__Output -} from './ClassificationResult'; - -export interface ClassificationResults { - results?: _caikit_data_model_nlp_ClassificationResult[]; -} - -export interface ClassificationResults__Output { - results: _caikit_data_model_nlp_ClassificationResult__Output[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassificationTrainRecord.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassificationTrainRecord.ts deleted file mode 100644 index 585e11b..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassificationTrainRecord.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - - -export interface ClassificationTrainRecord { - 'text'?: (string); - 'labels'?: (string)[]; -} - -export interface ClassificationTrainRecord__Output { - 'text': (string); - 'labels': (string)[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassifiedGeneratedTextResult.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassifiedGeneratedTextResult.ts deleted file mode 100644 index fd47044..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassifiedGeneratedTextResult.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { - TextGenTokenClassificationResults as _caikit_data_model_nlp_TextGenTokenClassificationResults, - TextGenTokenClassificationResults__Output as _caikit_data_model_nlp_TextGenTokenClassificationResults__Output -} from './TextGenTokenClassificationResults'; -import type { - FinishReason as _caikit_data_model_nlp_FinishReason, - FinishReason__Output as _caikit_data_model_nlp_FinishReason__Output -} from './FinishReason'; -import type { - InputWarning as _caikit_data_model_nlp_InputWarning, - InputWarning__Output as _caikit_data_model_nlp_InputWarning__Output -} from './InputWarning'; -import type { - GeneratedToken as _caikit_data_model_nlp_GeneratedToken, - GeneratedToken__Output as _caikit_data_model_nlp_GeneratedToken__Output -} from './GeneratedToken'; -import type { Long } from '@grpc/proto-loader'; - -export interface ClassifiedGeneratedTextResult { - generated_text?: string; - token_classification_results?: _caikit_data_model_nlp_TextGenTokenClassificationResults | null; - finish_reason?: _caikit_data_model_nlp_FinishReason; - generated_token_count?: number | string | Long; - seed?: number | string | Long; - input_token_count?: number | string | Long; - warnings?: _caikit_data_model_nlp_InputWarning[]; - tokens?: _caikit_data_model_nlp_GeneratedToken[]; - input_tokens?: _caikit_data_model_nlp_GeneratedToken[]; -} - -export interface ClassifiedGeneratedTextResult__Output { - generated_text: string; - token_classification_results: _caikit_data_model_nlp_TextGenTokenClassificationResults__Output | null; - finish_reason: _caikit_data_model_nlp_FinishReason__Output; - generated_token_count: number; - seed: number; - input_token_count: number; - warnings: _caikit_data_model_nlp_InputWarning__Output[]; - tokens: _caikit_data_model_nlp_GeneratedToken__Output[]; - input_tokens: _caikit_data_model_nlp_GeneratedToken__Output[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassifiedGeneratedTextStreamResult.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassifiedGeneratedTextStreamResult.ts deleted file mode 100644 index 0003c9c..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/ClassifiedGeneratedTextStreamResult.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { - TextGenTokenClassificationResults as _caikit_data_model_nlp_TextGenTokenClassificationResults, - TextGenTokenClassificationResults__Output as _caikit_data_model_nlp_TextGenTokenClassificationResults__Output -} from './TextGenTokenClassificationResults'; -import type { - FinishReason as _caikit_data_model_nlp_FinishReason, - FinishReason__Output as _caikit_data_model_nlp_FinishReason__Output -} from './FinishReason'; -import type { - InputWarning as _caikit_data_model_nlp_InputWarning, - InputWarning__Output as _caikit_data_model_nlp_InputWarning__Output -} from './InputWarning'; -import type { - GeneratedToken as _caikit_data_model_nlp_GeneratedToken, - GeneratedToken__Output as _caikit_data_model_nlp_GeneratedToken__Output -} from './GeneratedToken'; -import type { Long } from '@grpc/proto-loader'; - -export interface ClassifiedGeneratedTextStreamResult { - generated_text?: string; - token_classification_results?: _caikit_data_model_nlp_TextGenTokenClassificationResults | null; - finish_reason?: _caikit_data_model_nlp_FinishReason; - generated_token_count?: number | string | Long; - seed?: number | string | Long; - input_token_count?: number | string | Long; - processed_index?: number | string | Long; - start_index?: number | string | Long; - warnings?: _caikit_data_model_nlp_InputWarning[]; - tokens?: _caikit_data_model_nlp_GeneratedToken[]; - input_tokens?: _caikit_data_model_nlp_GeneratedToken[]; -} - -export interface ClassifiedGeneratedTextStreamResult__Output { - generated_text: string; - token_classification_results: _caikit_data_model_nlp_TextGenTokenClassificationResults__Output | null; - finish_reason: _caikit_data_model_nlp_FinishReason__Output; - generated_token_count: number; - seed: number; - input_token_count: number; - processed_index: number; - start_index: number; - warnings: _caikit_data_model_nlp_InputWarning__Output[]; - tokens: _caikit_data_model_nlp_GeneratedToken__Output[]; - input_tokens: _caikit_data_model_nlp_GeneratedToken__Output[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/FinishReason.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/FinishReason.ts deleted file mode 100644 index 9b2ad6b..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/FinishReason.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -export const FinishReason = { - NOT_FINISHED: 'NOT_FINISHED', - MAX_TOKENS: 'MAX_TOKENS', - EOS_TOKEN: 'EOS_TOKEN', - CANCELLED: 'CANCELLED', - TIME_LIMIT: 'TIME_LIMIT', - STOP_SEQUENCE: 'STOP_SEQUENCE', - TOKEN_LIMIT: 'TOKEN_LIMIT', - ERROR: 'ERROR', -} as const; - -export type FinishReason = - | 'NOT_FINISHED' - | 0 - | 'MAX_TOKENS' - | 1 - | 'EOS_TOKEN' - | 2 - | 'CANCELLED' - | 3 - | 'TIME_LIMIT' - | 4 - | 'STOP_SEQUENCE' - | 5 - | 'TOKEN_LIMIT' - | 6 - | 'ERROR' - | 7 - -export type FinishReason__Output = typeof FinishReason[keyof typeof FinishReason] diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/GeneratedTextResult.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/GeneratedTextResult.ts deleted file mode 100644 index 08406dd..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/GeneratedTextResult.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { - FinishReason as _caikit_data_model_nlp_FinishReason, - FinishReason__Output as _caikit_data_model_nlp_FinishReason__Output -} from './FinishReason'; -import type { - ProducerId as _caikit_data_model_common_ProducerId, - ProducerId__Output as _caikit_data_model_common_ProducerId__Output -} from '../common/ProducerId'; -import type { - GeneratedToken as _caikit_data_model_nlp_GeneratedToken, - GeneratedToken__Output as _caikit_data_model_nlp_GeneratedToken__Output -} from './GeneratedToken'; -import type { Long } from '@grpc/proto-loader'; - -export interface GeneratedTextResult { - generated_text?: string; - generated_tokens?: number | string | Long; - finish_reason?: _caikit_data_model_nlp_FinishReason; - producer_id?: _caikit_data_model_common_ProducerId | null; - input_token_count?: number | string | Long; - seed?: number | string | Long; - tokens?: _caikit_data_model_nlp_GeneratedToken[]; - input_tokens?: _caikit_data_model_nlp_GeneratedToken[]; -} - -export interface GeneratedTextResult__Output { - generated_text: string; - generated_tokens: number; - finish_reason: _caikit_data_model_nlp_FinishReason__Output; - producer_id: _caikit_data_model_common_ProducerId__Output | null; - input_token_count: number; - seed: number; - tokens: _caikit_data_model_nlp_GeneratedToken__Output[]; - input_tokens: _caikit_data_model_nlp_GeneratedToken__Output[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/GeneratedTextStreamResult.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/GeneratedTextStreamResult.ts deleted file mode 100644 index ab1815e..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/GeneratedTextStreamResult.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { - GeneratedToken as _caikit_data_model_nlp_GeneratedToken, - GeneratedToken__Output as _caikit_data_model_nlp_GeneratedToken__Output -} from './GeneratedToken'; -import type { - TokenStreamDetails as _caikit_data_model_nlp_TokenStreamDetails, - TokenStreamDetails__Output as _caikit_data_model_nlp_TokenStreamDetails__Output -} from './TokenStreamDetails'; -import type { - ProducerId as _caikit_data_model_common_ProducerId, - ProducerId__Output as _caikit_data_model_common_ProducerId__Output -} from '../common/ProducerId'; - -export interface GeneratedTextStreamResult { - generated_text?: string; - tokens?: _caikit_data_model_nlp_GeneratedToken[]; - details?: _caikit_data_model_nlp_TokenStreamDetails | null; - producer_id?: _caikit_data_model_common_ProducerId | null; - input_tokens?: _caikit_data_model_nlp_GeneratedToken[]; -} - -export interface GeneratedTextStreamResult__Output { - generated_text: string; - tokens: _caikit_data_model_nlp_GeneratedToken__Output[]; - details: _caikit_data_model_nlp_TokenStreamDetails__Output | null; - producer_id: _caikit_data_model_common_ProducerId__Output | null; - input_tokens: _caikit_data_model_nlp_GeneratedToken__Output[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/GeneratedToken.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/GeneratedToken.ts deleted file mode 100644 index 98ea12c..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/GeneratedToken.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - - -export interface GeneratedToken { - 'text'?: (string); - 'logprob'?: (number | string); -} - -export interface GeneratedToken__Output { - 'text': (string); - 'logprob': (number); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/InputWarning.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/InputWarning.ts deleted file mode 100644 index 14a5274..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/InputWarning.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { - InputWarningReason as _caikit_data_model_nlp_InputWarningReason, - InputWarningReason__Output as _caikit_data_model_nlp_InputWarningReason__Output -} from './InputWarningReason'; - -export interface InputWarning { - id?: _caikit_data_model_nlp_InputWarningReason; - message?: string; -} - -export interface InputWarning__Output { - id: _caikit_data_model_nlp_InputWarningReason__Output; - message: string; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/InputWarningReason.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/InputWarningReason.ts deleted file mode 100644 index 2b61679..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/InputWarningReason.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -export const InputWarningReason = { - UNSUITABLE_INPUT: 'UNSUITABLE_INPUT', -} as const; - -export type InputWarningReason = - | 'UNSUITABLE_INPUT' - | 0 - -export type InputWarningReason__Output = typeof InputWarningReason[keyof typeof InputWarningReason] diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TextGenTokenClassificationResults.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TextGenTokenClassificationResults.ts deleted file mode 100644 index a554bcb..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TextGenTokenClassificationResults.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { - TokenClassificationResult as _caikit_data_model_nlp_TokenClassificationResult, - TokenClassificationResult__Output as _caikit_data_model_nlp_TokenClassificationResult__Output -} from './TokenClassificationResult'; - -export interface TextGenTokenClassificationResults { - input?: _caikit_data_model_nlp_TokenClassificationResult[]; - output?: _caikit_data_model_nlp_TokenClassificationResult[]; -} - -export interface TextGenTokenClassificationResults__Output { - input: _caikit_data_model_nlp_TokenClassificationResult__Output[]; - output: _caikit_data_model_nlp_TokenClassificationResult__Output[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/Token.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/Token.ts deleted file mode 100644 index 0fe5f89..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/Token.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { Long } from '@grpc/proto-loader'; - -export interface Token { - 'start'?: (number | string | Long); - 'end'?: (number | string | Long); - 'text'?: (string); -} - -export interface Token__Output { - 'start': (number); - 'end': (number); - 'text': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenClassificationResult.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenClassificationResult.ts deleted file mode 100644 index 9ec43cb..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenClassificationResult.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { Long } from '@grpc/proto-loader'; - -export interface TokenClassificationResult { - 'start'?: (number | string | Long); - 'end'?: (number | string | Long); - 'word'?: (string); - 'entity'?: (string); - 'entity_group'?: (string); - 'score'?: (number | string); - 'token_count'?: (number | string | Long); -} - -export interface TokenClassificationResult__Output { - 'start': (number); - 'end': (number); - 'word': (string); - 'entity': (string); - 'entity_group': (string); - 'score': (number); - 'token_count': (number); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenClassificationResults.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenClassificationResults.ts deleted file mode 100644 index 75d6271..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenClassificationResults.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { - TokenClassificationResult as _caikit_data_model_nlp_TokenClassificationResult, - TokenClassificationResult__Output as _caikit_data_model_nlp_TokenClassificationResult__Output -} from './TokenClassificationResult'; - -export interface TokenClassificationResults { - results?: _caikit_data_model_nlp_TokenClassificationResult[]; -} - -export interface TokenClassificationResults__Output { - results: _caikit_data_model_nlp_TokenClassificationResult__Output[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenClassificationStreamResult.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenClassificationStreamResult.ts deleted file mode 100644 index 1aed39d..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenClassificationStreamResult.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { - TokenClassificationResult as _caikit_data_model_nlp_TokenClassificationResult, - TokenClassificationResult__Output as _caikit_data_model_nlp_TokenClassificationResult__Output -} from './TokenClassificationResult'; -import type { Long } from '@grpc/proto-loader'; - -export interface TokenClassificationStreamResult { - results?: _caikit_data_model_nlp_TokenClassificationResult[]; - processed_index?: number | string | Long; - start_index?: number | string | Long; -} - -export interface TokenClassificationStreamResult__Output { - results: _caikit_data_model_nlp_TokenClassificationResult__Output[]; - processed_index: number; - start_index: number; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenStreamDetails.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenStreamDetails.ts deleted file mode 100644 index fc8f04f..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenStreamDetails.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { - FinishReason as _caikit_data_model_nlp_FinishReason, - FinishReason__Output as _caikit_data_model_nlp_FinishReason__Output -} from './FinishReason'; -import type { Long } from '@grpc/proto-loader'; - -export interface TokenStreamDetails { - finish_reason?: _caikit_data_model_nlp_FinishReason; - generated_tokens?: number; - seed?: number | string | Long; - input_token_count?: number | string | Long; -} - -export interface TokenStreamDetails__Output { - finish_reason: _caikit_data_model_nlp_FinishReason__Output; - generated_tokens: number; - seed: number; - input_token_count: number; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenizationResults.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenizationResults.ts deleted file mode 100644 index 999e801..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenizationResults.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { - Token as _caikit_data_model_nlp_Token, - Token__Output as _caikit_data_model_nlp_Token__Output -} from './Token'; -import type { Long } from '@grpc/proto-loader'; - -export interface TokenizationResults { - results?: _caikit_data_model_nlp_Token[]; - token_count?: number | string | Long; -} - -export interface TokenizationResults__Output { - results: _caikit_data_model_nlp_Token__Output[]; - token_count: number; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenizationStreamResult.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenizationStreamResult.ts deleted file mode 100644 index 3d51968..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/nlp/TokenizationStreamResult.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_nlp.proto - -import type { - Token as _caikit_data_model_nlp_Token, - Token__Output as _caikit_data_model_nlp_Token__Output -} from './Token'; -import type { Long } from '@grpc/proto-loader'; - -export interface TokenizationStreamResult { - results?: _caikit_data_model_nlp_Token[]; - processed_index?: number | string | Long; - start_index?: number | string | Long; - token_count?: number | string | Long; -} - -export interface TokenizationStreamResult__Output { - results: _caikit_data_model_nlp_Token__Output[]; - processed_index: number; - start_index: number; - token_count: number; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/ModelPointer.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/ModelPointer.ts deleted file mode 100644 index c8f6315..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/ModelPointer.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_runtime.proto - - -export interface ModelPointer { - 'model_id'?: (string); -} - -export interface ModelPointer__Output { - 'model_id': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/TrainingInfoRequest.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/TrainingInfoRequest.ts deleted file mode 100644 index 172be1d..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/TrainingInfoRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_runtime.proto - - -export interface TrainingInfoRequest { - 'training_id'?: (string); -} - -export interface TrainingInfoRequest__Output { - 'training_id': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/TrainingJob.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/TrainingJob.ts deleted file mode 100644 index aef68fb..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/TrainingJob.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_runtime.proto - - -export interface TrainingJob { - 'training_id'?: (string); - 'model_name'?: (string); -} - -export interface TrainingJob__Output { - 'training_id': (string); - 'model_name': (string); -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/TrainingStatusResponse.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/TrainingStatusResponse.ts deleted file mode 100644 index 926855f..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model/runtime/TrainingStatusResponse.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: src/grpc/protos/caikit_data_model_runtime.proto - -import type { - TrainingStatus as _caikit_data_model_common_TrainingStatus, - TrainingStatus__Output as _caikit_data_model_common_TrainingStatus__Output -} from '../common/TrainingStatus'; -import type { - Timestamp as _google_protobuf_Timestamp, - Timestamp__Output as _google_protobuf_Timestamp__Output -} from '../../google/protobuf/Timestamp'; - -export interface TrainingStatusResponse { - training_id?: string; - state?: _caikit_data_model_common_TrainingStatus; - submission_timestamp?: _google_protobuf_Timestamp | null; - completion_timestamp?: _google_protobuf_Timestamp | null; - reasons?: string[]; -} - -export interface TrainingStatusResponse__Output { - training_id: string; - state: _caikit_data_model_common_TrainingStatus__Output; - submission_timestamp: _google_protobuf_Timestamp__Output | null; - completion_timestamp: _google_protobuf_Timestamp__Output | null; - reasons: string[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model_caikit_nlp.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model_caikit_nlp.ts deleted file mode 100644 index 0fd3b6f..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model_caikit_nlp.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type * as grpc from '@grpc/grpc-js'; -import type { EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader'; - - -type SubtypeConstructor any, Subtype> = { - new(...args: ConstructorParameters): Subtype; -}; - -export interface ProtoGrpcType { - caikit_data_model: { - caikit_nlp: { - EmbeddingResult: MessageTypeDefinition - EmbeddingResults: MessageTypeDefinition - ExponentialDecayLengthPenalty: MessageTypeDefinition - GenerationTrainRecord: MessageTypeDefinition - RerankResult: MessageTypeDefinition - RerankResults: MessageTypeDefinition - RerankScore: MessageTypeDefinition - RerankScores: MessageTypeDefinition - SentenceSimilarityResult: MessageTypeDefinition - SentenceSimilarityResults: MessageTypeDefinition - SentenceSimilarityScores: MessageTypeDefinition - TuningConfig: MessageTypeDefinition - } - common: { - BoolSequence: MessageTypeDefinition - ConnectionInfo: MessageTypeDefinition - ConnectionTlsInfo: MessageTypeDefinition - Directory: MessageTypeDefinition - File: MessageTypeDefinition - FileReference: MessageTypeDefinition - FloatSequence: MessageTypeDefinition - IntSequence: MessageTypeDefinition - ListOfFileReferences: MessageTypeDefinition - ListOfVector1D: MessageTypeDefinition - NpFloat32Sequence: MessageTypeDefinition - NpFloat64Sequence: MessageTypeDefinition - ProducerId: MessageTypeDefinition - ProducerPriority: MessageTypeDefinition - PyFloatSequence: MessageTypeDefinition - S3Base: MessageTypeDefinition - S3Files: MessageTypeDefinition - S3Path: MessageTypeDefinition - StrSequence: MessageTypeDefinition - TrainingStatus: EnumTypeDefinition - Vector1D: MessageTypeDefinition - } - } - google: { - protobuf: { - ListValue: MessageTypeDefinition - NullValue: EnumTypeDefinition - Struct: MessageTypeDefinition - Value: MessageTypeDefinition - } - } -} - diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model_common.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model_common.ts deleted file mode 100644 index 2b35135..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model_common.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type * as grpc from '@grpc/grpc-js'; -import type { EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader'; - - -type SubtypeConstructor any, Subtype> = { - new(...args: ConstructorParameters): Subtype; -}; - -export interface ProtoGrpcType { - caikit_data_model: { - common: { - BoolSequence: MessageTypeDefinition - ConnectionInfo: MessageTypeDefinition - ConnectionTlsInfo: MessageTypeDefinition - Directory: MessageTypeDefinition - File: MessageTypeDefinition - FileReference: MessageTypeDefinition - FloatSequence: MessageTypeDefinition - IntSequence: MessageTypeDefinition - ListOfFileReferences: MessageTypeDefinition - ListOfVector1D: MessageTypeDefinition - NpFloat32Sequence: MessageTypeDefinition - NpFloat64Sequence: MessageTypeDefinition - ProducerId: MessageTypeDefinition - ProducerPriority: MessageTypeDefinition - PyFloatSequence: MessageTypeDefinition - S3Base: MessageTypeDefinition - S3Files: MessageTypeDefinition - S3Path: MessageTypeDefinition - StrSequence: MessageTypeDefinition - TrainingStatus: EnumTypeDefinition - Vector1D: MessageTypeDefinition - } - } -} - diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model_common_runtime.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model_common_runtime.ts deleted file mode 100644 index 4ddfe12..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model_common_runtime.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type * as grpc from '@grpc/grpc-js'; -import type { EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader'; - - -type SubtypeConstructor any, Subtype> = { - new(...args: ConstructorParameters): Subtype; -}; - -export interface ProtoGrpcType { - caikit_data_model: { - common: { - BoolSequence: MessageTypeDefinition - ConnectionInfo: MessageTypeDefinition - ConnectionTlsInfo: MessageTypeDefinition - Directory: MessageTypeDefinition - File: MessageTypeDefinition - FileReference: MessageTypeDefinition - FloatSequence: MessageTypeDefinition - IntSequence: MessageTypeDefinition - ListOfFileReferences: MessageTypeDefinition - ListOfVector1D: MessageTypeDefinition - NpFloat32Sequence: MessageTypeDefinition - NpFloat64Sequence: MessageTypeDefinition - ProducerId: MessageTypeDefinition - ProducerPriority: MessageTypeDefinition - PyFloatSequence: MessageTypeDefinition - S3Base: MessageTypeDefinition - S3Files: MessageTypeDefinition - S3Path: MessageTypeDefinition - StrSequence: MessageTypeDefinition - TrainingStatus: EnumTypeDefinition - Vector1D: MessageTypeDefinition - runtime: { - ModelInfo: MessageTypeDefinition - ModelInfoRequest: MessageTypeDefinition - ModelInfoResponse: MessageTypeDefinition - RuntimeInfoRequest: MessageTypeDefinition - RuntimeInfoResponse: MessageTypeDefinition - } - } - } - google: { - protobuf: { - ListValue: MessageTypeDefinition - NullValue: EnumTypeDefinition - Struct: MessageTypeDefinition - Value: MessageTypeDefinition - } - } -} - diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model_nlp.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model_nlp.ts deleted file mode 100644 index 8166579..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model_nlp.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type * as grpc from '@grpc/grpc-js'; -import type { EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader'; - - -type SubtypeConstructor any, Subtype> = { - new(...args: ConstructorParameters): Subtype; -}; - -export interface ProtoGrpcType { - caikit_data_model: { - common: { - BoolSequence: MessageTypeDefinition - ConnectionInfo: MessageTypeDefinition - ConnectionTlsInfo: MessageTypeDefinition - Directory: MessageTypeDefinition - File: MessageTypeDefinition - FileReference: MessageTypeDefinition - FloatSequence: MessageTypeDefinition - IntSequence: MessageTypeDefinition - ListOfFileReferences: MessageTypeDefinition - ListOfVector1D: MessageTypeDefinition - NpFloat32Sequence: MessageTypeDefinition - NpFloat64Sequence: MessageTypeDefinition - ProducerId: MessageTypeDefinition - ProducerPriority: MessageTypeDefinition - PyFloatSequence: MessageTypeDefinition - S3Base: MessageTypeDefinition - S3Files: MessageTypeDefinition - S3Path: MessageTypeDefinition - StrSequence: MessageTypeDefinition - TrainingStatus: EnumTypeDefinition - Vector1D: MessageTypeDefinition - } - nlp: { - ClassificationResult: MessageTypeDefinition - ClassificationResults: MessageTypeDefinition - ClassificationTrainRecord: MessageTypeDefinition - ClassifiedGeneratedTextResult: MessageTypeDefinition - ClassifiedGeneratedTextStreamResult: MessageTypeDefinition - FinishReason: EnumTypeDefinition - GeneratedTextResult: MessageTypeDefinition - GeneratedTextStreamResult: MessageTypeDefinition - GeneratedToken: MessageTypeDefinition - InputWarning: MessageTypeDefinition - InputWarningReason: EnumTypeDefinition - TextGenTokenClassificationResults: MessageTypeDefinition - Token: MessageTypeDefinition - TokenClassificationResult: MessageTypeDefinition - TokenClassificationResults: MessageTypeDefinition - TokenClassificationStreamResult: MessageTypeDefinition - TokenStreamDetails: MessageTypeDefinition - TokenizationResults: MessageTypeDefinition - TokenizationStreamResult: MessageTypeDefinition - } - } -} - diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_data_model_runtime.ts b/src/embedding/adapters/caikit/grpc/types/caikit_data_model_runtime.ts deleted file mode 100644 index 7474cd7..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_data_model_runtime.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type * as grpc from '@grpc/grpc-js'; -import type { EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader'; - - -type SubtypeConstructor any, Subtype> = { - new(...args: ConstructorParameters): Subtype; -}; - -export interface ProtoGrpcType { - caikit_data_model: { - common: { - BoolSequence: MessageTypeDefinition - ConnectionInfo: MessageTypeDefinition - ConnectionTlsInfo: MessageTypeDefinition - Directory: MessageTypeDefinition - File: MessageTypeDefinition - FileReference: MessageTypeDefinition - FloatSequence: MessageTypeDefinition - IntSequence: MessageTypeDefinition - ListOfFileReferences: MessageTypeDefinition - ListOfVector1D: MessageTypeDefinition - NpFloat32Sequence: MessageTypeDefinition - NpFloat64Sequence: MessageTypeDefinition - ProducerId: MessageTypeDefinition - ProducerPriority: MessageTypeDefinition - PyFloatSequence: MessageTypeDefinition - S3Base: MessageTypeDefinition - S3Files: MessageTypeDefinition - S3Path: MessageTypeDefinition - StrSequence: MessageTypeDefinition - TrainingStatus: EnumTypeDefinition - Vector1D: MessageTypeDefinition - } - runtime: { - ModelPointer: MessageTypeDefinition - TrainingInfoRequest: MessageTypeDefinition - TrainingJob: MessageTypeDefinition - TrainingStatusResponse: MessageTypeDefinition - } - } - google: { - protobuf: { - Timestamp: MessageTypeDefinition - } - } -} - diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_runtime_Nlp.ts b/src/embedding/adapters/caikit/grpc/types/caikit_runtime_Nlp.ts deleted file mode 100644 index a09cd21..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_runtime_Nlp.ts +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type * as grpc from '@grpc/grpc-js'; -import type { EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader'; - -import type { NlpServiceClient as _caikit_runtime_Nlp_NlpServiceClient, NlpServiceDefinition as _caikit_runtime_Nlp_NlpServiceDefinition } from './caikit/runtime/Nlp/NlpService'; -import type { NlpTrainingServiceClient as _caikit_runtime_Nlp_NlpTrainingServiceClient, NlpTrainingServiceDefinition as _caikit_runtime_Nlp_NlpTrainingServiceDefinition } from './caikit/runtime/Nlp/NlpTrainingService'; - -type SubtypeConstructor any, Subtype> = { - new(...args: ConstructorParameters): Subtype; -}; - -export interface ProtoGrpcType { - caikit: { - runtime: { - Nlp: { - BidiStreamingTokenClassificationTaskRequest: MessageTypeDefinition - DataStreamSourceGenerationTrainRecord: MessageTypeDefinition - DataStreamSourceGenerationTrainRecordJsonData: MessageTypeDefinition - EmbeddingTaskRequest: MessageTypeDefinition - EmbeddingTasksRequest: MessageTypeDefinition - NlpService: SubtypeConstructor & { service: _caikit_runtime_Nlp_NlpServiceDefinition } - NlpTrainingService: SubtypeConstructor & { service: _caikit_runtime_Nlp_NlpTrainingServiceDefinition } - RerankTaskRequest: MessageTypeDefinition - RerankTasksRequest: MessageTypeDefinition - SentenceSimilarityTaskRequest: MessageTypeDefinition - SentenceSimilarityTasksRequest: MessageTypeDefinition - ServerStreamingTextGenerationTaskRequest: MessageTypeDefinition - TextClassificationTaskRequest: MessageTypeDefinition - TextGenerationTaskPeftPromptTuningTrainParameters: MessageTypeDefinition - TextGenerationTaskPeftPromptTuningTrainRequest: MessageTypeDefinition - TextGenerationTaskRequest: MessageTypeDefinition - TextGenerationTaskTextGenerationTrainParameters: MessageTypeDefinition - TextGenerationTaskTextGenerationTrainRequest: MessageTypeDefinition - TokenClassificationTaskRequest: MessageTypeDefinition - TokenizationTaskRequest: MessageTypeDefinition - } - } - } - caikit_data_model: { - caikit_nlp: { - EmbeddingResult: MessageTypeDefinition - EmbeddingResults: MessageTypeDefinition - ExponentialDecayLengthPenalty: MessageTypeDefinition - GenerationTrainRecord: MessageTypeDefinition - RerankResult: MessageTypeDefinition - RerankResults: MessageTypeDefinition - RerankScore: MessageTypeDefinition - RerankScores: MessageTypeDefinition - SentenceSimilarityResult: MessageTypeDefinition - SentenceSimilarityResults: MessageTypeDefinition - SentenceSimilarityScores: MessageTypeDefinition - TuningConfig: MessageTypeDefinition - } - common: { - BoolSequence: MessageTypeDefinition - ConnectionInfo: MessageTypeDefinition - ConnectionTlsInfo: MessageTypeDefinition - Directory: MessageTypeDefinition - File: MessageTypeDefinition - FileReference: MessageTypeDefinition - FloatSequence: MessageTypeDefinition - IntSequence: MessageTypeDefinition - ListOfFileReferences: MessageTypeDefinition - ListOfVector1D: MessageTypeDefinition - NpFloat32Sequence: MessageTypeDefinition - NpFloat64Sequence: MessageTypeDefinition - ProducerId: MessageTypeDefinition - ProducerPriority: MessageTypeDefinition - PyFloatSequence: MessageTypeDefinition - S3Base: MessageTypeDefinition - S3Files: MessageTypeDefinition - S3Path: MessageTypeDefinition - StrSequence: MessageTypeDefinition - TrainingStatus: EnumTypeDefinition - Vector1D: MessageTypeDefinition - } - nlp: { - ClassificationResult: MessageTypeDefinition - ClassificationResults: MessageTypeDefinition - ClassificationTrainRecord: MessageTypeDefinition - ClassifiedGeneratedTextResult: MessageTypeDefinition - ClassifiedGeneratedTextStreamResult: MessageTypeDefinition - FinishReason: EnumTypeDefinition - GeneratedTextResult: MessageTypeDefinition - GeneratedTextStreamResult: MessageTypeDefinition - GeneratedToken: MessageTypeDefinition - InputWarning: MessageTypeDefinition - InputWarningReason: EnumTypeDefinition - TextGenTokenClassificationResults: MessageTypeDefinition - Token: MessageTypeDefinition - TokenClassificationResult: MessageTypeDefinition - TokenClassificationResults: MessageTypeDefinition - TokenClassificationStreamResult: MessageTypeDefinition - TokenStreamDetails: MessageTypeDefinition - TokenizationResults: MessageTypeDefinition - TokenizationStreamResult: MessageTypeDefinition - } - runtime: { - ModelPointer: MessageTypeDefinition - TrainingInfoRequest: MessageTypeDefinition - TrainingJob: MessageTypeDefinition - TrainingStatusResponse: MessageTypeDefinition - } - } - google: { - protobuf: { - ListValue: MessageTypeDefinition - NullValue: EnumTypeDefinition - Struct: MessageTypeDefinition - Timestamp: MessageTypeDefinition - Value: MessageTypeDefinition - } - } -} - diff --git a/src/embedding/adapters/caikit/grpc/types/caikit_runtime_info.ts b/src/embedding/adapters/caikit/grpc/types/caikit_runtime_info.ts deleted file mode 100644 index 57830c8..0000000 --- a/src/embedding/adapters/caikit/grpc/types/caikit_runtime_info.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type * as grpc from '@grpc/grpc-js'; -import type { EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader'; - -import type { InfoServiceClient as _caikit_runtime_info_InfoServiceClient, InfoServiceDefinition as _caikit_runtime_info_InfoServiceDefinition } from './caikit/runtime/info/InfoService'; - -type SubtypeConstructor any, Subtype> = { - new(...args: ConstructorParameters): Subtype; -}; - -export interface ProtoGrpcType { - caikit: { - runtime: { - info: { - InfoService: SubtypeConstructor & { service: _caikit_runtime_info_InfoServiceDefinition } - } - } - } - caikit_data_model: { - common: { - BoolSequence: MessageTypeDefinition - ConnectionInfo: MessageTypeDefinition - ConnectionTlsInfo: MessageTypeDefinition - Directory: MessageTypeDefinition - File: MessageTypeDefinition - FileReference: MessageTypeDefinition - FloatSequence: MessageTypeDefinition - IntSequence: MessageTypeDefinition - ListOfFileReferences: MessageTypeDefinition - ListOfVector1D: MessageTypeDefinition - NpFloat32Sequence: MessageTypeDefinition - NpFloat64Sequence: MessageTypeDefinition - ProducerId: MessageTypeDefinition - ProducerPriority: MessageTypeDefinition - PyFloatSequence: MessageTypeDefinition - S3Base: MessageTypeDefinition - S3Files: MessageTypeDefinition - S3Path: MessageTypeDefinition - StrSequence: MessageTypeDefinition - TrainingStatus: EnumTypeDefinition - Vector1D: MessageTypeDefinition - runtime: { - ModelInfo: MessageTypeDefinition - ModelInfoRequest: MessageTypeDefinition - ModelInfoResponse: MessageTypeDefinition - RuntimeInfoRequest: MessageTypeDefinition - RuntimeInfoResponse: MessageTypeDefinition - } - } - } - google: { - protobuf: { - ListValue: MessageTypeDefinition - NullValue: EnumTypeDefinition - Struct: MessageTypeDefinition - Value: MessageTypeDefinition - } - } -} - diff --git a/src/embedding/adapters/caikit/grpc/types/google/protobuf/ListValue.ts b/src/embedding/adapters/caikit/grpc/types/google/protobuf/ListValue.ts deleted file mode 100644 index 3dfedcd..0000000 --- a/src/embedding/adapters/caikit/grpc/types/google/protobuf/ListValue.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: null - -import type { - Value as _google_protobuf_Value, - Value__Output as _google_protobuf_Value__Output -} from './Value'; - -export interface ListValue { - values?: _google_protobuf_Value[]; -} - -export interface ListValue__Output { - values: _google_protobuf_Value__Output[]; -} diff --git a/src/embedding/adapters/caikit/grpc/types/google/protobuf/NullValue.ts b/src/embedding/adapters/caikit/grpc/types/google/protobuf/NullValue.ts deleted file mode 100644 index c8ae5d9..0000000 --- a/src/embedding/adapters/caikit/grpc/types/google/protobuf/NullValue.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: null - -export const NullValue = { - NULL_VALUE: 'NULL_VALUE', -} as const; - -export type NullValue = - | 'NULL_VALUE' - | 0 - -export type NullValue__Output = typeof NullValue[keyof typeof NullValue] diff --git a/src/embedding/adapters/caikit/grpc/types/google/protobuf/Struct.ts b/src/embedding/adapters/caikit/grpc/types/google/protobuf/Struct.ts deleted file mode 100644 index 250f7ec..0000000 --- a/src/embedding/adapters/caikit/grpc/types/google/protobuf/Struct.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: null - -import type { - Value as _google_protobuf_Value, - Value__Output as _google_protobuf_Value__Output -} from './Value'; - -export interface Struct { - fields?: { [key: string]: _google_protobuf_Value }; -} - -export interface Struct__Output { - fields: { [key: string]: _google_protobuf_Value__Output }; -} diff --git a/src/embedding/adapters/caikit/grpc/types/google/protobuf/Timestamp.ts b/src/embedding/adapters/caikit/grpc/types/google/protobuf/Timestamp.ts deleted file mode 100644 index 3a0d5ec..0000000 --- a/src/embedding/adapters/caikit/grpc/types/google/protobuf/Timestamp.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: null - -import type { Long } from '@grpc/proto-loader'; - -export interface Timestamp { - 'seconds'?: (number | string | Long); - 'nanos'?: (number); -} - -export interface Timestamp__Output { - 'seconds': (number); - 'nanos': (number); -} diff --git a/src/embedding/adapters/caikit/grpc/types/google/protobuf/Value.ts b/src/embedding/adapters/caikit/grpc/types/google/protobuf/Value.ts deleted file mode 100644 index 4333264..0000000 --- a/src/embedding/adapters/caikit/grpc/types/google/protobuf/Value.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Original file: null - -import type { - NullValue as _google_protobuf_NullValue, - NullValue__Output as _google_protobuf_NullValue__Output -} from './NullValue'; -import type { - Struct as _google_protobuf_Struct, - Struct__Output as _google_protobuf_Struct__Output -} from './Struct'; -import type { - ListValue as _google_protobuf_ListValue, - ListValue__Output as _google_protobuf_ListValue__Output -} from './ListValue'; - -export interface Value { - nullValue?: _google_protobuf_NullValue; - numberValue?: number | string; - stringValue?: string; - boolValue?: boolean; - structValue?: _google_protobuf_Struct | null; - listValue?: _google_protobuf_ListValue | null; - kind?: 'nullValue' | 'numberValue' | 'stringValue' | 'boolValue' | 'structValue' | 'listValue'; -} - -export interface Value__Output { - nullValue?: _google_protobuf_NullValue__Output; - numberValue?: number; - stringValue?: string; - boolValue?: boolean; - structValue?: _google_protobuf_Struct__Output | null; - listValue?: _google_protobuf_ListValue__Output | null; - kind: 'nullValue' | 'numberValue' | 'stringValue' | 'boolValue' | 'structValue' | 'listValue'; -} diff --git a/src/embedding/adapters/caikit/grpc/utils/build-client.ts b/src/embedding/adapters/caikit/grpc/utils/build-client.ts deleted file mode 100644 index dbafc6d..0000000 --- a/src/embedding/adapters/caikit/grpc/utils/build-client.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import grpc from '@grpc/grpc-js'; -import { MemoryCache } from 'cache-manager'; - -import { NlpServiceClient } from '../types/caikit/runtime/Nlp/NlpService.js'; -import { GRPC_CLIENT_SHUTDOWN_TIMEOUT } from '../constants.js'; - -import { createGrpcURLFromModel } from './url.js'; - -import { getLogger } from '@/logger.js'; -import { CAIKIT_CA_CERT, CAIKIT_CERT, CAIKIT_KEY, CAIKIT_URL } from '@/config.js'; - -const options = { - // This is needed, otherwise communication to DIPC cluster fails with "Dropped connection" error after +- 50 secs - 'grpc.keepalive_time_ms': 25000, - 'grpc.max_receive_message_length': 32 * 1024 * 1024 // 32MiB -} as const; - -type AnyClient = NlpServiceClient; - -type SubtypeConstructor any, Subtype> = { - new (...args: ConstructorParameters): Subtype; -}; - -interface BuildClientProps { - cache: MemoryCache; - modelId: string; - service: SubtypeConstructor; -} - -export function buildClient({ cache, modelId, service }: BuildClientProps) { - if (!CAIKIT_URL || !CAIKIT_CA_CERT || !CAIKIT_KEY || !CAIKIT_CERT) - throw new Error('Missing caikit env(s)'); - const credentials = grpc.credentials.createSsl( - Buffer.from(CAIKIT_CA_CERT), - Buffer.from(CAIKIT_KEY), - Buffer.from(CAIKIT_CERT) - ); - return cache.wrap(CAIKIT_URL, async () => { - const url = createGrpcURLFromModel(modelId); - const client = new service(url, credentials, options); - setTimeout(() => { - try { - client.close(); - } catch (err) { - getLogger().warn({ url }, 'Failed to close grpc client'); - } - }, GRPC_CLIENT_SHUTDOWN_TIMEOUT).unref(); - return client; - }); -} diff --git a/src/embedding/adapters/caikit/grpc/utils/errors.ts b/src/embedding/adapters/caikit/grpc/utils/errors.ts deleted file mode 100644 index e791aaa..0000000 --- a/src/embedding/adapters/caikit/grpc/utils/errors.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ServiceError } from '@grpc/grpc-js'; - -import { APIError, APIErrorCode } from '@/errors/error.entity'; - -export function isGrpcServiceError(err: unknown): err is ServiceError { - return ( - err instanceof Error && - err.constructor.name === 'Error' && - 'code' in err && - typeof err.code === 'number' - ); -} - -export function convertGrpcError(err: ServiceError): APIError { - // Error codes from https://grpc.github.io/grpc/core/md_doc_statuscodes.html - switch (err.code) { - case 3: - case 11: - return new APIError({ - message: `Invalid argument or out of range`, - code: APIErrorCode.SERVICE_ERROR - }); - case 5: - return new APIError({ - message: `Unrecognized model`, - code: APIErrorCode.SERVICE_UNAVAILABLE - }); - case 8: - return new APIError({ - message: `The model is currently overloaded.`, - code: APIErrorCode.SERVICE_UNAVAILABLE - }); - case 10: - return new APIError({ - message: 'The operation was aborted.', - code: APIErrorCode.SERVICE_UNAVAILABLE - }); - case 4: - case 14: - return new APIError({ - message: 'The model is temporarily unavailable. This is most likely a temporary condition.', - code: APIErrorCode.SERVICE_UNAVAILABLE - }); - default: - return new APIError({ - message: 'Unspecified service error', - code: APIErrorCode.SERVICE_ERROR - }); - } -} diff --git a/src/embedding/adapters/caikit/grpc/utils/metadata.ts b/src/embedding/adapters/caikit/grpc/utils/metadata.ts deleted file mode 100644 index 5954474..0000000 --- a/src/embedding/adapters/caikit/grpc/utils/metadata.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Metadata } from '@grpc/grpc-js'; - -const GRPC_MODEL_ID_HEADER = 'mm-model-id'; - -export function createGrpcMetadata({ modelId }: { modelId?: string } = {}) { - const metadata = new Metadata({}); - if (modelId) metadata.add(GRPC_MODEL_ID_HEADER, modelId); - return metadata; -} diff --git a/src/embedding/adapters/caikit/grpc/utils/url.ts b/src/embedding/adapters/caikit/grpc/utils/url.ts deleted file mode 100644 index 70e234f..0000000 --- a/src/embedding/adapters/caikit/grpc/utils/url.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { IBM_VLLM_URL } from '@/config'; - -export function createGrpcURLFromModel(modelId: string) { - if (!IBM_VLLM_URL) throw new Error('Missing IBM_VLLM_URL'); - return IBM_VLLM_URL.replace(/{model_id}/, modelId.replaceAll('/', '--')); -} diff --git a/src/embedding/adapters/caikit/grpc/utils/wrappers.ts b/src/embedding/adapters/caikit/grpc/utils/wrappers.ts deleted file mode 100644 index 2bb2075..0000000 --- a/src/embedding/adapters/caikit/grpc/utils/wrappers.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { CallOptions, ClientReadableStream, ClientUnaryCall, Metadata } from '@grpc/grpc-js'; -import { UnaryCallback } from '@grpc/grpc-js/build/src/client'; - -export function wrapGrpcCall( - fn: ( - request: TRequest, - metadata: Metadata, - options: CallOptions, - callback: UnaryCallback - ) => ClientUnaryCall -) { - return ( - request: TRequest, - metadata: Metadata, - { signal, ...options }: CallOptions & { signal?: AbortSignal } = {} - ): Promise => { - return new Promise((resolve, reject) => { - const call = fn(request, metadata, options, (err, response) => { - signal?.removeEventListener('abort', abortHandler); - if (err) { - reject(err); - } else { - if (response === undefined) { - reject(new Error('Invalid response from GRPC server')); - } else { - resolve(response); - } - } - }); - const abortHandler = () => { - call.cancel(); - }; - signal?.addEventListener('abort', abortHandler, { once: true }); - }); - }; -} - -export function wrapGrpcStream( - fn: ( - request: TRequest, - metadata: Metadata, - options: CallOptions - ) => ClientReadableStream -) { - return async ( - request: TRequest, - metadata: Metadata, - { signal, ...options }: CallOptions & { signal?: AbortSignal } = {} - ): Promise> => { - const stream = fn(request, metadata, options); - const abortHandler = () => { - stream.cancel(); - }; - signal?.addEventListener('abort', abortHandler, { once: true }); - stream.addListener('close', () => signal?.removeEventListener('abort', abortHandler)); - return stream; - }; -} diff --git a/src/embedding/adapters/embedding.ts b/src/embedding/adapters/embedding.ts deleted file mode 100644 index af160d8..0000000 --- a/src/embedding/adapters/embedding.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { cosineSimilarityMatrix } from '@/embedding/utilts'; - -export type EmbeddingOptions = { - signal?: AbortSignal; -}; - -export abstract class Embedding { - constructor(public readonly model: string) {} - - async embed(text: string, options?: EmbeddingOptions): Promise { - const result = await this.embedMany([text], options); - const embedding = result.at(0); - if (!embedding) throw new Error('Missing embedding'); - return embedding; - } - - abstract embedMany(texts: string[], options?: EmbeddingOptions): Promise; - - async similarity( - { query, texts }: { query: string; texts: string[] }, - options?: EmbeddingOptions - ): Promise<{ score: number }[]> { - const [sourceEmbedding, ...textEmbeddings] = await this.embedMany([query, ...texts], options); - const matrix = cosineSimilarityMatrix([sourceEmbedding], textEmbeddings); - const similarities = matrix.at(0); - if (!similarities) throw new Error('Missing similarities'); - return similarities.map((score) => ({ score })); - } -} diff --git a/src/embedding/adapters/ollama-embedding.ts b/src/embedding/adapters/ollama-embedding.ts deleted file mode 100644 index 1f67eb6..0000000 --- a/src/embedding/adapters/ollama-embedding.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Ollama } from 'ollama'; - -import { Embedding } from './embedding'; - -export class OllamaEmbedding extends Embedding { - constructor( - public readonly model: string, - public readonly client: Ollama - ) { - super(model); - } - - async embedMany(texts: string[]): Promise { - const response = await this.client.embed({ model: this.model, input: texts }); - return response.embeddings; - } -} diff --git a/src/embedding/adapters/openai-embedding.ts b/src/embedding/adapters/openai-embedding.ts deleted file mode 100644 index b5dcb0f..0000000 --- a/src/embedding/adapters/openai-embedding.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import OpenAI from 'openai'; - -import { Embedding, EmbeddingOptions } from './embedding'; - -export class OpenAIEmbedding extends Embedding { - constructor( - public readonly model: string, - public readonly client: OpenAI - ) { - super(model); - } - - async embedMany(texts: string[], options?: EmbeddingOptions): Promise { - const response = await this.client.embeddings.create( - { model: this.model, input: texts }, - { signal: options?.signal } - ); - return response.data.map((data) => data.embedding); - } -} diff --git a/src/embedding/adapters/watsonx-embedding.ts b/src/embedding/adapters/watsonx-embedding.ts deleted file mode 100644 index 822f8f8..0000000 --- a/src/embedding/adapters/watsonx-embedding.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { RestfulClient } from 'bee-agent-framework/internals/fetcher'; - -import { Embedding, EmbeddingOptions } from './embedding'; - -export class WatsonXEmbedding extends Embedding { - constructor( - public readonly model: string, - public readonly project: string, - public readonly client: RestfulClient> - ) { - super(model); - } - - async embedMany(texts: string[], options?: EmbeddingOptions): Promise { - const response: { results: { embedding: number[] }[] } = await this.client.fetch( - '/ml/v1/text/embeddings', - { - method: 'POST', - searchParams: new URLSearchParams({ version: '2023-10-25' }), - body: JSON.stringify({ - inputs: texts, - model_id: this.model, - project_id: this.project, - parameters: { - truncate_input_tokens: 512 - } - }), - signal: options?.signal - } - ); - if (response.results?.length !== texts.length) throw new Error('Missing embedding'); - return response.results.map((result) => result.embedding); - } -} diff --git a/src/embedding/constants.ts b/src/embedding/constants.ts deleted file mode 100644 index 487352a..0000000 --- a/src/embedding/constants.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export const EmbeddingBackend = { - CAIKIT: 'caikit', - OLLAMA: 'ollama', - OPENAI: 'openai', - BAM: 'bam', - WATSONX: 'watsonx' -} as const; -export type EmbeddingBackend = (typeof EmbeddingBackend)[keyof typeof EmbeddingBackend]; diff --git a/src/embedding/factory.ts b/src/embedding/factory.ts deleted file mode 100644 index 6670e08..0000000 --- a/src/embedding/factory.ts +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Ollama } from 'ollama'; -import OpenAI from 'openai'; -import { Client as BAMClient } from '@ibm-generative-ai/node-sdk'; -import { WatsonXLLM } from 'bee-agent-framework/adapters/watsonx/llm'; - -import { EmbeddingBackend } from './constants'; -import { CaikitEmbedding } from './adapters/caikit/caikit-embedding'; -import { GrpcEmbeddingModel } from './adapters/caikit/grpc/constants'; -import { OllamaEmbedding } from './adapters/ollama-embedding'; -import { OpenAIEmbedding } from './adapters/openai-embedding'; -import { createEmbeddingsClient } from './adapters/caikit/grpc/client'; -import { BAMEmbedding } from './adapters/bam-embedding'; -import { WatsonXEmbedding } from './adapters/watsonx-embedding'; - -import { - BAM_API_KEY, - EMBEDDING_BACKEND, - OLLAMA_URL, - OPENAI_API_KEY, - WATSONX_API_KEY, - WATSONX_PROJECT_ID, - WATSONX_REGION -} from '@/config'; - -export function getDefaultEmbeddingModel(backend: EmbeddingBackend = EMBEDDING_BACKEND) { - switch (backend) { - case EmbeddingBackend.CAIKIT: - return GrpcEmbeddingModel.BGE_LARGE_EN_V_1_5; - case EmbeddingBackend.OLLAMA: - return 'nomic-embed-text'; - case EmbeddingBackend.OPENAI: - return 'text-embedding-3-large'; - case EmbeddingBackend.BAM: - return 'baai/bge-large-en-v1.5'; - case EmbeddingBackend.WATSONX: - return 'ibm/slate-30m-english-rtrvr-v2'; - } -} - -let ollamaClient: Ollama | null; -let openAIClient: OpenAI | null; -let bamClient: BAMClient | null; - -export async function createEmbeddingAdapter( - model: string = getDefaultEmbeddingModel(), - backend: EmbeddingBackend = EMBEDDING_BACKEND -) { - switch (backend) { - case EmbeddingBackend.CAIKIT: { - const caikitClient = await createEmbeddingsClient(model); // caikit clients are managed - return new CaikitEmbedding(model, caikitClient); - } - case EmbeddingBackend.OLLAMA: - ollamaClient ??= new Ollama({ host: OLLAMA_URL ?? undefined }); - return new OllamaEmbedding(model, ollamaClient); - case EmbeddingBackend.OPENAI: - openAIClient ??= new OpenAI({ apiKey: OPENAI_API_KEY ?? undefined }); - return new OpenAIEmbedding(model, openAIClient); - case EmbeddingBackend.BAM: - bamClient ??= new BAMClient({ apiKey: BAM_API_KEY ?? undefined }); - return new BAMEmbedding(model, bamClient); - case EmbeddingBackend.WATSONX: { - if (!WATSONX_API_KEY) throw new Error('Missing WATSONX_API_KEY'); - if (!WATSONX_PROJECT_ID) throw new Error('Missing WATSONX_PROJECT_ID'); - // Framework doesn't expose factory for WatsonX fetcher, therefore we grab it via LLM - const llm = new WatsonXLLM({ - modelId: 'foobar', - apiKey: WATSONX_API_KEY, - projectId: WATSONX_PROJECT_ID, - region: WATSONX_REGION ?? undefined - }); - return new WatsonXEmbedding(model, WATSONX_PROJECT_ID, llm.client); - } - } -} diff --git a/src/embedding/utilts.ts b/src/embedding/utilts.ts deleted file mode 100644 index 9e87b33..0000000 --- a/src/embedding/utilts.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export function cosineSimilarity(rowA: number[], rowB: number[]): number { - const dotProduct = rowA.reduce((sum, a, j) => sum + a * rowB[j], 0); - const magnitudeA = Math.sqrt(rowA.reduce((sum, a) => sum + a * a, 0)); - const magnitudeB = Math.sqrt(rowB.reduce((sum, b) => sum + b * b, 0)); - - if (magnitudeA === 0 || magnitudeB === 0) { - throw new Error('Rows must not contain only zeros.'); - } - - return dotProduct / (magnitudeA * magnitudeB); -} - -export function cosineSimilarityMatrix(matrixA: number[][], matrixB: number[][]): number[][] { - if ((matrixA[0]?.length ?? 0) !== (matrixB[0]?.length ?? 0)) { - throw new Error('Matrices must have the same number of columns.'); - } - return matrixA.map((rowA) => matrixB.map((rowB) => cosineSimilarity(rowA, rowB))); -} diff --git a/src/errors/error.entity.ts b/src/errors/error.entity.ts index b64eb96..576ef30 100644 --- a/src/errors/error.entity.ts +++ b/src/errors/error.entity.ts @@ -19,11 +19,6 @@ import { FrameworkError } from 'bee-agent-framework'; import { AgentError } from 'bee-agent-framework/agents/base'; import { ToolError } from 'bee-agent-framework/tools/base'; -import { - convertGrpcError, - isGrpcServiceError -} from '@/embedding/adapters/caikit/grpc/utils/errors'; - export const APIErrorCode = { AUTH_ERROR: 'auth_error', INTERNAL_SERVER_ERROR: 'internal_server_error', @@ -81,11 +76,6 @@ export class APIError { ); } - // This should be last check before generic error since isGrpcServiceError is just a heuristic - if (isGrpcServiceError(err)) { - return convertGrpcError(err); - } - return new APIError( { message: err instanceof Error ? err.message : 'Unspecified error', diff --git a/src/runs/execution/constants.ts b/src/runs/execution/constants.ts index b37860a..5c2c448 100644 --- a/src/runs/execution/constants.ts +++ b/src/runs/execution/constants.ts @@ -14,10 +14,6 @@ * limitations under the License. */ -import { IBMVllmModel } from 'bee-agent-framework/adapters/ibm-vllm/chatPreset'; - -import { LLM_BACKEND } from '@/config'; - export const RUN_EXPIRATION_MILLISECONDS = 10 * 60 * 1000; export const STATUS_POLL_INTERVAL = 5 * 1000; @@ -27,38 +23,23 @@ export const Agent = { } as const; export type Agent = (typeof Agent)[keyof typeof Agent]; -export const LLMBackend = { +export const AIBackend = { OLLAMA: 'ollama', IBM_VLLM: 'ibm-vllm', OPENAI: 'openai', BAM: 'bam', WATSONX: 'watsonx' } as const; -export type LLMBackend = (typeof LLMBackend)[keyof typeof LLMBackend]; export const CodeInterpreterStorageBackend = { S3: 's3', FILESYSTEM: 'filesystem' } as const; -export type CodeInterpreterStorageBackend = (typeof LLMBackend)[keyof typeof LLMBackend]; +export type CodeInterpreterStorageBackend = + (typeof CodeInterpreterStorageBackend)[keyof typeof CodeInterpreterStorageBackend]; export const SearchToolBackend = { GOOGLE: 'google', DUCK_DUCK_GO: 'duck-duck-go' } as const; export type SearchToolBackend = (typeof SearchToolBackend)[keyof typeof SearchToolBackend]; - -export function getDefaultModel(backend: LLMBackend = LLM_BACKEND) { - switch (backend) { - case LLMBackend.IBM_VLLM: - return IBMVllmModel.LLAMA_3_1_70B_INSTRUCT; - case LLMBackend.OLLAMA: - return 'llama3.1'; - case LLMBackend.OPENAI: - return 'gpt-4o'; - case LLMBackend.BAM: - return 'meta-llama/llama-3-1-70b-instruct'; - case LLMBackend.WATSONX: - return 'meta-llama/llama-3-1-70b-instruct'; - } -} diff --git a/src/runs/execution/execute.ts b/src/runs/execution/execute.ts index b38e0e0..114992e 100644 --- a/src/runs/execution/execute.ts +++ b/src/runs/execution/execute.ts @@ -31,7 +31,7 @@ import { createToolResource } from './helpers.js'; import { getTools } from './tools/helpers.js'; -import { createAgentRun, createChatLLM } from './factory.js'; +import { createAgentRun } from './factory.js'; import { ORM } from '@/database.js'; import { getLogger } from '@/logger.js'; @@ -46,6 +46,7 @@ import { LoadedRun } from '@/runs/execution/types.js'; import { UserResource } from '@/tools/entities/tool-resources/user-resource.entity.js'; import { SystemResource } from '@/tools/entities/tool-resources/system-resource.entity.js'; import { Attachment } from '@/messages/attachment.entity'; +import { defaultAIProvider } from '@/runs/execution/provider'; const agentExecutionTime = new Summary({ name: 'agent_execution_time_seconds', @@ -121,7 +122,7 @@ export async function executeRun(run: LoadedRun) { const context = { run, publish } as AgentContext; const tools = await getTools(run, context); - const llm = createChatLLM(run); + const llm = defaultAIProvider.createAssistantBackend(run); const memory = new TokenMemory({ llm }); await memory.addMany(messages); diff --git a/src/runs/execution/factory.ts b/src/runs/execution/factory.ts index 14b11e9..064379d 100644 --- a/src/runs/execution/factory.ts +++ b/src/runs/execution/factory.ts @@ -14,21 +14,6 @@ * limitations under the License. */ -import { Ollama } from 'ollama'; -import { OpenAI } from 'openai'; -import { Client as BAMClient } from '@ibm-generative-ai/node-sdk'; -import { Client as IBMvLLLClient } from 'bee-agent-framework/adapters/ibm-vllm/client'; -import { IBMVllmChatLLM } from 'bee-agent-framework/adapters/ibm-vllm/chat'; -import { OllamaChatLLM } from 'bee-agent-framework/adapters/ollama/chat'; -import { OpenAIChatLLM } from 'bee-agent-framework/adapters/openai/chat'; -import { IBMVllmChatLLMPresetModel } from 'bee-agent-framework/adapters/ibm-vllm/chatPreset'; -import { BAMChatLLMPresetModel } from 'bee-agent-framework/adapters/bam/chatPreset'; -import { BAMChatLLM } from 'bee-agent-framework/adapters/bam/chat'; -import { WatsonXChatLLM } from 'bee-agent-framework/adapters/watsonx/chat'; -import { WatsonXChatLLMPresetModel } from 'bee-agent-framework/adapters/watsonx/chatPreset'; -import { BAMLLM } from 'bee-agent-framework/adapters/bam/llm'; -import { IBMvLLM } from 'bee-agent-framework/adapters/ibm-vllm/llm'; -import { WatsonXLLM } from 'bee-agent-framework/adapters/watsonx/llm'; import { ZodType } from 'zod'; import { PromptTemplate } from 'bee-agent-framework'; import { AnyTool } from 'bee-agent-framework/tools/base'; @@ -43,179 +28,13 @@ import { Loaded } from '@mikro-orm/core'; import { Run } from '../entities/run.entity'; -import { Agent, LLMBackend } from './constants'; +import { Agent } from './constants'; import { createBeeStreamingHandler, createStreamlitStreamingHandler } from './event-handlers/streaming'; import { AgentContext } from './execute'; -import { - BAM_API_KEY, - IBM_VLLM_CERT_CHAIN, - IBM_VLLM_PRIVATE_KEY, - IBM_VLLM_ROOT_CERT, - IBM_VLLM_URL, - LLM_BACKEND, - OLLAMA_URL, - OPENAI_API_KEY, - WATSONX_API_KEY, - WATSONX_PROJECT_ID, - WATSONX_REGION -} from '@/config'; - -const MAX_NEW_TOKENS = 4096; - -// Clients are instantiated lazily in createLLM funciton -let vllmClient: IBMvLLLClient | null; -let ollamaClient: Ollama | null; -let openAIClient: OpenAI | null; -let bamClient: BAMClient | null; - -export function createChatLLM( - params: { model: string; topP?: number; temperature?: number }, - backend: LLMBackend = LLM_BACKEND -) { - switch (backend) { - case LLMBackend.IBM_VLLM: { - vllmClient ??= new IBMvLLLClient({ - url: IBM_VLLM_URL ?? undefined, - credentials: - IBM_VLLM_ROOT_CERT && IBM_VLLM_CERT_CHAIN && IBM_VLLM_PRIVATE_KEY - ? { - rootCert: IBM_VLLM_ROOT_CERT, - certChain: IBM_VLLM_CERT_CHAIN, - privateKey: IBM_VLLM_PRIVATE_KEY - } - : undefined - }); - return IBMVllmChatLLM.fromPreset(params.model as IBMVllmChatLLMPresetModel, { - client: vllmClient, - parameters: (parameters) => ({ - ...parameters, - sampling: { - ...parameters.sampling, - top_p: params.topP ?? parameters.sampling?.top_p, - temperature: params.temperature ?? parameters.sampling?.temperature - }, - stopping: { - ...parameters.stopping, - max_new_tokens: MAX_NEW_TOKENS - } - }) - }); - } - case LLMBackend.OLLAMA: { - ollamaClient ??= new Ollama({ host: OLLAMA_URL ?? undefined }); - return new OllamaChatLLM({ - client: ollamaClient, - modelId: params.model, - parameters: { - top_p: params.topP, - temperature: params.temperature, - num_predict: MAX_NEW_TOKENS - } - }); - } - case LLMBackend.OPENAI: { - openAIClient ??= new OpenAI({ apiKey: OPENAI_API_KEY ?? undefined }); - return new OpenAIChatLLM({ - client: openAIClient, - modelId: params.model as OpenAI.ChatModel, - parameters: { - top_p: params.topP, - temperature: params.temperature, - max_completion_tokens: MAX_NEW_TOKENS - } - }); - } - case LLMBackend.BAM: { - bamClient ??= new BAMClient({ apiKey: BAM_API_KEY ?? undefined }); - return BAMChatLLM.fromPreset(params.model as BAMChatLLMPresetModel, { - client: bamClient, - parameters: (parameters) => ({ - ...parameters, - top_p: params.topP ?? parameters.top_p, - temperature: params.temperature ?? parameters.temperature, - max_new_tokens: MAX_NEW_TOKENS - }) - }); - } - case LLMBackend.WATSONX: { - if (!WATSONX_API_KEY) throw new Error('Missing WATSONX_API_KEY'); - if (!WATSONX_PROJECT_ID) throw new Error('Missing WATSONX_PROJECT_ID'); - return WatsonXChatLLM.fromPreset(params.model as WatsonXChatLLMPresetModel, { - apiKey: WATSONX_API_KEY, - projectId: WATSONX_PROJECT_ID, - region: WATSONX_REGION ?? undefined, - parameters: (parameters) => ({ - ...parameters, - top_p: params.topP ?? parameters.top_p, - temperature: params.temperature ?? parameters.temperature, - max_new_tokens: MAX_NEW_TOKENS - }) - }); - } - } -} - -// TODO make lazy client init DRY - -export function createCodeLLM(backend: LLMBackend = LLM_BACKEND) { - switch (backend) { - case LLMBackend.IBM_VLLM: { - vllmClient ??= new IBMvLLLClient({ - url: IBM_VLLM_URL ?? undefined, - credentials: - IBM_VLLM_ROOT_CERT && IBM_VLLM_CERT_CHAIN && IBM_VLLM_PRIVATE_KEY - ? { - rootCert: IBM_VLLM_ROOT_CERT, - certChain: IBM_VLLM_CERT_CHAIN, - privateKey: IBM_VLLM_PRIVATE_KEY - } - : undefined - }); - return new IBMvLLM({ - client: vllmClient, - modelId: 'meta-llama/llama-3-1-70b-instruct', - parameters: { - method: 'GREEDY', - stopping: { include_stop_sequence: false, max_new_tokens: MAX_NEW_TOKENS } - } - }); - } - case LLMBackend.BAM: { - bamClient ??= new BAMClient({ apiKey: BAM_API_KEY ?? undefined }); - return new BAMLLM({ - client: bamClient, - modelId: 'meta-llama/llama-3-1-70b-instruct', - parameters: { - decoding_method: 'greedy', - include_stop_sequence: false, - max_new_tokens: MAX_NEW_TOKENS - } - }); - } - case LLMBackend.WATSONX: { - if (!WATSONX_API_KEY) throw new Error('Missing WATSONX_API_KEY'); - if (!WATSONX_PROJECT_ID) throw new Error('Missing WATSONX_PROJECT_ID'); - return new WatsonXLLM({ - modelId: 'meta-llama/llama-3-1-70b-instruct', - apiKey: WATSONX_API_KEY, - projectId: WATSONX_PROJECT_ID, - region: WATSONX_REGION ?? undefined, - parameters: { - decoding_method: 'greedy', - include_stop_sequence: false, - max_new_tokens: MAX_NEW_TOKENS - } - }); - } - default: - return undefined; - } -} - export function createAgentRun( run: Loaded, { llm, tools, memory }: { llm: ChatLLM; tools: AnyTool[]; memory: BaseMemory }, diff --git a/src/runs/execution/provider.ts b/src/runs/execution/provider.ts new file mode 100644 index 0000000..f56aecb --- /dev/null +++ b/src/runs/execution/provider.ts @@ -0,0 +1,285 @@ +import { ChatLLM, ChatLLMOutput } from 'bee-agent-framework/llms/chat'; +import { LLM, LLMInput } from 'bee-agent-framework/llms/llm'; +import { BaseLLMOutput, EmbeddingOptions, EmbeddingOutput } from 'bee-agent-framework/llms/base'; +import { BAMChatLLM } from 'bee-agent-framework/adapters/bam/chat'; +import { BAMLLM } from 'bee-agent-framework/adapters/bam/llm'; +import { Client as BAMClient } from '@ibm-generative-ai/node-sdk'; +import { BAMChatLLMPresetModel } from 'bee-agent-framework/adapters/bam/chatPreset'; +import { OllamaChatLLM } from 'bee-agent-framework/adapters/ollama/chat'; +import { OllamaLLM } from 'bee-agent-framework/adapters/ollama/llm'; +import { Ollama } from 'ollama'; +import { OpenAIChatLLM } from 'bee-agent-framework/adapters/openai/chat'; +import { OpenAI } from 'openai'; +import { BaseMessage } from 'bee-agent-framework/llms/primitives/message'; +import { IBMVllmChatLLM } from 'bee-agent-framework/adapters/ibm-vllm/chat'; +import { IBMvLLM } from 'bee-agent-framework/adapters/ibm-vllm/llm'; +import { Client as IBMvLLMClient } from 'bee-agent-framework/adapters/ibm-vllm/client'; +import { + IBMVllmChatLLMPresetModel, + IBMVllmModel +} from 'bee-agent-framework/adapters/ibm-vllm/chatPreset'; +import { WatsonXChatLLM } from 'bee-agent-framework/adapters/watsonx/chat'; +import { WatsonXChatLLMPresetModel } from 'bee-agent-framework/adapters/watsonx/chatPreset'; +import { WatsonXLLM } from 'bee-agent-framework/adapters/watsonx/llm'; + +import { + AI_BACKEND, + BAM_API_KEY, + IBM_VLLM_CERT_CHAIN, + IBM_VLLM_PRIVATE_KEY, + IBM_VLLM_ROOT_CERT, + IBM_VLLM_URL, + OLLAMA_URL, + OPENAI_API_KEY, + WATSONX_API_KEY, + WATSONX_PROJECT_ID, + WATSONX_REGION +} from '@/config'; +import { AIBackend } from '@/runs/execution/constants'; + +const MAX_NEW_TOKENS = 4096; + +type ChatLLMParams = { model?: string; topP?: number; temperature?: number }; + +interface EmbeddingModel { + modelId: string; + embed(input: LLMInput[], options?: EmbeddingOptions): Promise; +} + +interface AIProvider< + ChatLLMType extends ChatLLM, + LLMType extends LLM = any +> { + createChatBackend: (params?: ChatLLMParams) => ChatLLMType; + createAssistantBackend: (params?: ChatLLMParams) => ChatLLMType; + createCodeBackend: (params?: { model?: string }) => LLMType | void; + createEmbeddingBackend?: (params?: { model?: string }) => EmbeddingModel; +} + +export class BamAIProvider implements AIProvider { + static client: BAMClient; + + constructor() { + BamAIProvider.client ??= new BAMClient({ apiKey: BAM_API_KEY ?? undefined }); + } + + createChatBackend({ + model = 'meta-llama/llama-3-1-70b-instruct', + ...params + }: ChatLLMParams = {}) { + return BAMChatLLM.fromPreset(model as BAMChatLLMPresetModel, { + client: BamAIProvider.client, + parameters: (parameters) => ({ + ...parameters, + top_p: params.topP ?? parameters.top_p, + temperature: params.temperature ?? parameters.temperature, + max_new_tokens: MAX_NEW_TOKENS + }) + }); + } + + createAssistantBackend(params?: ChatLLMParams) { + return this.createChatBackend(params); + } + + createCodeBackend({ model = 'meta-llama/llama-3-1-70b-instruct' } = {}) { + return new BAMLLM({ + client: BamAIProvider.client, + modelId: model, + parameters: { + decoding_method: 'greedy', + include_stop_sequence: false, + max_new_tokens: MAX_NEW_TOKENS + } + }); + } + + createEmbeddingBackend({ model = 'baai/bge-large-en-v1.5' } = {}) { + return new BAMLLM({ client: BamAIProvider.client, modelId: model }); + } +} + +export class OllamaAIProvider implements AIProvider { + static client: Ollama; + + constructor() { + OllamaAIProvider.client ??= new Ollama({ host: OLLAMA_URL ?? undefined }); + } + + createChatBackend({ model: modelId = 'llama3.1', ...params }: ChatLLMParams = {}) { + return new OllamaChatLLM({ + client: OllamaAIProvider.client, + modelId, + parameters: { + top_p: params.topP, + temperature: params.temperature, + num_predict: MAX_NEW_TOKENS + } + }); + } + createAssistantBackend(params?: ChatLLMParams) { + return this.createChatBackend(params); + } + + createCodeBackend() {} + + createEmbeddingBackend({ model: modelId = 'nomic-embed-text' } = {}) { + return new OllamaLLM({ client: OllamaAIProvider.client, modelId }); + } +} + +export class OpenAIProvider implements AIProvider { + static client: OpenAI; + constructor() { + OpenAIProvider.client ??= new OpenAI({ apiKey: OPENAI_API_KEY ?? undefined }); + } + + createChatBackend({ model = 'gpt-4o', ...params }: ChatLLMParams = {}) { + return new OpenAIChatLLM({ + client: OpenAIProvider.client, + modelId: model as OpenAI.ChatModel, + parameters: { + top_p: params.topP, + temperature: params.temperature, + max_completion_tokens: MAX_NEW_TOKENS + } + }); + } + + createAssistantBackend(params?: ChatLLMParams) { + return this.createChatBackend(params); + } + + createCodeBackend() {} + + createEmbeddingBackend({ model = 'text-embedding-3-large' } = {}) { + return { + chatLLM: new OpenAIChatLLM({ + client: OpenAIProvider.client, + modelId: model as OpenAI.ChatModel + }), + modelId: model, + embed(input: LLMInput[], options?: EmbeddingOptions) { + return this.chatLLM.embed( + [input.map((text) => BaseMessage.of({ role: 'assistant', text }))], + options + ); + } + }; + } +} + +export class IBMvLLMAIProvider implements AIProvider { + static client: IBMvLLMClient; + + constructor() { + IBMvLLMAIProvider.client ??= new IBMvLLMClient({ + url: IBM_VLLM_URL ?? undefined, + credentials: + IBM_VLLM_ROOT_CERT && IBM_VLLM_CERT_CHAIN && IBM_VLLM_PRIVATE_KEY + ? { + rootCert: IBM_VLLM_ROOT_CERT, + certChain: IBM_VLLM_CERT_CHAIN, + privateKey: IBM_VLLM_PRIVATE_KEY + } + : undefined + }); + } + + createChatBackend({ + model = IBMVllmModel.LLAMA_3_1_70B_INSTRUCT, + ...params + }: ChatLLMParams = {}) { + return IBMVllmChatLLM.fromPreset(model as IBMVllmChatLLMPresetModel, { + client: IBMvLLMAIProvider.client, + parameters: (parameters) => ({ + ...parameters, + sampling: { + ...parameters.sampling, + top_p: params.topP ?? parameters.sampling?.top_p, + temperature: params.temperature ?? parameters.sampling?.temperature + }, + stopping: { + ...parameters.stopping, + max_new_tokens: MAX_NEW_TOKENS + } + }) + }); + } + + createAssistantBackend(params?: ChatLLMParams) { + return this.createChatBackend(params); + } + + createCodeBackend({ model: modelId = 'meta-llama/llama-3-1-70b-instruct' } = {}) { + return new IBMvLLM({ + client: IBMvLLMAIProvider.client, + modelId, + parameters: { + method: 'GREEDY', + stopping: { include_stop_sequence: false, max_new_tokens: MAX_NEW_TOKENS } + } + }); + } + + createEmbeddingBackend({ model: modelId = 'baai/bge-large-en-v1.5' } = {}) { + return new IBMvLLM({ client: IBMvLLMAIProvider.client, modelId }); + } +} + +export class WatsonxAIProvider implements AIProvider { + get credentials() { + if (!WATSONX_API_KEY) throw new Error('Missing WATSONX_API_KEY'); + if (!WATSONX_PROJECT_ID) throw new Error('Missing WATSONX_PROJECT_ID'); + return { + apiKey: WATSONX_API_KEY, + projectId: WATSONX_PROJECT_ID, + region: WATSONX_REGION ?? undefined + }; + } + + createChatBackend({ + model = 'meta-llama/llama-3-1-70b-instruct', + ...params + }: ChatLLMParams = {}) { + return WatsonXChatLLM.fromPreset(model as WatsonXChatLLMPresetModel, { + ...this.credentials, + parameters: (parameters) => ({ + ...parameters, + top_p: params.topP ?? parameters.top_p, + temperature: params.temperature ?? parameters.temperature, + max_new_tokens: MAX_NEW_TOKENS + }) + }); + } + + createAssistantBackend(params?: ChatLLMParams) { + return this.createChatBackend(params); + } + + createCodeBackend({ model: modelId = 'meta-llama/llama-3-1-70b-instruct' } = {}) { + return new WatsonXLLM({ + ...this.credentials, + modelId, + parameters: { + decoding_method: 'greedy', + include_stop_sequence: false, + max_new_tokens: MAX_NEW_TOKENS + } + }); + } + + createEmbeddingBackend({ model: modelId = 'ibm/slate-30m-english-rtrvr-v2' } = {}) { + return new WatsonXLLM({ ...this.credentials, modelId, region: WATSONX_REGION ?? undefined }); + } +} + +export const aiProviderByBackend = { + [AIBackend.OLLAMA]: OllamaAIProvider, + [AIBackend.IBM_VLLM]: IBMvLLMAIProvider, + [AIBackend.OPENAI]: OpenAIProvider, + [AIBackend.BAM]: BamAIProvider, + [AIBackend.WATSONX]: WatsonxAIProvider +}; + +export const defaultAIProvider = new aiProviderByBackend[AI_BACKEND](); diff --git a/src/runs/execution/tools/file-search-tool.ts b/src/runs/execution/tools/file-search-tool.ts index 789b37d..ae80d53 100644 --- a/src/runs/execution/tools/file-search-tool.ts +++ b/src/runs/execution/tools/file-search-tool.ts @@ -17,8 +17,8 @@ import { BaseToolOptions, BaseToolRunOptions, - ToolEmitter, Tool, + ToolEmitter, ToolInput, ToolOutput } from 'bee-agent-framework/tools/base'; @@ -30,7 +30,7 @@ import { Emitter } from 'bee-agent-framework/emitter/emitter'; import { getVectorStoreClient } from '@/vector-store-files/execution/client.js'; import { VectorStore } from '@/vector-stores/entities/vector-store.entity.js'; -import { createEmbeddingAdapter } from '@/embedding/factory'; +import { defaultAIProvider } from '@/runs/execution/provider'; export interface FileSearchToolOptions extends BaseToolOptions { vectorStores: Loaded[]; @@ -94,10 +94,11 @@ export class FileSearchTool extends Tool { const vectorStoreClient = getVectorStoreClient(); - const embeddingAdapter = await createEmbeddingAdapter(); + const embeddingModel = defaultAIProvider.createEmbeddingBackend(); - const embedding = await embeddingAdapter.embed(query, { signal: run.signal }); - if (!embedding) throw new Error('Missing embedding data in embedding response'); + const { + embeddings: [embedding] + } = await embeddingModel.embed([query], { signal: run.signal }); if (this.vectorStores.some((vectorStore) => vectorStore.expired)) { throw new Error('Some of the vector stores are expired'); diff --git a/src/runs/execution/tools/helpers.ts b/src/runs/execution/tools/helpers.ts index 5573779..f7756d1 100644 --- a/src/runs/execution/tools/helpers.ts +++ b/src/runs/execution/tools/helpers.ts @@ -40,9 +40,7 @@ import { AgentContext } from '../execute.js'; import { getRunVectorStores } from '../helpers.js'; import { CodeInterpreterTool as CodeInterpreterUserTool } from '../../../tools/entities/tool/code-interpreter-tool.entity.js'; import { ApiTool as ApiCallUserTool } from '../../../tools/entities/tool/api-tool.entity.js'; -import { createChatLLM, createCodeLLM } from '../factory.js'; import { RedisCache } from '../cache.js'; -import { getDefaultModel } from '../constants.js'; import { createPythonStorage } from './python-tool-storage.js'; import { FunctionTool, FunctionToolOutput } from './function.js'; @@ -71,7 +69,7 @@ import { UserUsage } from '@/tools/entities/tool-usages/user-usage.entity.js'; import { FileSearchUsage } from '@/tools/entities/tool-usages/file-search-usage.entity.js'; import { FileSearchCall } from '@/tools/entities/tool-calls/file-search-call.entity.js'; import { FunctionTool as FunctionUserTool } from '@/tools/entities/tool/function-tool.entity.js'; -import { WikipediaSimilaritySearchTool } from '@/runs/execution/tools/wikipedia-similarity-search-tool.js'; +import { wikipediaTool } from '@/runs/execution/tools/wikipedia-tool'; import { LoadedRun } from '@/runs/execution/types.js'; import { CodeInterpreterResource } from '@/tools/entities/tool-resources/code-interpreter-resource.entity.js'; import { File } from '@/files/entities/file.entity.js'; @@ -79,6 +77,7 @@ import { Attachment } from '@/messages/attachment.entity.js'; import { SystemResource } from '@/tools/entities/tool-resources/system-resource.entity.js'; import { createSearchTool } from '@/runs/execution/tools/search-tool'; import { sharedRedisCacheClient } from '@/redis.js'; +import { defaultAIProvider } from '@/runs/execution/provider'; const searchCache: SearchToolOptions['cache'] = new RedisCache({ client: sharedRedisCacheClient, @@ -129,17 +128,14 @@ export async function getTools(run: LoadedRun, context: AgentContext): Promise tool.type === ToolType.SYSTEM && tool.toolId === SystemTools.WIKIPEDIA ); - if (wikipediaUsage) tools.push(new WikipediaSimilaritySearchTool()); + if (wikipediaUsage) tools.push(wikipediaTool()); const llmUsage = run.tools.find( (tool): tool is SystemUsage => tool.type === ToolType.SYSTEM && tool.toolId === SystemTools.LLM ); - if (llmUsage) - tools.push( - new LLMTool({ - llm: createChatLLM({ model: getDefaultModel() }) - }) - ); + if (llmUsage) { + tools.push(new LLMTool({ llm: defaultAIProvider.createChatBackend() })); + } const calculatorUsage = run.tools.find( (tool): tool is SystemUsage => @@ -190,7 +186,7 @@ export async function getTools(run: LoadedRun, context: AgentContext): Promise container.file.$); if (codeInterpreterUsage) { - const codeLLM = createCodeLLM(); + const codeLLM = defaultAIProvider.createCodeBackend(); tools.push( new PythonTool({ codeInterpreter, @@ -332,7 +328,7 @@ export async function createToolCall( return new FileSearchCall({ input: await tool.parse(input).then((result) => result.query) }); - } else if (tool instanceof WikipediaSimilaritySearchTool) { + } else if (tool.name === wikipediaTool().name) { return new SystemCall({ toolId: SystemTools.WIKIPEDIA, input: await tool.parse(input) diff --git a/src/runs/execution/tools/wikipedia-similarity-search-tool.ts b/src/runs/execution/tools/wikipedia-similarity-search-tool.ts deleted file mode 100644 index 30b3683..0000000 --- a/src/runs/execution/tools/wikipedia-similarity-search-tool.ts +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Copyright 2024 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { z } from 'zod'; -import { ToolEmitter, Tool, ToolInput } from 'bee-agent-framework/tools/base'; -import { WikipediaTool } from 'bee-agent-framework/tools/search/wikipedia'; -import { - SimilarityTool, - SimilarityToolOptions, - SimilarityToolOutput -} from 'bee-agent-framework/tools/similarity'; -import { splitString } from 'bee-agent-framework/internals/helpers/string'; -import { Emitter } from 'bee-agent-framework/emitter/emitter'; - -import { createEmbeddingAdapter } from '@/embedding/factory'; - -const MAX_CONTENT_LENGTH_CHARS = 25_000; - -// Estimate from OpenAI: https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them -const CHARS_PER_TOKEN_AVG = 4; - -export class WikipediaSimilaritySearchTool extends Tool { - name: WikipediaTool['name']; - description: WikipediaTool['description']; - - wikipediaTool: WikipediaTool; - similarityTool: SimilarityTool; - - readonly emitter: ToolEmitter, SimilarityToolOutput> = Emitter.root.child({ - namespace: ['tool', 'search', 'wikipediaSimilarity'], - creator: this - }); - - static { - this.register(); - } - - inputSchema() { - return z.object({ - page: this.wikipediaTool.inputSchema().shape.query, - question: z.string({ - description: `The question you are trying to answer using the page, for example 'What is the population of New York?'` - }) - }); - } - - async similarityProvider({ - query, - documents - }: Parameters[0]): ReturnType< - SimilarityToolOptions['provider'] - > { - const embeddingAdapter = await createEmbeddingAdapter(); - const scores = await embeddingAdapter.similarity( - { - query, - texts: documents.map((document) => document.text) - }, - { signal: AbortSignal.timeout(60_000) } - ); - return scores; - } - - public constructor() { - super(); - - this.wikipediaTool = new WikipediaTool({ - search: { limit: 3 }, - filters: { minPageNameSimilarity: 0.25, excludeOthersOnExactMatch: false }, - extraction: { fields: { markdown: {} } }, - output: { maxSerializedLength: MAX_CONTENT_LENGTH_CHARS } - }); - this.similarityTool = new SimilarityTool({ provider: this.similarityProvider, maxResults: 5 }); - - this.name = this.wikipediaTool.name; - this.description = this.wikipediaTool.description; - } - - protected async _run({ page, question }: ToolInput) { - const wikipediaResult = await this.wikipediaTool.run({ query: page }); - - const documents = wikipediaResult.results - .map(({ fields: { markdown }, ...rest }) => { - const text = markdown as string; - return { - text: - text.length > MAX_CONTENT_LENGTH_CHARS ? text.slice(0, MAX_CONTENT_LENGTH_CHARS) : text, - ...rest - }; - }) - .flatMap((document, idx) => - [...splitString(document.text, { size: 400 * CHARS_PER_TOKEN_AVG, overlap: 100 })].map( - (text) => ({ - searchResultIndex: idx, - ...document, - text - }) - ) - ); - - return await this.similarityTool.run({ query: question, documents }); - } -} diff --git a/src/runs/execution/tools/wikipedia-tool.ts b/src/runs/execution/tools/wikipedia-tool.ts new file mode 100644 index 0000000..b7fa60f --- /dev/null +++ b/src/runs/execution/tools/wikipedia-tool.ts @@ -0,0 +1,93 @@ +/** + * Copyright 2024 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { z } from 'zod'; +import { AnyTool } from 'bee-agent-framework/tools/base'; +import { WikipediaTool } from 'bee-agent-framework/tools/search/wikipedia'; +import { SimilarityTool } from 'bee-agent-framework/tools/similarity'; +import { splitString } from 'bee-agent-framework/internals/helpers/string'; +import * as R from 'remeda'; +import { cosineSimilarityMatrix } from 'bee-agent-framework/internals/helpers/math'; + +import { defaultAIProvider } from '@/runs/execution/provider'; + +const MAX_CONTENT_LENGTH_CHARS = 25_000; + +// Estimate from OpenAI: https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them +const CHARS_PER_TOKEN_AVG = 4; + +// Creates a wikipedia tool that supports information retrieval +export function wikipediaTool( + passageSizeTokens = 400, + overlapTokens = 100, + maxResults = 5 +): AnyTool { + // LLM to perform text embedding + const embeddingLLM = defaultAIProvider.createEmbeddingBackend(); + + // Similarity tool to calculate the similarity between a query and a set of wikipedia passages + const similarity = new SimilarityTool({ + maxResults, + provider: async (input): Promise<{ score: number }[]> => { + const embeds = await embeddingLLM.embed([ + input.query, + ...input.documents.map((doc) => doc.text) + ]); + const similarities = cosineSimilarityMatrix( + [embeds.embeddings[0]], // Query + embeds.embeddings.slice(1) // Documents + )[0]; + if (!similarities) { + throw new Error('Missing similarities'); + } + return similarities.map((score) => ({ score })); + } + }); + + const wikipedia = new WikipediaTool({ + filters: { minPageNameSimilarity: 0.25, excludeOthersOnExactMatch: false }, + output: { maxSerializedLength: MAX_CONTENT_LENGTH_CHARS } + }); + // The wikipedia tool is extended to support chunking and similarity calculations + return wikipedia + .extend( + z.object({ + page: z + .string({ description: `Name of the wikipedia page, for example 'New York'` }) + .min(1) + .max(128), + question: z.string({ + description: `The question you are trying to answer using the page, for example 'What is the population of New York?'` + }) + }), + (newInput) => ({ query: newInput.page }) + ) + .pipe(similarity, (input, output) => ({ + query: input.question, + documents: output.results.flatMap((document, idx) => + Array.from( + splitString(document.fields.markdown ?? '', { + size: passageSizeTokens * CHARS_PER_TOKEN_AVG, + overlap: overlapTokens * CHARS_PER_TOKEN_AVG + }) + ).map((chunk) => ({ + searchResultIndex: idx, + ...R.omit(document, ['fields']), + text: chunk + })) + ) + })); +} diff --git a/src/tools/tools.service.ts b/src/tools/tools.service.ts index 8c250f7..03905f3 100644 --- a/src/tools/tools.service.ts +++ b/src/tools/tools.service.ts @@ -74,8 +74,7 @@ import { createCodeInterpreterConnectionOptions } from '@/runs/execution/tools/h import { ReadFileTool } from '@/runs/execution/tools/read-file-tool.js'; import { snakeToCamel } from '@/utils/strings.js'; import { createSearchTool } from '@/runs/execution/tools/search-tool'; -import { createChatLLM } from '@/runs/execution/factory.js'; -import { getDefaultModel } from '@/runs/execution/constants.js'; +import { defaultAIProvider } from '@/runs/execution/provider'; type SystemTool = Pick & { type: ToolType; @@ -466,9 +465,7 @@ function getSystemTools() { }); const fileSearch = new FileSearchTool({ vectorStores: [], maxNumResults: 0 }); const readFile = new ReadFileTool({ files: [], fileSize: 0 }); - const llmTool = new LLMTool({ - llm: createChatLLM({ model: getDefaultModel() }) - }); + const llmTool = new LLMTool({ llm: defaultAIProvider.createChatBackend() }); const calculatorTool = new CalculatorTool(); const systemTools = new Map(); diff --git a/src/users/users.service.ts b/src/users/users.service.ts index e63bcbf..7dd0013 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -35,12 +35,13 @@ import { Project } from '@/administration/entities/project.entity.js'; import { Organization } from '@/administration/entities/organization.entity.js'; import { IBM_ORGANIZATION_OWNER_ID } from '@/config.js'; import { Assistant } from '@/assistants/assistant.entity.js'; -import { Agent, getDefaultModel } from '@/runs/execution/constants.js'; +import { Agent } from '@/runs/execution/constants.js'; import { SystemTools } from '@/tools/entities/tool-calls/system-call.entity.js'; import { VECTOR_STORE_DEFAULT_MAX_NUM_RESULTS } from '@/vector-stores/constants.js'; import { SystemUsage } from '@/tools/entities/tool-usages/system-usage.entity.js'; import { FileSearchUsage } from '@/tools/entities/tool-usages/file-search-usage.entity.js'; import { CodeInterpreterUsage } from '@/tools/entities/tool-usages/code-interpreter-usage.entity.js'; +import { defaultAIProvider } from '@/runs/execution/provider'; const getUserLogger = (userId: string) => getServiceLogger('user').child({ userId }); @@ -130,7 +131,7 @@ export async function createUser({ user.defaultProject = ORM.em.getRepository(Project).getReference(project.id, { wrapped: true }); const assistant = new Assistant({ - model: getDefaultModel(), + model: defaultAIProvider.createAssistantBackend().modelId, agent: Agent.BEE, tools: [ new SystemUsage({ toolId: SystemTools.WEB_SEARCH }), diff --git a/src/vector-store-files/execution/client.ts b/src/vector-store-files/execution/client.ts index a7fd593..242e3a7 100644 --- a/src/vector-store-files/execution/client.ts +++ b/src/vector-store-files/execution/client.ts @@ -20,7 +20,7 @@ import { MilvusVectorStore } from './vector_db/adapters/milvus.js'; import { VectorDbDocumentSchema } from './vector_db/types.js'; import { VectorStoreClient } from './vector_db/adapters/interface.js'; -import { VECTOR_STORE_EMBEDDING_MODEL } from '@/vector-stores/constants.js'; +import { defaultAIProvider } from '@/runs/execution/provider'; export const DocumentSchema = VectorDbDocumentSchema.extend({}); export type Document = z.infer; @@ -28,7 +28,7 @@ export type DocumentType = z.ZodType; export function getVectorStoreClient(): VectorStoreClient { return new MilvusVectorStore({ - modelName: VECTOR_STORE_EMBEDDING_MODEL, + modelName: defaultAIProvider.createEmbeddingBackend().modelId, documentSchema: DocumentSchema }); } diff --git a/src/vector-store-files/execution/process-file.ts b/src/vector-store-files/execution/process-file.ts index a04e86f..4ca2e91 100644 --- a/src/vector-store-files/execution/process-file.ts +++ b/src/vector-store-files/execution/process-file.ts @@ -29,9 +29,8 @@ import { ORM } from '@/database.js'; import { APIError } from '@/errors/error.entity.js'; import { getVectorStoreClient } from '@/vector-store-files/execution/client.js'; import { watchForCancellation } from '@/utils/jobs.js'; -import { createEmbeddingAdapter } from '@/embedding/factory'; -import { VECTOR_STORE_EMBEDDING_MODEL } from '@/vector-stores/constants'; import { getExtractedChunks } from '@/files/extraction/helpers'; +import { defaultAIProvider } from '@/runs/execution/provider'; const getJobLogger = (vectorStoreId: string, fileId?: string) => getLogger().child({ vectorStoreId, fileId }, { msgPrefix: '[vector-store-process] ' }); @@ -65,12 +64,10 @@ export async function processVectorStoreFile(vectorStoreFile: Loaded) { - const embeddingAdapter = await createEmbeddingAdapter(VECTOR_STORE_EMBEDDING_MODEL); + const embeddingAdapter = defaultAIProvider.createEmbeddingBackend(); for await (const items of source) { - const embeddings = await embeddingAdapter.embedMany(items, { - signal: controller.signal - }); - yield embeddings.map((embedding, idx) => ({ + const output = await embeddingAdapter.embed(items, { signal: controller.signal }); + yield output.embeddings.map((embedding, idx) => ({ embedding: embedding, text: items[idx] })); diff --git a/src/vector-stores/constants.ts b/src/vector-stores/constants.ts index d88d626..95f3363 100644 --- a/src/vector-stores/constants.ts +++ b/src/vector-stores/constants.ts @@ -14,9 +14,6 @@ * limitations under the License. */ -import { getDefaultEmbeddingModel } from '@/embedding/factory'; - -export const VECTOR_STORE_EMBEDDING_MODEL = getDefaultEmbeddingModel(); export const VECTOR_STORE_DEFAULT_MAX_CHUNK_SIZE_TOKENS = 400; export const VECTOR_STORE_DEFAULT_CHUNK_OVERLAP_TOKENS = 200; export const VECTOR_STORE_DEFAULT_MAX_NUM_RESULTS = 5;