From 6fe32b8cb02bc0d306b677fdfe25adedc6f62de8 Mon Sep 17 00:00:00 2001 From: Junjie Tang <33489572+jjtang1985@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:05:45 +0100 Subject: [PATCH] fix: Use types instead of interfaces (#274) --- .changeset/interface-vs-type.md | 6 ++++++ .../src/client/api/schema/azure-content-safety.ts | 6 +++--- .../src/client/api/schema/filtering-module-config.ts | 4 ++-- .../src/client/api/schema/masking-module-config.ts | 4 ++-- .../orchestration/src/client/api/schema/module-results.ts | 5 ++--- 5 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 .changeset/interface-vs-type.md diff --git a/.changeset/interface-vs-type.md b/.changeset/interface-vs-type.md new file mode 100644 index 00000000..2d738651 --- /dev/null +++ b/.changeset/interface-vs-type.md @@ -0,0 +1,6 @@ +--- +'@sap-ai-sdk/orchestration': minor +--- +[Compatibility Note] Switch some of the orchestration interfaces to types, as they were introduced by accident. + +[Compatibility Note] Remove `grounding` key from the type `ModuleResults`. diff --git a/packages/orchestration/src/client/api/schema/azure-content-safety.ts b/packages/orchestration/src/client/api/schema/azure-content-safety.ts index 3df7f9dd..02d28c89 100644 --- a/packages/orchestration/src/client/api/schema/azure-content-safety.ts +++ b/packages/orchestration/src/client/api/schema/azure-content-safety.ts @@ -5,11 +5,11 @@ */ import type { AzureThreshold } from './azure-threshold.js'; /** - * Filter configuration for Azure Content Safety. + * Filter configuration for Azure Content Safety */ -export interface AzureContentSafety { +export type AzureContentSafety = { Hate?: AzureThreshold; SelfHarm?: AzureThreshold; Sexual?: AzureThreshold; Violence?: AzureThreshold; -} +}; diff --git a/packages/orchestration/src/client/api/schema/filtering-module-config.ts b/packages/orchestration/src/client/api/schema/filtering-module-config.ts index f4e10b67..50e5df09 100644 --- a/packages/orchestration/src/client/api/schema/filtering-module-config.ts +++ b/packages/orchestration/src/client/api/schema/filtering-module-config.ts @@ -7,7 +7,7 @@ import type { FilteringConfig } from './filtering-config.js'; /** * Representation of the 'FilteringModuleConfig' schema. */ -export interface FilteringModuleConfig { +export type FilteringModuleConfig = { /** * List of provider type and filters. */ @@ -16,4 +16,4 @@ export interface FilteringModuleConfig { * List of provider type and filters. */ output?: FilteringConfig; -} +}; 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 cf22074a..267e302e 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,10 @@ import type { MaskingProviderConfig } from './masking-provider-config.js'; /** * Representation of the 'MaskingModuleConfig' schema. */ -export interface MaskingModuleConfig { +export type MaskingModuleConfig = { /** * List of masking service providers * Min Items: 1. */ masking_providers: MaskingProviderConfig[]; -} +}; diff --git a/packages/orchestration/src/client/api/schema/module-results.ts b/packages/orchestration/src/client/api/schema/module-results.ts index 15c89b8e..fb390793 100644 --- a/packages/orchestration/src/client/api/schema/module-results.ts +++ b/packages/orchestration/src/client/api/schema/module-results.ts @@ -10,12 +10,11 @@ import type { LlmChoice } from './llm-choice.js'; /** * Results of each module. */ -export interface ModuleResults { - grounding?: GenericModuleResult; +export type ModuleResults = { templating?: ChatMessages; input_masking?: GenericModuleResult; input_filtering?: GenericModuleResult; llm?: LlmModuleResult; output_filtering?: GenericModuleResult; output_unmasking?: LlmChoice[]; -} +};