Skip to content

Commit

Permalink
feat: Update to Orchestration 0.36.1 (#333)
Browse files Browse the repository at this point in the history
* feat: Update to Orchestration 0.36.1

* update spec, remove help.sap.com
  • Loading branch information
MatKuhr authored Dec 3, 2024
1 parent 1b4ae61 commit 36c1803
Show file tree
Hide file tree
Showing 15 changed files with 385 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
/**
* Representation of the 'DataRepositoryType' schema.
*/
export type DataRepositoryType = 'vector' | 'help.sap.com' | any;
export type DataRepositoryType = 'vector' | any;
4 changes: 4 additions & 0 deletions packages/orchestration/src/client/api/schema/dpi-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ export type DpiConfig = {
* Min Items: 1.
*/
entities: DpiEntityConfig[];
/**
* List of strings that should not be masked
*/
allowlist?: string[];
} & Record<string, any>;
4 changes: 4 additions & 0 deletions packages/orchestration/src/client/api/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
export * from './completion-post-request.js';
export * from './chat-messages.js';
export * from './templating-chat-message.js';
export * from './chat-message.js';
export * from './chat-delta.js';
export * from './completion-post-response.js';
Expand All @@ -23,6 +24,9 @@ export * from './llm-choice-streaming.js';
export * from './token-usage.js';
export * from './templating-module-config.js';
export * from './template.js';
export * from './template-ref.js';
export * from './template-ref-by-id.js';
export * from './template-ref-by-scenario-name-version.js';
export * from './filtering-module-config.js';
export * from './input-filtering-config.js';
export * from './output-filtering-config.js';
Expand Down
39 changes: 5 additions & 34 deletions packages/orchestration/src/client/api/schema/llm-module-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,11 @@
*
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/
import type { LlmChoice } from './llm-choice.js';
import type { TokenUsage } from './token-usage.js';
import type { LLMModuleResultSynchronous } from './llm-module-result-synchronous.js';
import type { LLMModuleResultStreaming } from './llm-module-result-streaming.js';
/**
* Output of LLM module. Follows the OpenAI spec.
*/
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;
/**
* Choices.
*/
choices: LlmChoice[];
usage: TokenUsage;
} & Record<string, any>;
export type LlmModuleResult =
| LLMModuleResultSynchronous
| LLMModuleResultStreaming;
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/
import type { GenericModuleResult } from './generic-module-result.js';
import type { ChatMessages } from './chat-messages.js';
import type { TemplatingChatMessage } from './templating-chat-message.js';
import type { LlmModuleResult } from './llm-module-result.js';
import type { LlmChoice } from './llm-choice.js';
import type { LLMChoiceStreaming } from './llm-choice-streaming.js';
/**
* Results of each module.
*/
export type ModuleResults = {
grounding?: GenericModuleResult;
templating?: ChatMessages;
templating?: TemplatingChatMessage;
input_masking?: GenericModuleResult;
input_filtering?: GenericModuleResult;
llm?: LlmModuleResult;
output_filtering?: GenericModuleResult;
output_unmasking?: LlmChoice[];
output_unmasking?: (LlmChoice | LLMChoiceStreaming)[];
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/
import type { ModuleConfigs } from './module-configs.js';
import type { GlobalStreamOptions } from './global-stream-options.js';
/**
* Representation of the 'OrchestrationConfig' schema.
*/
export type OrchestrationConfig = {
module_configurations: ModuleConfigs;
/**
* If true, the response will be streamed back to the client
*/
stream?: boolean;
stream_options?: GlobalStreamOptions;
} & Record<string, any>;
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/
import type { FilterConfig } from './filter-config.js';
import type { FilteringStreamOptions } from './filtering-stream-options.js';
/**
* Representation of the 'OutputFilteringConfig' schema.
*/
Expand All @@ -13,4 +14,5 @@ export type OutputFilteringConfig = {
* Min Items: 1.
*/
filters: FilterConfig[];
stream_options?: FilteringStreamOptions;
};
16 changes: 16 additions & 0 deletions packages/orchestration/src/client/api/schema/template-ref-by-id.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* 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.
*/

/**
* Representation of the 'TemplateRefByID' schema.
*/
export type TemplateRefByID = {
/**
* ID of the template in prompt registry
* @example "template_id"
*/
id: string;
} & Record<string, any>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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.
*/

/**
* Representation of the 'TemplateRefByScenarioNameVersion' schema.
*/
export type TemplateRefByScenarioNameVersion = {
/**
* Scenario name
* @example "some-scenario"
*/
scenario: string;
/**
* Name of the template
* @example "some-template-name"
*/
name: string;
/**
* Version of the template
* @example "some version, can be `latest`"
*/
version: string;
} & Record<string, any>;
16 changes: 16 additions & 0 deletions packages/orchestration/src/client/api/schema/template-ref.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* 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 { TemplateRefByID } from './template-ref-by-id.js';
import type { TemplateRefByScenarioNameVersion } from './template-ref-by-scenario-name-version.js';
/**
* Representation of the 'TemplateRef' schema.
*/
export type TemplateRef = {
/**
* Reference to a template in the prompt registry by ID or by scenario, name and version
*/
template_ref: TemplateRefByID | TemplateRefByScenarioNameVersion;
} & Record<string, any>;
6 changes: 3 additions & 3 deletions packages/orchestration/src/client/api/schema/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
*
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/
import type { ChatMessages } from './chat-messages.js';
import type { TemplatingChatMessage } from './templating-chat-message.js';
/**
* Representation of the 'Template' schema.
* @example {
* "template": [
* {
* "role": "user",
* "content": "How can the features of AI in SAP BTP specifially {​{?product}}, be applied to {{?inputContext}}"
* "content": "How can the features of AI in SAP BTP specifically {{?groundingOutput}}, be applied to {{?inputContext}}"
* }
* ],
* "defaults": {
Expand All @@ -22,7 +22,7 @@ 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.
*/
template: ChatMessages;
template: TemplatingChatMessage;
/**
* Optional default values for the template. If a parameter has no default it is required.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* 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 { ChatMessage } from './chat-message.js';
/**
* Representation of the 'TemplatingChatMessage' schema.
* Min Items: 1.
*/
export type TemplatingChatMessage = ChatMessage[];
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/
import type { Template } from './template.js';
import type { TemplateRef } from './template-ref.js';
/**
* Representation of the 'TemplatingModuleConfig' schema.
*/
export type TemplatingModuleConfig = Template;
export type TemplatingModuleConfig = Template | TemplateRef;
2 changes: 1 addition & 1 deletion packages/orchestration/src/orchestration-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class OrchestrationResponse {
* @returns Token usage.
*/
getTokenUsage(): TokenUsage {
return this.data.orchestration_result.usage;
return this.data.orchestration_result.usage!;
}
/**
* Reason for stopping the completion.
Expand Down
Loading

0 comments on commit 36c1803

Please sign in to comment.