Skip to content

Commit

Permalink
chore: Update orchestration spec (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatKuhr authored Aug 30, 2024
1 parent b20b520 commit 2fda139
Show file tree
Hide file tree
Showing 33 changed files with 267 additions and 171 deletions.
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ export default [
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off'
}
},
{
ignores: ['**/dist-cjs/**/*']
}
];
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import type { AzureContentSafety } from './azure-content-safety.js';
export type AzureContentSafetyFilterConfig = {
/**
* String represents name of the filter provider.
* @example "azure_content_safety"
*/
type: 'azure_content_safety';
/**
* Filter configuration for Azure Content Azure Content Safety.
*/
config?: AzureContentSafety;
} & Record<string, any>;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import type { AzureThreshold } from './azure-threshold.js';
/**
* Representation of the 'AzureContentSafety' schema.
* Filter configuration for Azure Content Safety.
*/
export interface AzureContentSafety {
Hate?: AzureThreshold;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
* Representation of the 'ChatMessage' schema.
*/
export type ChatMessage = {
/**
* @example "user"
*/
role: string;
/**
* @example "What is SAP S/4HANA?"
*/
content: string;
} & Record<string, any>;
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/
import type { OrchestrationConfig } from './orchestration-config.js';
import type { InputParamsEntry } from './input-params-entry.js';
import type { ChatMessages } from './chat-messages.js';
/**
* Representation of the 'CompletionPostRequest' schema.
*/
export type CompletionPostRequest = {
orchestration_config: OrchestrationConfig;
input_params?: Record<string, InputParamsEntry>;
/**
* @example {
* "groundingInput": "What is SAP Joule?",
* "inputContext": "optimizing supply chain management"
* }
*/
input_params?: Record<string, string>;
/**
* 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;
} & Record<string, any>;
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { LLMModuleResult } from './llm-module-result.js';
export type CompletionPostResponse = {
/**
* ID of the request.
* @example "d4a67ea1-2bf9-4df7-8105-d48203ccff76"
*/
request_id: string;
module_results: ModuleResults;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2024 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 { DPIEntityConfig } from './dpi-entity-config.js';
/**
* Representation of the 'DPIConfig' schema.
*/
export type DPIConfig = {
/**
* Type of masking service provider.
*/
type: 'sap_data_privacy_integration';
/**
* Type of masking method to be used.
*/
method: 'anonymization' | 'pseudonymization';
/**
* List of entities to be masked
* Min Items: 1.
*/
entities: DPIEntityConfig[];
} & Record<string, any>;
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,26 @@
export type DPIEntities =
| 'profile-person'
| 'profile-org'
| 'profile-university'
| 'profile-location'
| 'profile-email'
| 'profile-phone'
| 'profile-address'
| 'profile-sapids-internal'
| 'profile-sapids-public'
| 'profile-url'
| 'profile-username-password'
| 'profile-nationalid'
| 'profile-iban'
| 'profile-ssn'
| 'profile-credit-card-number'
| 'profile-passport'
| 'profile-driverlicense'
| 'profile-nationality'
| 'profile-religious-group'
| 'profile-political-group'
| 'profile-ethnicity';
| 'profile-pronouns-gender'
| 'profile-gender'
| 'profile-sexual-orientation'
| 'profile-trade-union'
| 'profile-sensitive-data';
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/
import type { DPIEntities } from './dpi-entities.js';
import type { PresidioEntities } from './presidio-entities.js';
/**
* Representation of the 'UnmaskingConfig' schema.
* Representation of the 'DPIEntityConfig' schema.
*/
export type UnmaskingConfig = {
export type DPIEntityConfig = {
/**
* List of entities to be unmasked.
* Type of entity to be masked.
*/
entities: DPIEntities | PresidioEntities[];
type: DPIEntities;
} & Record<string, any>;
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@ import type { ModuleResults } from './module-results.js';
* Representation of the 'ErrorResponse' schema.
*/
export type ErrorResponse = {
/**
* @example "d4a67ea1-2bf9-4df7-8105-d48203ccff76"
*/
request_id: string;
/**
* @example 400
*/
code: number;
/**
* @example "Model name must be one of ['gpt-4', ...]"
*/
message: string;
/**
* Where the error occurred.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import type { FilteringConfig } from './filtering-config.js';
* Representation of the 'FilteringModuleConfig' schema.
*/
export interface FilteringModuleConfig {
/**
* List of provider type and filters.
*/
input?: FilteringConfig;
/**
* List of provider type and filters.
*/
output?: FilteringConfig;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
export type GenericModuleResult = {
/**
* Some message created from the module.
* @example "Input to LLM is masked successfully."
*/
message: string;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,34 @@
* Representation of the 'GroundingFilter' schema.
*/
export type GroundingFilter = {
/**
* @example "string"
*/
id?: string;
/**
* @example {}
*/
search_configuration?: Record<string, any>;
/**
* @example [
* "*"
* ]
*/
data_repositories?: string[];
/**
* @example "help.sap.com"
*/
data_repository_type?: 'vector' | 'help.sap.com';
/**
* @example []
*/
data_repository_metadata?: Record<string, any>[];
/**
* @example []
*/
document_metadata?: Record<string, any>[];
/**
* @example []
*/
chunk_metadata?: Record<string, any>[];
} & Record<string, any>;
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import type { GroundingFilter } from './grounding-filter.js';
* Representation of the 'GroundingModuleConfig' schema.
*/
export type GroundingModuleConfig = {
/**
* @example "document_grounding_service"
*/
grounding_service: 'document_grounding_service';
grounding_service_configuration?: {
/**
* Secret name of the generic secret within Gen AI Hub containing document grounding service credentials.
*/
secret_name: string;
/**
* Document grounding service filters to be used.
*/
Expand All @@ -24,6 +23,7 @@ export type GroundingModuleConfig = {
grounding_input_parameters: string[];
/**
* Parameter name used for grounding output.
* @example "groundingOutput"
*/
grounding_output_parameter: string;
} & Record<string, any>;
Expand Down
10 changes: 3 additions & 7 deletions packages/gen-ai-hub/src/orchestration/client/api/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
export * from './completion-post-request.js';
export * from './chat-messages.js';
export * from './chat-message.js';
export * from './input-params-entry.js';
export * from './completion-post-response.js';
export * from './orchestration-config.js';
export * from './module-configs.js';
export * from './module-results.js';
export * from './templating-module-result.js';
export * from './llm-module-config.js';
export * from './generic-module-result.js';
export * from './llm-module-result.js';
Expand All @@ -25,12 +23,10 @@ export * from './azure-content-safety-filter-config.js';
export * from './azure-content-safety.js';
export * from './azure-threshold.js';
export * from './masking-module-config.js';
export * from './masking-config.js';
export * from './masking.js';
export * from './masking-provider-type.js';
export * from './masking-provider-config.js';
export * from './dpi-config.js';
export * from './dpi-entity-config.js';
export * from './dpi-entities.js';
export * from './presidio-entities.js';
export * from './unmasking-config.js';
export * from './grounding-module-config.js';
export * from './grounding-filter.js';
export * from './error-response.js';
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export type LLMChoice = {
*/
logprobs?: Record<string, number[]>;
/**
* Reason for stopping the model.
* Reason the model stopped generating tokens. 'stop' if the model hit a natural stop point or a provided stop sequence, 'length' if the maximum token number was reached, 'content_filter' if content was omitted due to a filter enforced by the LLM model provider or the content filtering module.
* @example "stop"
*/
finish_reason: string;
} & Record<string, any>;
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ export type LLMModuleConfig = {
model_name: string;
/**
* Model parameters.
* @example {
* "max_tokens": 300,
* "temperature": 0.1,
* "frequency_penalty": 0,
* "presence_penalty": 0,
* "n": 2
* }
*/
model_params: Record<string, any>;
/**
* Version of the model to use.
* @example "2024-08-12T10:11:17.042Z"
* Version of the model to use
* Default: "latest".
*/
model_version?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,27 @@ import type { TokenUsage } from './token-usage.js';
export type LLMModuleResult = {
/**
* ID of the response.
* @example "chatcmpl-9rO0aLoPKY7RtqkWi1317bazHEVFr"
*/
id: string;
/**
* Object type.
* @example "chat.completion"
*/
object: string;
/**
* Unix timestamp.
* @example 1722510700
*/
created: number;
/**
* Model name.
* @example "gpt-4"
*/
model: string;
/**
* System fingerprint.
* @example "fp_44709d6fcb"
*/
system_fingerprint?: string;
/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
*
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/
import type { MaskingConfig } from './masking-config.js';
import type { UnmaskingConfig } from './unmasking-config.js';
import type { MaskingProviderConfig } from './masking-provider-config.js';
/**
* Representation of the 'MaskingModuleConfig' schema.
*/
export interface MaskingModuleConfig {
masking: MaskingConfig;
unmasking?: UnmaskingConfig;
/**
* List of masking service providers
* Min Items: 1.
*/
masking_providers: MaskingProviderConfig[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/

import type { DPIConfig } from './dpi-config.js';
/**
* Representation of the 'InputParamsEntry' schema.
* Representation of the 'MaskingProviderConfig' schema.
*/
export type InputParamsEntry = string | number;
export type MaskingProviderConfig = DPIConfig;

This file was deleted.

Loading

0 comments on commit 2fda139

Please sign in to comment.