diff --git a/packages/orchestration/src/client/api/schema/azure-content-safety-input.ts b/packages/orchestration/src/client/api/schema/azure-content-safety-input.ts index 286719ea0..f40c7676f 100644 --- a/packages/orchestration/src/client/api/schema/azure-content-safety-input.ts +++ b/packages/orchestration/src/client/api/schema/azure-content-safety-input.ts @@ -13,7 +13,7 @@ export type AzureContentSafetyInput = { sexual?: AzureThreshold; violence?: AzureThreshold; /** - * A flag to use prompt shield + * Filter prompts for harmful content such as jailbreaks and prompt injections. */ prompt_shield?: boolean; }; diff --git a/packages/orchestration/src/client/api/schema/azure-content-safety-output.ts b/packages/orchestration/src/client/api/schema/azure-content-safety-output.ts index cc692f02b..09117d993 100644 --- a/packages/orchestration/src/client/api/schema/azure-content-safety-output.ts +++ b/packages/orchestration/src/client/api/schema/azure-content-safety-output.ts @@ -12,4 +12,8 @@ export type AzureContentSafetyOutput = { self_harm?: AzureThreshold; sexual?: AzureThreshold; violence?: AzureThreshold; + /** + * Detect protected code content from known GitHub repositories. The scan includes software libraries, source code, algorithms, and other proprietary programming content. + */ + protected_material_code?: boolean; }; diff --git a/packages/orchestration/src/client/api/schema/completion-post-request.ts b/packages/orchestration/src/client/api/schema/completion-post-request.ts index 0254223c6..27876b8e3 100644 --- a/packages/orchestration/src/client/api/schema/completion-post-request.ts +++ b/packages/orchestration/src/client/api/schema/completion-post-request.ts @@ -3,22 +3,13 @@ * * This is a generated file powered by the SAP Cloud SDK for JavaScript. */ -import type { OrchestrationConfig } from './orchestration-config.js'; -import type { ChatMessages } from './chat-messages.js'; +import type { CompletionRequestConfiguration } from './completion-request-configuration.js'; +import type { CompletionRequestConfigurationReferenceById } from './completion-request-configuration-reference-by-id.js'; +import type { CompletionRequestConfigurationReferenceByNameScenarioVersion } from './completion-request-configuration-reference-by-name-scenario-version.js'; /** * Representation of the 'CompletionPostRequest' schema. */ -export type CompletionPostRequest = { - config: OrchestrationConfig; - /** - * @example { - * "groundingInput": "What is SAP Joule?", - * "inputContext": "optimizing supply chain management" - * } - */ - placeholder_values?: Record; - /** - * History of chat messages. Can be used to provide system and assistant messages to set the context of the conversation. Will be merged with the template message - */ - messages_history?: ChatMessages; -}; +export type CompletionPostRequest = + | CompletionRequestConfiguration + | CompletionRequestConfigurationReferenceById + | CompletionRequestConfigurationReferenceByNameScenarioVersion; diff --git a/packages/orchestration/src/client/api/schema/completion-post-response-streaming.ts b/packages/orchestration/src/client/api/schema/completion-post-response-streaming.ts index 418850747..8fd38fe2f 100644 --- a/packages/orchestration/src/client/api/schema/completion-post-response-streaming.ts +++ b/packages/orchestration/src/client/api/schema/completion-post-response-streaming.ts @@ -5,6 +5,7 @@ */ import type { ModuleResultsStreaming } from './module-results-streaming.js'; import type { LLMModuleResultStreaming } from './llm-module-result-streaming.js'; +import type { ErrorStreaming } from './error-streaming.js'; /** * Representation of the 'CompletionPostResponseStreaming' schema. */ @@ -15,4 +16,8 @@ export type CompletionPostResponseStreaming = { request_id: string; intermediate_results?: ModuleResultsStreaming; final_result?: LLMModuleResultStreaming; + /** + * List of errors encountered during processing for unsuccessful modules configurations + */ + intermediate_failures?: ErrorStreaming[]; } & Record; diff --git a/packages/orchestration/src/client/api/schema/completion-post-response.ts b/packages/orchestration/src/client/api/schema/completion-post-response.ts index 573fe1ce3..d2afc9c1d 100644 --- a/packages/orchestration/src/client/api/schema/completion-post-response.ts +++ b/packages/orchestration/src/client/api/schema/completion-post-response.ts @@ -5,6 +5,7 @@ */ import type { ModuleResults } from './module-results.js'; import type { LlmModuleResult } from './llm-module-result.js'; +import type { Error } from './error.js'; /** * Representation of the 'CompletionPostResponse' schema. */ @@ -16,4 +17,8 @@ export type CompletionPostResponse = { request_id: string; intermediate_results: ModuleResults; final_result: LlmModuleResult; + /** + * List of errors encountered during processing for unsuccessful modules configurations + */ + intermediate_failures?: Error[]; } & Record; diff --git a/packages/orchestration/src/client/api/schema/completion-request-configuration-reference-by-id-config-ref.ts b/packages/orchestration/src/client/api/schema/completion-request-configuration-reference-by-id-config-ref.ts new file mode 100644 index 000000000..8834dc161 --- /dev/null +++ b/packages/orchestration/src/client/api/schema/completion-request-configuration-reference-by-id-config-ref.ts @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * + * This is a generated file powered by the SAP Cloud SDK for JavaScript. + */ + +/** + * Representation of the 'CompletionRequestConfigurationReferenceByIdConfigRef' schema. + */ +export type CompletionRequestConfigurationReferenceByIdConfigRef = { + /** + * @example "f47ac10b-58cc-4372-a567-0e02b2c3d479" + */ + id: string; +}; diff --git a/packages/orchestration/src/client/api/schema/completion-request-configuration-reference-by-id.ts b/packages/orchestration/src/client/api/schema/completion-request-configuration-reference-by-id.ts new file mode 100644 index 000000000..cfab0addb --- /dev/null +++ b/packages/orchestration/src/client/api/schema/completion-request-configuration-reference-by-id.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * + * This is a generated file powered by the SAP Cloud SDK for JavaScript. + */ +import type { CompletionRequestConfigurationReferenceByIdConfigRef } from './completion-request-configuration-reference-by-id-config-ref.js'; +import type { ChatMessages } from './chat-messages.js'; +/** + * Representation of the 'CompletionRequestConfigurationReferenceById' schema. + */ +export type CompletionRequestConfigurationReferenceById = { + config_ref: CompletionRequestConfigurationReferenceByIdConfigRef; + /** + * @example { + * "groundingInput": "What is SAP Joule?", + * "inputContext": "optimizing supply chain management" + * } + */ + placeholder_values?: Record; + /** + * History of chat messages. Can be used to provide system and assistant messages to set the context of the conversation. Will be merged with the template message + */ + messages_history?: ChatMessages; +}; diff --git a/packages/orchestration/src/client/api/schema/completion-request-configuration-reference-by-name-scenario-version-config-ref.ts b/packages/orchestration/src/client/api/schema/completion-request-configuration-reference-by-name-scenario-version-config-ref.ts new file mode 100644 index 000000000..89681a372 --- /dev/null +++ b/packages/orchestration/src/client/api/schema/completion-request-configuration-reference-by-name-scenario-version-config-ref.ts @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * + * This is a generated file powered by the SAP Cloud SDK for JavaScript. + */ + +/** + * Representation of the 'CompletionRequestConfigurationReferenceByNameScenarioVersionConfigRef' schema. + */ +export type CompletionRequestConfigurationReferenceByNameScenarioVersionConfigRef = + { + scenario: string; + name: string; + version: string; + }; diff --git a/packages/orchestration/src/client/api/schema/completion-request-configuration-reference-by-name-scenario-version.ts b/packages/orchestration/src/client/api/schema/completion-request-configuration-reference-by-name-scenario-version.ts new file mode 100644 index 000000000..797d7a9f5 --- /dev/null +++ b/packages/orchestration/src/client/api/schema/completion-request-configuration-reference-by-name-scenario-version.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * + * This is a generated file powered by the SAP Cloud SDK for JavaScript. + */ +import type { CompletionRequestConfigurationReferenceByNameScenarioVersionConfigRef } from './completion-request-configuration-reference-by-name-scenario-version-config-ref.js'; +import type { ChatMessages } from './chat-messages.js'; +/** + * Representation of the 'CompletionRequestConfigurationReferenceByNameScenarioVersion' schema. + */ +export type CompletionRequestConfigurationReferenceByNameScenarioVersion = { + config_ref: CompletionRequestConfigurationReferenceByNameScenarioVersionConfigRef; + /** + * @example { + * "groundingInput": "What is SAP Joule?", + * "inputContext": "optimizing supply chain management" + * } + */ + placeholder_values?: Record; + /** + * History of chat messages. Can be used to provide system and assistant messages to set the context of the conversation. Will be merged with the template message + */ + messages_history?: ChatMessages; +}; diff --git a/packages/orchestration/src/client/api/schema/completion-request-configuration.ts b/packages/orchestration/src/client/api/schema/completion-request-configuration.ts new file mode 100644 index 000000000..a560846f8 --- /dev/null +++ b/packages/orchestration/src/client/api/schema/completion-request-configuration.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * + * This is a generated file powered by the SAP Cloud SDK for JavaScript. + */ +import type { OrchestrationConfig } from './orchestration-config.js'; +import type { ChatMessages } from './chat-messages.js'; +/** + * Representation of the 'CompletionRequestConfiguration' schema. + */ +export type CompletionRequestConfiguration = { + config: OrchestrationConfig; + /** + * @example { + * "groundingInput": "What is SAP Joule?", + * "inputContext": "optimizing supply chain management" + * } + */ + placeholder_values?: Record; + /** + * History of chat messages. Can be used to provide system and assistant messages to set the context of the conversation. Will be merged with the template message + */ + messages_history?: ChatMessages; +}; diff --git a/packages/orchestration/src/client/api/schema/embeddings-model-details.ts b/packages/orchestration/src/client/api/schema/embeddings-model-details.ts index 8d6a772be..26f436bff 100644 --- a/packages/orchestration/src/client/api/schema/embeddings-model-details.ts +++ b/packages/orchestration/src/client/api/schema/embeddings-model-details.ts @@ -14,4 +14,17 @@ export type EmbeddingsModelDetails = { */ version?: string; params?: EmbeddingsModelParams; + /** + * Timeout for the Embeddings request in seconds. This parameter is currently ignored for Vertex AI models. + * Default: 600. + * Maximum: 600. + * Minimum: 1. + */ + timeout?: number; + /** + * Maximum number of retries for the Embeddings request. This parameter is currently ignored for Vertex AI models. + * Default: 2. + * Maximum: 5. + */ + max_retries?: number; }; diff --git a/packages/orchestration/src/client/api/schema/embeddings-post-response.ts b/packages/orchestration/src/client/api/schema/embeddings-post-response.ts index 99a31d571..469d42c43 100644 --- a/packages/orchestration/src/client/api/schema/embeddings-post-response.ts +++ b/packages/orchestration/src/client/api/schema/embeddings-post-response.ts @@ -11,5 +11,5 @@ import type { EmbeddingsResponse } from './embeddings-response.js'; export type EmbeddingsPostResponse = { request_id: string; intermediate_results?: ModuleResultsBase; - final_result?: EmbeddingsResponse; + final_result: EmbeddingsResponse; }; diff --git a/packages/orchestration/src/client/api/schema/error-list.ts b/packages/orchestration/src/client/api/schema/error-list.ts new file mode 100644 index 000000000..367e997f2 --- /dev/null +++ b/packages/orchestration/src/client/api/schema/error-list.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * + * This is a generated file powered by the SAP Cloud SDK for JavaScript. + */ +import type { Error } from './error.js'; +/** + * Representation of the 'ErrorList' schema. + * Min Items: 1. + */ +export type ErrorList = Error[]; diff --git a/packages/orchestration/src/client/api/schema/error-response-streaming.ts b/packages/orchestration/src/client/api/schema/error-response-streaming.ts index abd8e18a2..6dc0084f3 100644 --- a/packages/orchestration/src/client/api/schema/error-response-streaming.ts +++ b/packages/orchestration/src/client/api/schema/error-response-streaming.ts @@ -4,9 +4,10 @@ * This is a generated file powered by the SAP Cloud SDK for JavaScript. */ import type { ErrorStreaming } from './error-streaming.js'; +import type { ErrorStreamingList } from './error-streaming-list.js'; /** * Representation of the 'ErrorResponseStreaming' schema. */ export type ErrorResponseStreaming = { - error: ErrorStreaming; + error: ErrorStreaming | ErrorStreamingList; } & Record; diff --git a/packages/orchestration/src/client/api/schema/error-response.ts b/packages/orchestration/src/client/api/schema/error-response.ts index 62403293a..3a6c7ad37 100644 --- a/packages/orchestration/src/client/api/schema/error-response.ts +++ b/packages/orchestration/src/client/api/schema/error-response.ts @@ -4,9 +4,10 @@ * This is a generated file powered by the SAP Cloud SDK for JavaScript. */ import type { Error } from './error.js'; +import type { ErrorList } from './error-list.js'; /** * Representation of the 'ErrorResponse' schema. */ export type ErrorResponse = { - error: Error; + error: Error | ErrorList; } & Record; diff --git a/packages/orchestration/src/client/api/schema/error-streaming-list.ts b/packages/orchestration/src/client/api/schema/error-streaming-list.ts new file mode 100644 index 000000000..4fa0a4e64 --- /dev/null +++ b/packages/orchestration/src/client/api/schema/error-streaming-list.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * + * This is a generated file powered by the SAP Cloud SDK for JavaScript. + */ +import type { ErrorStreaming } from './error-streaming.js'; +/** + * Representation of the 'ErrorStreamingList' schema. + * Min Items: 1. + */ +export type ErrorStreamingList = ErrorStreaming[]; diff --git a/packages/orchestration/src/client/api/schema/error-streaming.ts b/packages/orchestration/src/client/api/schema/error-streaming.ts index 255c82f6c..4eeb66545 100644 --- a/packages/orchestration/src/client/api/schema/error-streaming.ts +++ b/packages/orchestration/src/client/api/schema/error-streaming.ts @@ -26,4 +26,8 @@ export type ErrorStreaming = { */ location: string; intermediate_results?: ModuleResultsStreaming; + /** + * HTTP headers returned from the failed request attempt + */ + headers?: Record; } & Record; diff --git a/packages/orchestration/src/client/api/schema/error.ts b/packages/orchestration/src/client/api/schema/error.ts index 138cd9bd7..7f41ce26d 100644 --- a/packages/orchestration/src/client/api/schema/error.ts +++ b/packages/orchestration/src/client/api/schema/error.ts @@ -26,4 +26,8 @@ export type Error = { */ location: string; intermediate_results?: ModuleResults; + /** + * HTTP headers returned from the failed request attempt + */ + headers?: Record; } & Record; diff --git a/packages/orchestration/src/client/api/schema/index.ts b/packages/orchestration/src/client/api/schema/index.ts index 9dc0b238f..6aaa07ec0 100644 --- a/packages/orchestration/src/client/api/schema/index.ts +++ b/packages/orchestration/src/client/api/schema/index.ts @@ -39,11 +39,13 @@ export * from './completion-post-response.js'; export * from './completion-post-response-streaming.js'; export * from './orchestration-config.js'; export * from './module-configs.js'; +export * from './module-configs-list.js'; export * from './module-results-base.js'; export * from './module-results.js'; export * from './module-results-streaming.js'; export * from './global-stream-options.js'; export * from './generic-module-result.js'; +export * from './input-translation-module-result.js'; export * from './llm-module-result.js'; export * from './llm-module-result-streaming.js'; export * from './llm-choice.js'; @@ -93,10 +95,20 @@ export * from './key-value-list-pair.js'; export * from './search-document-key-value-list-pair.js'; export * from './search-select-option-enum.js'; export * from './translation-module-config.js'; -export * from './sap-document-translation.js'; +export * from './sap-document-translation-input.js'; +export * from './sap-document-translation-output.js'; +export * from './sap-document-translation-output-target-language.js'; +export * from './sap-document-translation-apply-to-selector.js'; export * from './error.js'; +export * from './error-list.js'; export * from './error-streaming.js'; +export * from './error-streaming-list.js'; export * from './error-response.js'; export * from './error-response-streaming.js'; export * from './chat-completion-token-logprob.js'; export * from './choice-logprobs.js'; +export * from './completion-request-configuration.js'; +export * from './completion-request-configuration-reference-by-id.js'; +export * from './completion-request-configuration-reference-by-id-config-ref.js'; +export * from './completion-request-configuration-reference-by-name-scenario-version.js'; +export * from './completion-request-configuration-reference-by-name-scenario-version-config-ref.js'; diff --git a/packages/orchestration/src/client/api/schema/input-translation-module-result.ts b/packages/orchestration/src/client/api/schema/input-translation-module-result.ts new file mode 100644 index 000000000..7bbadd2f1 --- /dev/null +++ b/packages/orchestration/src/client/api/schema/input-translation-module-result.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * + * This is a generated file powered by the SAP Cloud SDK for JavaScript. + */ + +/** + * Input Translation module result + */ +export type InputTranslationModuleResult = { + /** + * Status message describing the translation operation outcome. + * @example "Translated successfully placeholders 'issue_title', 'issue_description'." + */ + message: string; + data?: { + /** + * @deprecated + * @example "[{'role': 'user', 'content': 'translated content'}, ...]" + */ + translated_template?: string; + /** + * @example { + * "user": [ + * "translated user content", + * "another translated user content" + * ], + * "system": [ + * "translated system message" + * ] + * } + */ + translated_template_roles?: Record; + /** + * @example { + * "groundingInput": "translated grounding input", + * "inputContext": "translated input context" + * } + */ + translated_placeholders?: Record; + }; +}; diff --git a/packages/orchestration/src/client/api/schema/llm-model-details.ts b/packages/orchestration/src/client/api/schema/llm-model-details.ts index d87bdf06c..63540ef11 100644 --- a/packages/orchestration/src/client/api/schema/llm-model-details.ts +++ b/packages/orchestration/src/client/api/schema/llm-model-details.ts @@ -5,7 +5,8 @@ */ /** - * Representation of the 'LLMModelDetails' schema. + * The model and parameters to be used for the prompt templating. This is the model that will be used to generate the response. + * */ export type LLMModelDetails = { /** @@ -21,7 +22,7 @@ export type LLMModelDetails = { /** * Additional parameters for the model. Default values are used for mandatory parameters. * @example { - * "max_tokens": 300, + * "max_completion_tokens": 300, * "temperature": 0.1, * "frequency_penalty": 0, * "presence_penalty": 0, @@ -32,4 +33,17 @@ export type LLMModelDetails = { * } */ params?: Record; + /** + * Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI models. + * Default: 600. + * Maximum: 600. + * Minimum: 1. + */ + timeout?: number; + /** + * Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI models. + * Default: 2. + * Maximum: 5. + */ + max_retries?: number; }; diff --git a/packages/orchestration/src/client/api/schema/masking-module-config.ts b/packages/orchestration/src/client/api/schema/masking-module-config.ts index fd65e0258..b1bbf80f4 100644 --- a/packages/orchestration/src/client/api/schema/masking-module-config.ts +++ b/packages/orchestration/src/client/api/schema/masking-module-config.ts @@ -7,10 +7,19 @@ import type { MaskingProviderConfig } from './masking-provider-config.js'; /** * Representation of the 'MaskingModuleConfig' schema. */ -export type MaskingModuleConfig = { - /** - * List of masking service providers - * Min Items: 1. - */ - masking_providers: MaskingProviderConfig[]; -}; +export type MaskingModuleConfig = + | { + /** + * List of masking service providers + * Min Items: 1. + */ + providers: MaskingProviderConfig[]; + } + | { + /** + * List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use `providers` property instead. + * @deprecated + * Min Items: 1. + */ + masking_providers: MaskingProviderConfig[]; + }; diff --git a/packages/orchestration/src/client/api/schema/module-configs-list.ts b/packages/orchestration/src/client/api/schema/module-configs-list.ts new file mode 100644 index 000000000..7b6e037d6 --- /dev/null +++ b/packages/orchestration/src/client/api/schema/module-configs-list.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * + * This is a generated file powered by the SAP Cloud SDK for JavaScript. + */ +import type { ModuleConfigs } from './module-configs.js'; +/** + * A list of module configurations. The first configuration in the list that succeeds will be used. + * + * Min Items: 1. + */ +export type ModuleConfigsList = ModuleConfigs[]; diff --git a/packages/orchestration/src/client/api/schema/module-results-base.ts b/packages/orchestration/src/client/api/schema/module-results-base.ts index e61a526bd..13734fb51 100644 --- a/packages/orchestration/src/client/api/schema/module-results-base.ts +++ b/packages/orchestration/src/client/api/schema/module-results-base.ts @@ -5,13 +5,14 @@ */ import type { GenericModuleResult } from './generic-module-result.js'; import type { TemplatingChatMessage } from './templating-chat-message.js'; +import type { InputTranslationModuleResult } from './input-translation-module-result.js'; /** * Results of each module of /embeddings endpoint(e.g. input masking). */ export type ModuleResultsBase = { grounding?: GenericModuleResult; templating?: TemplatingChatMessage; - input_translation?: GenericModuleResult; + input_translation?: InputTranslationModuleResult; input_masking?: GenericModuleResult; input_filtering?: GenericModuleResult; output_filtering?: GenericModuleResult; diff --git a/packages/orchestration/src/client/api/schema/orchestration-config.ts b/packages/orchestration/src/client/api/schema/orchestration-config.ts index 3b1b61c88..45cb00812 100644 --- a/packages/orchestration/src/client/api/schema/orchestration-config.ts +++ b/packages/orchestration/src/client/api/schema/orchestration-config.ts @@ -4,11 +4,12 @@ * This is a generated file powered by the SAP Cloud SDK for JavaScript. */ import type { ModuleConfigs } from './module-configs.js'; +import type { ModuleConfigsList } from './module-configs-list.js'; import type { GlobalStreamOptions } from './global-stream-options.js'; /** * Representation of the 'OrchestrationConfig' schema. */ export type OrchestrationConfig = { - modules: ModuleConfigs; + modules: ModuleConfigs | ModuleConfigsList; stream?: GlobalStreamOptions; }; diff --git a/packages/orchestration/src/client/api/schema/sap-document-translation-apply-to-selector.ts b/packages/orchestration/src/client/api/schema/sap-document-translation-apply-to-selector.ts new file mode 100644 index 000000000..0489ba63d --- /dev/null +++ b/packages/orchestration/src/client/api/schema/sap-document-translation-apply-to-selector.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * + * This is a generated file powered by the SAP Cloud SDK for JavaScript. + */ + +/** + * This selector allows you to define the scope of translation, such as specific placeholders or messages with specific roles. For example, `{"category": "placeholders", "items": ["user_input"], "source_language": "de-DE"}` targets the value of "user_input" in `placeholder_values` specified in the request payload; and considers the value to be in German. + * + */ +export type SAPDocumentTranslationApplyToSelector = { + /** + * Category to apply translation to. + */ + category: 'placeholders' | 'template_roles'; + /** + * List of placeholders or roles to apply translation to + * @example [ + * "groundingInput", + * "inputContext" + * ] + */ + items: string[]; + /** + * Language of the text to be translated. + * @example "de-DE" + */ + source_language?: string; +}; diff --git a/packages/orchestration/src/client/api/schema/sap-document-translation-input.ts b/packages/orchestration/src/client/api/schema/sap-document-translation-input.ts new file mode 100644 index 000000000..08339b6c1 --- /dev/null +++ b/packages/orchestration/src/client/api/schema/sap-document-translation-input.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * + * This is a generated file powered by the SAP Cloud SDK for JavaScript. + */ +import type { SAPDocumentTranslationApplyToSelector } from './sap-document-translation-apply-to-selector.js'; +/** + * Representation of the 'SAPDocumentTranslationInput' schema. + */ +export type SAPDocumentTranslationInput = { + /** + * Type of document translation provider + * @example "sap_document_translation" + */ + type: 'sap_document_translation'; + /** + * If true, the messages history will be translated as well. + * Default: true. + */ + translate_messages_history?: boolean; + /** + * Configuration for `sap_document_translation` translation provider. + */ + config: { + /** + * Language of the text to be translated. + * @example "de-DE" + */ + source_language?: string; + /** + * Min Items: 1. + */ + apply_to?: SAPDocumentTranslationApplyToSelector[]; + /** + * Language to which the text should be translated. + * @example "en-US" + */ + target_language: string; + }; +}; diff --git a/packages/orchestration/src/client/api/schema/sap-document-translation-output-target-language.ts b/packages/orchestration/src/client/api/schema/sap-document-translation-output-target-language.ts new file mode 100644 index 000000000..f1b68a397 --- /dev/null +++ b/packages/orchestration/src/client/api/schema/sap-document-translation-output-target-language.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. + * + * This is a generated file powered by the SAP Cloud SDK for JavaScript. + */ +import type { SAPDocumentTranslationApplyToSelector } from './sap-document-translation-apply-to-selector.js'; +/** + * Representation of the 'SAPDocumentTranslationOutputTargetLanguage' schema. + */ +export type SAPDocumentTranslationOutputTargetLanguage = + | string + | SAPDocumentTranslationApplyToSelector; diff --git a/packages/orchestration/src/client/api/schema/sap-document-translation.ts b/packages/orchestration/src/client/api/schema/sap-document-translation-output.ts similarity index 61% rename from packages/orchestration/src/client/api/schema/sap-document-translation.ts rename to packages/orchestration/src/client/api/schema/sap-document-translation-output.ts index 2e1a51233..51d52a190 100644 --- a/packages/orchestration/src/client/api/schema/sap-document-translation.ts +++ b/packages/orchestration/src/client/api/schema/sap-document-translation-output.ts @@ -3,29 +3,22 @@ * * This is a generated file powered by the SAP Cloud SDK for JavaScript. */ - +import type { SAPDocumentTranslationOutputTargetLanguage } from './sap-document-translation-output-target-language.js'; /** - * Representation of the 'SAPDocumentTranslation' schema. + * Representation of the 'SAPDocumentTranslationOutput' schema. */ -export type SAPDocumentTranslation = { +export type SAPDocumentTranslationOutput = { /** - * Type of document translation provider + * Configuration for `sap_document_translation` translation provider. * @example "sap_document_translation" */ type: 'sap_document_translation'; - /** - * Configuration for `sap_document_translation` translation provider. - */ config: { /** * Language of the text to be translated. * @example "de-DE" */ source_language?: string; - /** - * Language to which the text should be translated. - * @example "en-US" - */ - target_language: string; + target_language: SAPDocumentTranslationOutputTargetLanguage; }; }; diff --git a/packages/orchestration/src/client/api/schema/template-ref-by-id.ts b/packages/orchestration/src/client/api/schema/template-ref-by-id.ts index 5c5b2fee4..c033c9e52 100644 --- a/packages/orchestration/src/client/api/schema/template-ref-by-id.ts +++ b/packages/orchestration/src/client/api/schema/template-ref-by-id.ts @@ -13,4 +13,10 @@ export type TemplateRefByID = { * @example "template_id" */ id: string; + /** + * Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared across all resource groups within the tenant, while 'resource_group' indicates the template is only accessible within the specific resource group. + * + * Default: "tenant". + */ + scope?: 'resource_group' | 'tenant'; }; diff --git a/packages/orchestration/src/client/api/schema/template-ref-by-scenario-name-version.ts b/packages/orchestration/src/client/api/schema/template-ref-by-scenario-name-version.ts index 205d5c6f3..ed56b6cb6 100644 --- a/packages/orchestration/src/client/api/schema/template-ref-by-scenario-name-version.ts +++ b/packages/orchestration/src/client/api/schema/template-ref-by-scenario-name-version.ts @@ -23,4 +23,10 @@ export type TemplateRefByScenarioNameVersion = { * @example "some version, can be `latest`" */ version: string; + /** + * Defines the scope that is searched for the referenced template. 'tenant' indicates the template is shared across all resource groups within the tenant, while 'resource_group' indicates the template is only accessible within the specific resource group. + * + * Default: "tenant". + */ + scope?: 'resource_group' | 'tenant'; }; diff --git a/packages/orchestration/src/client/api/schema/template.ts b/packages/orchestration/src/client/api/schema/template.ts index 2c958cf32..c2ec0c250 100644 --- a/packages/orchestration/src/client/api/schema/template.ts +++ b/packages/orchestration/src/client/api/schema/template.ts @@ -24,7 +24,7 @@ import type { ChatCompletionTool } from './chat-completion-tool.js'; */ export type Template = { /** - * A chat message array to be formatted with values from input_params. Both role and content can be templated. If messages_history is provided, the templated messages will be appended. + * A chat message array to be formatted with values from placeholder_values. Both role and content can be templated. If messages_history is provided, the templated messages will be appended. */ template: TemplatingChatMessage; /** diff --git a/packages/orchestration/src/client/api/schema/translation-module-config.ts b/packages/orchestration/src/client/api/schema/translation-module-config.ts index 05ee8f5de..c7c65d6af 100644 --- a/packages/orchestration/src/client/api/schema/translation-module-config.ts +++ b/packages/orchestration/src/client/api/schema/translation-module-config.ts @@ -3,7 +3,8 @@ * * This is a generated file powered by the SAP Cloud SDK for JavaScript. */ -import type { SAPDocumentTranslation } from './sap-document-translation.js'; +import type { SAPDocumentTranslationInput } from './sap-document-translation-input.js'; +import type { SAPDocumentTranslationOutput } from './sap-document-translation-output.js'; /** * Configuration for translation module */ @@ -11,9 +12,9 @@ export type TranslationModuleConfig = { /** * Configuration for input translation */ - input?: SAPDocumentTranslation; + input?: SAPDocumentTranslationInput; /** * Configuration for output translation */ - output?: SAPDocumentTranslation; + output?: SAPDocumentTranslationOutput; }; diff --git a/packages/orchestration/src/orchestration-types.ts b/packages/orchestration/src/orchestration-types.ts index 54a900a9f..ab94a9aac 100644 --- a/packages/orchestration/src/orchestration-types.ts +++ b/packages/orchestration/src/orchestration-types.ts @@ -18,12 +18,13 @@ import type { InputFilteringConfig, OutputFilteringConfig, MaskingProviderConfig, - SAPDocumentTranslation, GlobalStreamOptions, ErrorResponse, AzureContentSafetyInputFilterConfig, AzureContentSafetyOutputFilterConfig, - LlamaGuard38BFilterConfig + LlamaGuard38BFilterConfig, + SAPDocumentTranslationInput, + SAPDocumentTranslationOutput } from './client/api/schema/index.js'; /** @@ -418,10 +419,25 @@ export type LlamaGuard38BCategory = keyof LlamaGuard38B; export type ConfigType = 'input' | 'output'; /** - * Parameters for translation configuration. - * @internal + * Input parameters for translation configuration. + */ +interface TranslationConfigParametersInput { + /** + * Language of the text to be translated. + * @example sourceLanguage: 'de-DE' + */ + sourceLanguage?: string; + /** + * Language to which the text should be translated. + * @example targetLanguage: 'en-US' + */ + targetLanguage: string; +} + +/** + * Output parameters for translation configuration. */ -interface TranslationConfigParameters { +interface TranslationConfigParametersOutput { /** * Language of the text to be translated. * @example sourceLanguage: 'de-DE' @@ -437,12 +453,12 @@ interface TranslationConfigParameters { /** * Output parameters for translation output configuration. */ -export type TranslationOutputParameters = TranslationConfigParameters; +export type TranslationOutputParameters = TranslationConfigParametersOutput; /** * Input parameters for translation input configuration. */ -export type TranslationInputParameters = TranslationConfigParameters; +export type TranslationInputParameters = TranslationConfigParametersInput; /** * Parameters for translation configurations. @@ -454,12 +470,12 @@ export type TranslationConfigParams = T extends 'input' /** * Input configuration for translation module. */ -export type TranslationInputConfig = SAPDocumentTranslation; +export type TranslationInputConfig = SAPDocumentTranslationInput; /** * Output configuration for translation module. */ -export type TranslationOutputConfig = SAPDocumentTranslation; +export type TranslationOutputConfig = SAPDocumentTranslationOutput; /** * Return type for translation configurations. diff --git a/packages/orchestration/src/spec/api.yaml b/packages/orchestration/src/spec/api.yaml index 42cddff9a..7b7fee75d 100644 --- a/packages/orchestration/src/spec/api.yaml +++ b/packages/orchestration/src/spec/api.yaml @@ -77,26 +77,12 @@ paths: components: schemas: CompletionPostRequest: - type: object - required: - - config - additionalProperties: false - properties: - config: - $ref: '#/components/schemas/OrchestrationConfig' - placeholder_values: - type: object - example: - groundingInput: 'What is SAP Joule?' - inputContext: 'optimizing supply chain management' - additionalProperties: - type: string - messages_history: - allOf: - - $ref: '#/components/schemas/ChatMessages' - description: History of chat messages. Can be used to provide system and assistant messages to set the context of the conversation. Will be merged with the template message + oneOf: + - $ref: '#/components/schemas/CompletionRequestConfiguration' + - $ref: '#/components/schemas/CompletionRequestConfigurationReferenceById' + - $ref: '#/components/schemas/CompletionRequestConfigurationReferenceByNameScenarioVersion' - # Embedings Schemas + # Embeddings Schemas EmbeddingsPostRequest: type: object additionalProperties: false @@ -172,6 +158,18 @@ components: default: 'latest' params: $ref: '#/components/schemas/EmbeddingsModelParams' + timeout: + description: Timeout for the Embeddings request in seconds. This parameter is currently ignored for Vertex AI models. + type: integer + default: 600 + minimum: 1 + maximum: 600 + max_retries: + description: Maximum number of retries for the Embeddings request. This parameter is currently ignored for Vertex AI models. + type: integer + default: 2 + minimum: 0 + maximum: 5 EmbeddingsModelParams: type: object description: Additional parameters for generating input's embeddings. Default values are used for mandatory parameters. @@ -194,6 +192,7 @@ components: additionalProperties: false required: - request_id + - final_result properties: request_id: type: string @@ -532,6 +531,11 @@ components: $ref: '#/components/schemas/ModuleResults' final_result: $ref: '#/components/schemas/LLMModuleResult' + intermediate_failures: + type: array + description: List of errors encountered during processing for unsuccessful modules configurations + items: + $ref: '#/components/schemas/Error' CompletionPostResponseStreaming: type: object @@ -545,6 +549,11 @@ components: $ref: '#/components/schemas/ModuleResultsStreaming' final_result: $ref: '#/components/schemas/LLMModuleResultStreaming' + intermediate_failures: + type: array + description: List of errors encountered during processing for unsuccessful modules configurations + items: + $ref: '#/components/schemas/ErrorStreaming' OrchestrationConfig: type: object required: @@ -552,7 +561,9 @@ components: additionalProperties: false properties: modules: - $ref: '#/components/schemas/ModuleConfigs' + oneOf: + - $ref: '#/components/schemas/ModuleConfigs' + - $ref: '#/components/schemas/ModuleConfigsList' stream: $ref: '#/components/schemas/GlobalStreamOptions' ModuleConfigs: @@ -571,6 +582,13 @@ components: $ref: '#/components/schemas/GroundingModuleConfig' translation: $ref: '#/components/schemas/TranslationModuleConfig' + ModuleConfigsList: + type: array + items: + $ref: '#/components/schemas/ModuleConfigs' + minItems: 1 + description: > + A list of module configurations. The first configuration in the list that succeeds will be used. # Abstract base class encompassing fields for both `ModuleResults` and `ModuleResultsStreaming` # Not to be instantiated by llm-orchestration code ModuleResultsBase: @@ -583,7 +601,7 @@ components: templating: $ref: '#/components/schemas/TemplatingChatMessage' input_translation: - $ref: '#/components/schemas/GenericModuleResult' + $ref: '#/components/schemas/InputTranslationModuleResult' input_masking: $ref: '#/components/schemas/GenericModuleResult' input_filtering: @@ -656,6 +674,44 @@ components: data: type: object description: Additional data object from the module + + InputTranslationModuleResult: + type: object + description: Input Translation module result + required: + - message + additionalProperties: false + properties: + message: + type: string + description: Status message describing the translation operation outcome. + example: Translated successfully placeholders 'issue_title', 'issue_description'. + data: + type: object + additionalProperties: false + properties: + translated_template: + type: string + deprecated: true + example: "[{'role': 'user', 'content': 'translated content'}, ...]" + translated_template_roles: + type: object + additionalProperties: + type: array + items: + type: string + example: + user: + ['translated user content', 'another translated user content'] + system: ['translated system message'] + translated_placeholders: + type: object + additionalProperties: + type: string + example: + groundingInput: 'translated grounding input' + inputContext: 'translated input context' + LLMModuleResult: type: object description: Output from LLM. Follows the OpenAI spec. @@ -797,11 +853,11 @@ components: - $ref: '#/components/schemas/Template' - $ref: '#/components/schemas/TemplateRef' model: - description: > - The model and parameters to be used for the prompt templating. This is the model that will be used to generate the response. $ref: '#/components/schemas/LLMModelDetails' LLMModelDetails: type: object + description: > + The model and parameters to be used for the prompt templating. This is the model that will be used to generate the response. required: - name additionalProperties: false @@ -819,13 +875,25 @@ components: description: Additional parameters for the model. Default values are used for mandatory parameters. additionalProperties: true example: - max_tokens: 300 + max_completion_tokens: 300 # max_tokens param has been deprecated in Azure Open AI spec temperature: 0.1 frequency_penalty: 0 presence_penalty: 0 n: 2 stream_options: include_usage: true + timeout: + description: Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI models. + type: integer + default: 600 + minimum: 1 + maximum: 600 + max_retries: + description: Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI models. + type: integer + default: 2 + minimum: 0 + maximum: 5 # --- Templating Module with User Defined Template --- # response_format api definition taken from: https://github.com/openai/openai-openapi/blob/e0cb2d721753e13e69e918465795d6e9f87ab15a/openapi.yaml#L12286 @@ -839,7 +907,7 @@ components: template: allOf: - $ref: '#/components/schemas/TemplatingChatMessage' - description: A chat message array to be formatted with values from input_params. Both role and content can be templated. If messages_history is provided, the templated messages will be appended. + description: A chat message array to be formatted with values from placeholder_values. Both role and content can be templated. If messages_history is provided, the templated messages will be appended. defaults: description: Optional default values for the template. If a parameter has no default it is required. type: object @@ -1018,6 +1086,16 @@ components: type: string description: ID of the template in prompt registry example: 'template_id' + scope: + type: string + description: > + Defines the scope that is searched for the referenced template. + 'tenant' indicates the template is shared across all resource groups within the tenant, + while 'resource_group' indicates the template is only accessible within the specific resource group. + enum: + - resource_group + - tenant + default: tenant TemplateRefByScenarioNameVersion: type: object @@ -1039,6 +1117,16 @@ components: type: string description: Version of the template example: 'some version, can be `latest`' + scope: + type: string + description: > + Defines the scope that is searched for the referenced template. + 'tenant' indicates the template is shared across all resource groups within the tenant, + while 'resource_group' indicates the template is only accessible within the specific resource group. + enum: + - resource_group + - tenant + default: tenant # --- Filtering Module --- FilteringModuleConfig: @@ -1150,7 +1238,7 @@ components: $ref: '#/components/schemas/AzureThreshold' prompt_shield: type: boolean - description: A flag to use prompt shield + description: Filter prompts for harmful content such as jailbreaks and prompt injections. default: false AzureContentSafetyOutput: @@ -1166,6 +1254,10 @@ components: $ref: '#/components/schemas/AzureThreshold' violence: $ref: '#/components/schemas/AzureThreshold' + protected_material_code: + type: boolean + description: Detect protected code content from known GitHub repositories. The scan includes software libraries, source code, algorithms, and other proprietary programming content. + default: false AzureThreshold: type: integer @@ -1228,19 +1320,33 @@ components: type: boolean # --- Masking module --- - MaskingModuleConfig: - type: object - required: - - masking_providers - additionalProperties: false - properties: - masking_providers: - type: array - minItems: 1 - items: - $ref: '#/components/schemas/MaskingProviderConfig' - description: List of masking service providers + oneOf: + - type: object + title: MaskingModuleConfigProviders + properties: + providers: + description: List of masking service providers + type: array + minItems: 1 + items: + $ref: '#/components/schemas/MaskingProviderConfig' + required: + - providers + additionalProperties: false + - type: object + title: MaskingModuleConfigMaskingProviders + properties: + masking_providers: + deprecated: true + description: 'List of masking service providers. **DEPRECATED**: will be removed Sept 15, 2026. Use `providers` property instead.' + type: array + minItems: 1 + items: + $ref: '#/components/schemas/MaskingProviderConfig' + required: + - masking_providers + additionalProperties: false MaskingProviderConfig: oneOf: @@ -1561,12 +1667,13 @@ components: input: description: Configuration for input translation oneOf: - - $ref: '#/components/schemas/SAPDocumentTranslation' + - $ref: '#/components/schemas/SAPDocumentTranslationInput' output: description: Configuration for output translation oneOf: - - $ref: '#/components/schemas/SAPDocumentTranslation' - SAPDocumentTranslation: + - $ref: '#/components/schemas/SAPDocumentTranslationOutput' + + SAPDocumentTranslationInput: type: object required: - type @@ -1577,23 +1684,94 @@ components: description: Type of document translation provider type: string enum: - - sap_document_translation # this would be different for other translation provider + - sap_document_translation example: sap_document_translation + translate_messages_history: + type: boolean + description: If true, the messages history will be translated as well. + default: true config: # `config` key, parameters specific to SAP Translation Hub that are sent to the service, might differ for translation provider description: Configuration for `sap_document_translation` translation provider. type: object + additionalProperties: false required: - target_language - additionalProperties: false properties: source_language: type: string description: Language of the text to be translated. example: 'de-DE' + apply_to: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/SAPDocumentTranslationApplyToSelector' target_language: type: string description: Language to which the text should be translated. example: 'en-US' + + SAPDocumentTranslationOutput: + type: object + required: + - type + - config + additionalProperties: false + properties: + type: + description: Configuration for `sap_document_translation` translation provider. + type: string + enum: + - sap_document_translation + example: sap_document_translation + config: + type: object + additionalProperties: false + required: + - target_language + properties: + source_language: + type: string + description: Language of the text to be translated. + example: 'de-DE' + target_language: + $ref: '#/components/schemas/SAPDocumentTranslationOutputTargetLanguage' + + SAPDocumentTranslationOutputTargetLanguage: + oneOf: + - type: string + description: Language to which the text should be translated. + example: 'en-US' + - $ref: '#/components/schemas/SAPDocumentTranslationApplyToSelector' + + SAPDocumentTranslationApplyToSelector: + type: object + description: > + This selector allows you to define the scope of translation, such as specific placeholders or messages with specific roles. For example, `{"category": "placeholders", "items": ["user_input"], "source_language": "de-DE"}` targets the value of "user_input" in `placeholder_values` specified in the request payload; and considers the value to be in German. + required: + - category + - items + additionalProperties: false + properties: + category: + type: string + description: Category to apply translation to. + enum: + - placeholders + - template_roles + items: + type: array + description: List of placeholders or roles to apply translation to + items: + type: string + example: + - groundingInput + - inputContext + source_language: + type: string + description: Language of the text to be translated. + example: 'de-DE' + Error: type: object required: @@ -1617,6 +1795,17 @@ components: example: 'LLM Module' intermediate_results: $ref: '#/components/schemas/ModuleResults' + headers: + type: object + additionalProperties: + type: string + description: 'HTTP headers returned from the failed request attempt' + + ErrorList: + type: array + items: + $ref: '#/components/schemas/Error' + minItems: 1 ErrorStreaming: type: object @@ -1641,6 +1830,17 @@ components: example: 'LLM Module' intermediate_results: $ref: '#/components/schemas/ModuleResultsStreaming' + headers: + type: object + additionalProperties: + type: string + description: 'HTTP headers returned from the failed request attempt' + + ErrorStreamingList: + type: array + items: + $ref: '#/components/schemas/ErrorStreaming' + minItems: 1 ErrorResponse: type: object @@ -1648,7 +1848,9 @@ components: - error properties: error: - $ref: '#/components/schemas/Error' + oneOf: + - $ref: '#/components/schemas/Error' + - $ref: '#/components/schemas/ErrorList' ErrorResponseStreaming: type: object @@ -1656,7 +1858,9 @@ components: - error properties: error: - $ref: '#/components/schemas/ErrorStreaming' + oneOf: + - $ref: '#/components/schemas/ErrorStreaming' + - $ref: '#/components/schemas/ErrorStreamingList' # ref : https://github.com/openai/openai-python/blob/main/src/openai/types/chat/chat_completion_token_logprob.py ChatCompletionTokenLogprob: @@ -1716,6 +1920,93 @@ components: items: $ref: '#/components/schemas/ChatCompletionTokenLogprob' description: A list of message refusal tokens with log probability information. + CompletionRequestConfiguration: + type: object + title: 'Completion Request Configuration' + required: + - config + additionalProperties: false + properties: + config: + $ref: '#/components/schemas/OrchestrationConfig' + placeholder_values: + type: object + example: + groundingInput: 'What is SAP Joule?' + inputContext: 'optimizing supply chain management' + additionalProperties: + type: string + messages_history: + allOf: + - $ref: '#/components/schemas/ChatMessages' + description: History of chat messages. Can be used to provide system and assistant messages to set the context of the conversation. Will be merged with the template message + + CompletionRequestConfigurationReferenceById: + type: object + title: 'Completion Request Configuration Reference By Id' + required: + - config_ref + additionalProperties: false + properties: + config_ref: + $ref: '#/components/schemas/CompletionRequestConfigurationReferenceByIdConfigRef' + placeholder_values: + type: object + example: + groundingInput: 'What is SAP Joule?' + inputContext: 'optimizing supply chain management' + additionalProperties: + type: string + messages_history: + allOf: + - $ref: '#/components/schemas/ChatMessages' + description: History of chat messages. Can be used to provide system and assistant messages to set the context of the conversation. Will be merged with the template message + + CompletionRequestConfigurationReferenceByIdConfigRef: + type: object + required: + - id + additionalProperties: false + properties: + id: + type: string + example: 'f47ac10b-58cc-4372-a567-0e02b2c3d479' + + CompletionRequestConfigurationReferenceByNameScenarioVersion: + type: object + title: 'Completion Request Configuration Reference By Name-Scenario-Version' + required: + - config_ref + additionalProperties: false + properties: + config_ref: + $ref: '#/components/schemas/CompletionRequestConfigurationReferenceByNameScenarioVersionConfigRef' + placeholder_values: + type: object + example: + groundingInput: 'What is SAP Joule?' + inputContext: 'optimizing supply chain management' + additionalProperties: + type: string + messages_history: + allOf: + - $ref: '#/components/schemas/ChatMessages' + description: History of chat messages. Can be used to provide system and assistant messages to set the context of the conversation. Will be merged with the template message + + CompletionRequestConfigurationReferenceByNameScenarioVersionConfigRef: + type: object + required: + - scenario + - name + - version + additionalProperties: false + properties: + scenario: + type: string + name: + type: string + version: + type: string responses: BadRequest: diff --git a/packages/orchestration/src/util/filtering.ts b/packages/orchestration/src/util/filtering.ts index 6f0fb79a3..740437339 100644 --- a/packages/orchestration/src/util/filtering.ts +++ b/packages/orchestration/src/util/filtering.ts @@ -1,10 +1,5 @@ import { supportedAzureFilterThresholds } from '../orchestration-types.js'; import type { - AzureContentSafetyInputFilterConfig, - AzureContentSafetyOutputFilterConfig -} from '../client/api/schema/index.js'; -import type { - AzureContentSafetyFilterInputParameters, AzureContentSafetyFilterParameters, AzureContentSafetyFilterReturnType, AzureFilterThreshold, @@ -37,7 +32,7 @@ export function buildAzureContentSafetyFilter( if (type === 'input') { const { prompt_shield, ...rest } = - config as AzureContentSafetyFilterInputParameters; + config as AzureContentSafetyFilterParameters<'input'>; return { type: 'azure_content_safety', config: { @@ -49,7 +44,7 @@ export function buildAzureContentSafetyFilter( ), ...(prompt_shield !== undefined && { prompt_shield }) } - } as AzureContentSafetyInputFilterConfig; + } as AzureContentSafetyFilterReturnType; } return { @@ -62,7 +57,7 @@ export function buildAzureContentSafetyFilter( ]) ) } - } as AzureContentSafetyOutputFilterConfig; + } as AzureContentSafetyFilterReturnType; } /** diff --git a/packages/orchestration/src/util/translation.test.ts b/packages/orchestration/src/util/translation.test.ts index 0504a620a..35b4ea621 100644 --- a/packages/orchestration/src/util/translation.test.ts +++ b/packages/orchestration/src/util/translation.test.ts @@ -1,14 +1,34 @@ import { buildTranslationConfig } from './translation.js'; -import type { SAPDocumentTranslation } from '../client/api/schema/index.js'; +import type { + SAPDocumentTranslationInput, + SAPDocumentTranslationOutput +} from '../client/api/schema/index.js'; describe('Translation module config', () => { - it('builds translation config', async () => { + it('builds input translation config', async () => { const translationConfig = buildTranslationConfig('input', { sourceLanguage: 'de-DE', targetLanguage: 'en-US' }); - const expectedTranslationConfig: SAPDocumentTranslation = { + const expectedTranslationConfig: SAPDocumentTranslationInput = { + type: 'sap_document_translation', + config: { + source_language: 'de-DE', + target_language: 'en-US' + } + }; + + expect(translationConfig).toEqual(expectedTranslationConfig); + }); + + it('builds output translation config', async () => { + const translationConfig = buildTranslationConfig('output', { + sourceLanguage: 'de-DE', + targetLanguage: 'en-US' + }); + + const expectedTranslationConfig: SAPDocumentTranslationOutput = { type: 'sap_document_translation', config: { source_language: 'de-DE',