Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
5 changes: 5 additions & 0 deletions .changeset/nice-emus-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sap-ai-sdk/orchestration': minor
---

[feat] Update orchestration specification to 0.115.19
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 @@ -35,4 +35,8 @@ export type DpiConfig = {
*/
enabled?: boolean;
};
/**
* Type of masking method to be used for file inputs. Required if file inputs are provided.
*/
mask_file_input_method?: 'anonymization' | 'skip';
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved.
*
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/

/**
* A single base64 string representing the embedding.
*/
export type EmbeddingBase64String = string;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved.
*
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/

/**
* An array of floating point numbers representing the embedding.
*/
export type EmbeddingFloatArray = number[];
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved.
*
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/

/**
* A dictionary mapping encoding format names to their embeddings. Used when multiple encoding formats are requested (Cohere-specific).
*/
export type EmbeddingMultiFormat = {
/**
* Float encoding format - array of floating point numbers
*/
float?: number[];
/**
* Int8 encoding format - array of 8-bit integers
*/
int8?: number[];
/**
* Uint8 encoding format - array of unsigned 8-bit integers
*/
uint8?: number[];
/**
* Base64 encoding format - base64 encoded string
*/
base64?: string;
/**
* Binary encoding format - array of integers
*/
binary?: number[];
/**
* Ubinary encoding format - array of unsigned integers
*/
ubinary?: number[];
};
9 changes: 7 additions & 2 deletions packages/orchestration/src/client/api/schema/embedding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
*
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/

import type { EmbeddingFloatArray } from './embedding-float-array.js';
import type { EmbeddingBase64String } from './embedding-base-64-string.js';
import type { EmbeddingMultiFormat } from './embedding-multi-format.js';
/**
* Representation of the 'Embedding' schema.
*/
export type Embedding = number[] | string;
export type Embedding =
| EmbeddingFloatArray
| EmbeddingBase64String
| EmbeddingMultiFormat;
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@ import type { EmbeddingsInputText } from './embeddings-input-text.js';
*/
export type EmbeddingsInput = {
text: EmbeddingsInputText;
type?: 'text' | 'document' | 'query';
type?:
| 'text'
| 'document'
| 'query'
| 'search_document'
| 'search_query'
| 'classification'
| 'clustering'
| 'image';
};
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 { EncodingFormat } from './encoding-format.js';
/**
* Additional parameters for generating input's embeddings. Default values are used for mandatory parameters.
*/
Expand All @@ -14,9 +14,9 @@ export type EmbeddingsModelParams = {
*/
dimensions?: number;
/**
* OpenAI's spec allows for 'float' and 'base64' encoding formats.
* The format to return the embeddings in. Can be a single format or an array of formats. OpenAI's spec allows for 'float' and 'base64' encoding formats.
*
*/
encoding_format?: 'float' | 'base64' | 'binary';
encoding_format?: EncodingFormat | EncodingFormat[];
normalize?: boolean;
} & Record<string, any>;
16 changes: 16 additions & 0 deletions packages/orchestration/src/client/api/schema/encoding-format.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved.
*
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
*/

/**
* Encoding format for embeddings.
*/
export type EncodingFormat =
| 'float'
| 'base64'
| 'binary'
| 'int8'
| 'uint8'
| 'ubinary';
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 @@ -11,11 +11,15 @@ export * from './embeddings-input-text.js';
export * from './embeddings-module-configs.js';
export * from './embeddings-model-config.js';
export * from './embeddings-model-details.js';
export * from './encoding-format.js';
export * from './embeddings-model-params.js';
export * from './embeddings-post-response.js';
export * from './embeddings-response.js';
export * from './embeddings-usage.js';
export * from './embedding-result.js';
export * from './embedding-float-array.js';
export * from './embedding-base-64-string.js';
export * from './embedding-multi-format.js';
export * from './embedding.js';
export * from './chat-messages.js';
export * from './templating-chat-message.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/orchestration/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export type {
EmbeddingModelDetails,
EmbeddingModelParams,
EmbeddingModuleConfig,
EmbeddingData
EmbeddingData,
OrchestrationRequestHeaders
} from './orchestration-types.js';
export {
isConfigReference,
Expand Down
40 changes: 40 additions & 0 deletions packages/orchestration/src/orchestration-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
getOrchestrationDeploymentId
} from '@sap-ai-sdk/ai-api/internal.js';
import {
aiCoreDestination,
mockClientCredentialsGrantCall,
mockDeploymentsList,
mockInference,
Expand Down Expand Up @@ -707,6 +708,45 @@ describe('orchestration service client', () => {
expect(response._data).toEqual(mockResponse);
});

it('passes AI-Object-Store-Secret-Name header to the HTTP request', async () => {
const config: OrchestrationModuleConfig = {
promptTemplating: {
model: {
name: 'gpt-5-mini',
params: { max_tokens: 50 }
}
}
};

const prompt: ChatCompletionRequest = {
messages: [{ role: 'user', content: 'Hello' }]
};

const mockResponse = await parseMockResponse<CompletionPostResponse>(
'orchestration',
'orchestration-chat-completion-success-response.json'
);

nock(aiCoreDestination.url, {
reqheaders: {
'ai-resource-group': 'default',
'AI-Object-Store-Secret-Name': 'my-object-store-secret'
}
})
.post(
'/v2/inference/deployments/1234/v2/completion',
constructCompletionPostRequest(config, prompt)
)
.reply(200, mockResponse);

const response = await new OrchestrationClient(config).chatCompletion(
prompt,
{ headers: { 'AI-Object-Store-Secret-Name': 'my-object-store-secret' } }
);

expect(response._data).toEqual(mockResponse);
});

it('executes a request with the custom resource group', async () => {
const prompt: ChatCompletionRequest = {
messagesHistory: [
Expand Down
27 changes: 24 additions & 3 deletions packages/orchestration/src/orchestration-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import type {
ChatCompletionRequest,
RequestOptions,
StreamOptions,
BaseStreamOptions
BaseStreamOptions,
OrchestrationRequestHeaders
} from './orchestration-types.js';
import type { OrchestrationStreamChunkResponse } from './orchestration-stream-chunk-response.js';
import type { HttpDestinationOrFetchOptions } from '@sap-cloud-sdk/connectivity';
Expand Down Expand Up @@ -74,9 +75,18 @@ export class OrchestrationClient {
}
}

/**
* Send a chat completion request to the orchestration service.
* @param request - Request containing messages, placeholder values, and message history.
* @param requestConfig - Additional request configuration. Use `requestConfig.headers` to pass service-specific headers:
* - `AI-Object-Store-Secret-Name`: Name of the object store secret used by the feedback service.
* @returns The orchestration service response.
*/
async chatCompletion(
request?: ChatCompletionRequest,
requestConfig?: CustomRequestConfig
requestConfig?: CustomRequestConfig & {
headers?: OrchestrationRequestHeaders;
}
): Promise<OrchestrationResponse> {
requestConfig?.signal?.throwIfAborted();
if (isConfigReference(this.config) && request?.messages?.length) {
Expand All @@ -92,11 +102,22 @@ export class OrchestrationClient {
return new OrchestrationResponse(response);
}

/**
* Create a streaming chat completion request to the orchestration service.
* @param request - Request containing messages, placeholder values, and message history.
* @param signal - An abort signal to cancel the request.
* @param options - Streaming options, e.g., for input/output filtering.
* @param requestConfig - Additional request configuration. Use `requestConfig.headers` to pass service-specific headers:
* - `AI-Object-Store-Secret-Name`: Name of the object store secret used by the feedback service.
* @returns The orchestration stream response.
*/
async stream(
request?: ChatCompletionRequest,
signal?: AbortSignal,
options?: StreamOptions,
requestConfig?: CustomRequestConfig
requestConfig?: CustomRequestConfig & {
headers?: OrchestrationRequestHeaders;
}
): Promise<OrchestrationStreamResponse<OrchestrationStreamChunkResponse>> {
const controller = new AbortController();
if (signal) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export class OrchestrationEmbeddingResponse {
* @returns Array of embedding data objects containing both vectors, indices, and object types.
*/
getEmbeddings(): EmbeddingData[] {
// TODO: Remove non-null assertion when final_result is made mandatory in the schema
return this._data.final_result.data.map((result: EmbeddingResult) => ({
embedding: result.embedding,
index: result.index,
Expand Down
24 changes: 21 additions & 3 deletions packages/orchestration/src/orchestration-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import type {
EmbeddingsModelDetails as OriginalEmbeddingsModelDetails,
EmbeddingsModelParams as OriginalEmbeddingsModelParams,
SAPDocumentTranslationInput,
SAPDocumentTranslationOutput
SAPDocumentTranslationOutput,
Embedding
} from './client/api/schema/index.js';

/**
Expand Down Expand Up @@ -353,6 +354,23 @@ export function isOrchestrationModuleConfigList(
}
}

/**
* Service-specific headers for orchestration requests.
* @remarks
* `AI-Resource-Group` is configured via the `deploymentConfig` constructor parameter, not here.
*/
export interface OrchestrationRequestHeaders {
/**
* Name of the object store secret used by the feedback service.
*/
'AI-Object-Store-Secret-Name'?: string;
[key: string]: any;
/**
* Use the `deploymentConfig` constructor parameter to set the resource group instead.
*/
'AI-Resource-Group'?: never;
}

/**
* Request options for orchestration.
*/
Expand Down Expand Up @@ -828,9 +846,9 @@ export interface EmbeddingData {
*/
object: 'embedding';
/**
* The embedding vector, either as a number array or base64-encoded string.
* The embedding vector, either as a number array, a base64-encoded string, or multiple formats in case multiple output formats were requested.
*/
embedding: number[] | string;
embedding: Embedding;
/**
* The index of the embedding in the list of embeddings.
*/
Expand Down
Loading
Loading