Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC: Streaming Spec Update #283

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/
import type { ModuleResults } from './module-results.js';
import type { ModuleResultsStreaming } from './module-results-streaming.js';
import type { LLMModuleResultStreaming } from './llm-module-result-streaming.js';
/**
* Representation of the 'CompletionPostResponseStreaming' schema.
Expand All @@ -13,6 +13,6 @@ export type CompletionPostResponseStreaming = {
* ID of the request
*/
request_id: string;
module_results?: ModuleResults;
module_results?: ModuleResultsStreaming;
orchestration_result?: LLMModuleResultStreaming;
} & Record<string, any>;
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 { ModuleResults } from './module-results.js';
import type { LlmModuleResult } from './llm-module-result.js';
import type { ModuleResultsSynchronous } from './module-results-synchronous.js';
import type { LLMModuleResultSynchronous } from './llm-module-result-synchronous.js';
/**
* Representation of the 'CompletionPostResponse' schema.
*/
Expand All @@ -14,6 +14,6 @@ export type CompletionPostResponse = {
* @example "d4a67ea1-2bf9-4df7-8105-d48203ccff76"
*/
request_id: string;
module_results: ModuleResults;
orchestration_result: LlmModuleResult;
module_results: ModuleResultsSynchronous;
orchestration_result: LLMModuleResultSynchronous;
} & Record<string, any>;
3 changes: 2 additions & 1 deletion packages/orchestration/src/client/api/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ export * from './completion-post-response-streaming.js';
export * from './orchestration-config.js';
export * from './module-configs.js';
export * from './module-results.js';
export * from './module-results-synchronous.js';
export * from './module-results-streaming.js';
export * from './global-stream-options.js';
export * from './llm-module-config.js';
export * from './generic-module-result.js';
export * from './llm-module-result.js';
export * from './llm-module-result-synchronous.js';
export * from './llm-module-result-streaming.js';
export * from './llm-choice.js';
Expand Down
42 changes: 0 additions & 42 deletions packages/orchestration/src/client/api/schema/llm-module-result.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* 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 { ModuleResults } from './module-results.js';
import type { LLMModuleResultStreaming } from './llm-module-result-streaming.js';
import type { LLMChoiceStreaming } from './llm-choice-streaming.js';
/**
* Streaming results of each module.
*/
export type ModuleResultsStreaming = ModuleResults & {
llm?: LLMModuleResultStreaming;
output_unmasking?: LLMChoiceStreaming[];
} & Record<string, any>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* 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 { ModuleResults } from './module-results.js';
import type { LLMModuleResultSynchronous } from './llm-module-result-synchronous.js';
import type { LlmChoice } from './llm-choice.js';
/**
* Synchronous results of each module.
*/
export type ModuleResultsSynchronous = ModuleResults & {
llm?: LLMModuleResultSynchronous;
output_unmasking?: LlmChoice[];
} & Record<string, any>;
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@
*
* 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 { LlmModuleResult } from './llm-module-result.js';
import type { LlmChoice } from './llm-choice.js';
import type { GenericModuleResult } from './generic-module-result.js';
/**
* Results of each module.
*/
export type ModuleResults = {
templating?: ChatMessages;
input_masking?: GenericModuleResult;
input_filtering?: GenericModuleResult;
llm?: LlmModuleResult;
output_filtering?: GenericModuleResult;
output_unmasking?: LlmChoice[];
};
5 changes: 3 additions & 2 deletions packages/orchestration/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ export type {
TokenUsage,
TemplatingModuleConfig,
OrchestrationConfig,
ModuleResults,
ModuleConfigs,
MaskingModuleConfig,
MaskingProviderConfig,
LlmModuleResult,
LlmChoice,
LLMChoiceStreaming,
GenericModuleResult,
LLMModuleResultSynchronous,
LLMModuleResultStreaming,
FilteringModuleConfig,
InputFilteringConfig,
OutputFilteringConfig,
Expand Down
50 changes: 34 additions & 16 deletions packages/orchestration/src/spec/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ components:
type: string
example: d4a67ea1-2bf9-4df7-8105-d48203ccff76
module_results:
$ref: '#/components/schemas/ModuleResults'
$ref: '#/components/schemas/ModuleResultsSynchronous'
orchestration_result:
$ref: '#/components/schemas/LLMModuleResult'
$ref: '#/components/schemas/LLMModuleResultSynchronous'
CompletionPostResponseStreaming:
type: object
required:
Expand All @@ -132,7 +132,7 @@ components:
description: ID of the request
type: string
module_results:
$ref: '#/components/schemas/ModuleResults'
$ref: '#/components/schemas/ModuleResultsStreaming'
orchestration_result:
$ref: '#/components/schemas/LLMModuleResultStreaming'
OrchestrationConfig:
Expand Down Expand Up @@ -173,16 +173,39 @@ components:
$ref: '#/components/schemas/GenericModuleResult'
input_filtering:
$ref: '#/components/schemas/GenericModuleResult'
llm:
$ref: '#/components/schemas/LLMModuleResult'
output_filtering:
$ref: '#/components/schemas/GenericModuleResult'
output_unmasking:
type: array
items:
oneOf:
- $ref: '#/components/schemas/LLMChoice'
- $ref: '#/components/schemas/LLMChoiceStreaming'

ModuleResultsSynchronous:
description: Synchronous results of each module.
type: object
additionalProperties: false
allOf:
- $ref: '#/components/schemas/ModuleResults'
- type: object
properties:
llm:
$ref: '#/components/schemas/LLMModuleResultSynchronous'
output_unmasking:
type: array
items:
$ref: '#/components/schemas/LLMChoice'

ModuleResultsStreaming:
description: Streaming results of each module.
type: object
additionalProperties: false
allOf:
- $ref: '#/components/schemas/ModuleResults'
- type: object
properties:
llm:
$ref: '#/components/schemas/LLMModuleResultStreaming'
output_unmasking:
type: array
items:
$ref: '#/components/schemas/LLMChoiceStreaming'

GlobalStreamOptions:
description: Options for streaming. Will be ignored if stream is false.
type: object
Expand Down Expand Up @@ -230,11 +253,6 @@ components:
data:
type: object
description: Additional data object from the module
LLMModuleResult:
description: Output of LLM module. Follows the OpenAI spec.
oneOf:
- $ref: '#/components/schemas/LLMModuleResultSynchronous'
- $ref: '#/components/schemas/LLMModuleResultStreaming'
LLMModuleResultSynchronous:
type: object
description: Output of LLM module. Follows the OpenAI spec.
Expand Down
Loading