Skip to content

Commit

Permalink
chore: Add new schemas for streaming (#277)
Browse files Browse the repository at this point in the history
* add new schemas

* fix

* fix

* update yaml
  • Loading branch information
jjtang1985 authored Nov 8, 2024
1 parent 913bc5a commit eb7a4ec
Show file tree
Hide file tree
Showing 9 changed files with 365 additions and 165 deletions.
13 changes: 13 additions & 0 deletions packages/orchestration/src/client/api/schema/chat-delta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* 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 'ChatDelta' schema.
*/
export type ChatDelta = {
role?: string;
content: string;
} & Record<string, any>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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';
/**
* Representation of the 'CompletionPostResponseStreaming' schema.
*/
export type CompletionPostResponseStreaming = {
/**
* ID of the request
*/
request_id: string;
module_results?: ModuleResults;
orchestration_result?: LLMModuleResultStreaming;
} & Record<string, any>;
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.
*/

/**
* Stream options for output filtering. Will be ignored if stream is false.
*/
export type FilteringStreamOptions = {
/**
* Number of characters that should be additionally sent to content filtering services from previous chunks as additional context.
* Maximum: 10000.
*/
overlap?: number;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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.
*/

/**
* Options for streaming. Will be ignored if stream is false.
*/
export type GlobalStreamOptions = {
/**
* Number of characters per chunk that post-LLM modules operate on.
* Default: 100.
* Maximum: 10000.
* Minimum: 1.
*/
chunk_size?: number;
};
7 changes: 7 additions & 0 deletions packages/orchestration/src/client/api/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,27 @@
export * from './completion-post-request.js';
export * from './chat-messages.js';
export * from './chat-message.js';
export * from './chat-delta.js';
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-results.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';
export * from './llm-choice-streaming.js';
export * from './token-usage.js';
export * from './templating-module-config.js';
export * from './template.js';
export * from './filtering-module-config.js';
export * from './input-filtering-config.js';
export * from './output-filtering-config.js';
export * from './filtering-stream-options.js';
export * from './filter-config.js';
export * from './azure-content-safety-filter-config.js';
export * from './azure-content-safety.js';
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 { ChatDelta } from './chat-delta.js';
/**
* Representation of the 'LLMChoiceStreaming' schema.
*/
export type LLMChoiceStreaming = {
/**
* Index of the choice
*/
index: number;
delta: ChatDelta;
/**
* Log probabilities
*/
logprobs?: Record<string, number[]>;
/**
* Reason for stopping the model
*/
finish_reason?: string;
} & Record<string, any>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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 { LLMChoiceStreaming } from './llm-choice-streaming.js';
import type { TokenUsage } from './token-usage.js';
/**
* Output of LLM module. Follows the OpenAI spec.
*/
export type LLMModuleResultStreaming = {
/**
* ID of the response
*/
id: string;
/**
* Object type
*/
object: string;
/**
* Unix timestamp
*/
created: number;
/**
* Model name
*/
model: string;
/**
* System fingerprint
*/
system_fingerprint?: string;
/**
* Choices
*/
choices: LLMChoiceStreaming[];
usage?: TokenUsage;
} & Record<string, any>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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 { LlmChoice } from './llm-choice.js';
import type { TokenUsage } from './token-usage.js';
/**
* Output of LLM module. Follows the OpenAI spec.
*/
export type LLMModuleResultSynchronous = {
/**
* 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>;
Loading

0 comments on commit eb7a4ec

Please sign in to comment.