Skip to content

Commit 2665c68

Browse files
committed
Update orchestration based on ai-86627-tools-as-input
1 parent ebce8e7 commit 2665c68

10 files changed

+180
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved.
3+
*
4+
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
5+
*/
6+
import type { ResponseMessageToolCalls } from './response-message-tool-calls.js';
7+
/**
8+
* Representation of the 'ChatCompletionRequestAssistantMessage' schema.
9+
*/
10+
export type ChatCompletionRequestAssistantMessage = {
11+
/**
12+
* @example "assistant"
13+
*/
14+
role: 'assistant';
15+
content?: string | null;
16+
refusal?: string | null;
17+
tool_calls?: ResponseMessageToolCalls;
18+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved.
3+
*
4+
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
5+
*/
6+
7+
/**
8+
* Representation of the 'ChatCompletionRequestSystemMessage' schema.
9+
*/
10+
export type ChatCompletionRequestSystemMessage = {
11+
/**
12+
* @example "system"
13+
*/
14+
role: 'system';
15+
content: string;
16+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved.
3+
*
4+
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
5+
*/
6+
7+
/**
8+
* Representation of the 'ChatCompletionRequestToolMessage' schema.
9+
*/
10+
export type ChatCompletionRequestToolMessage = {
11+
/**
12+
* @example "tool"
13+
*/
14+
role: 'tool';
15+
tool_call_id: string | null;
16+
content: string | null;
17+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved.
3+
*
4+
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
5+
*/
6+
7+
/**
8+
* Representation of the 'ChatCompletionRequestUserMessage' schema.
9+
*/
10+
export type ChatCompletionRequestUserMessage = {
11+
/**
12+
* @example "user"
13+
*/
14+
role: 'user';
15+
content: string;
16+
};

packages/orchestration/src/client/api/schema/chat-delta.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import type { ToolCallChunk } from './tool-call-chunk.js';
99
*/
1010
export type ChatDelta = {
1111
role?: string;
12-
content: string;
12+
content: string | null;
1313
/**
1414
* The refusal message generated by the model.
1515
*/
16-
refusal?: string;
16+
refusal?: string | null;
1717
tool_calls?: ToolCallChunk[];
1818
} & Record<string, any>;

packages/orchestration/src/client/api/schema/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ export * from './chat-message.js';
88
export * from './chat-messages.js';
99
export * from './templating-chat-message.js';
1010
export * from './single-chat-message.js';
11+
export * from './chat-completion-request-system-message.js';
12+
export * from './chat-completion-request-assistant-message.js';
13+
export * from './chat-completion-request-user-message.js';
14+
export * from './chat-completion-request-tool-message.js';
1115
export * from './response-chat-message.js';
1216
export * from './response-message-tool-calls.js';
1317
export * from './response-message-tool-call.js';

packages/orchestration/src/client/api/schema/multi-chat-message.ts

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
55
*/
66
import type { MultiChatMessageContent } from './multi-chat-message-content.js';
7+
import type { ResponseMessageToolCalls } from './response-message-tool-calls.js';
78
/**
89
* Representation of the 'MultiChatMessage' schema.
910
*/
@@ -13,4 +14,7 @@ export type MultiChatMessage = {
1314
*/
1415
role: string;
1516
content: MultiChatMessageContent[];
17+
tool_calls?: ResponseMessageToolCalls;
18+
refusal?: string | null;
19+
tool_call_id?: string | null;
1620
};

packages/orchestration/src/client/api/schema/response-chat-message.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33
*
44
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
55
*/
6-
import type { SingleChatMessage } from './single-chat-message.js';
76
import type { ResponseMessageToolCalls } from './response-message-tool-calls.js';
87
/**
98
* Representation of the 'ResponseChatMessage' schema.
109
*/
11-
export type ResponseChatMessage = SingleChatMessage & {
10+
export type ResponseChatMessage = {
11+
/**
12+
* @example "assistant"
13+
*/
14+
role?: 'assistant';
15+
content?: string | null;
1216
/**
1317
* @example "I'm sorry, I can't answer that question."
1418
*/
15-
refusal?: string;
19+
refusal?: string | null;
1620
tool_calls?: ResponseMessageToolCalls;
1721
};

packages/orchestration/src/client/api/schema/single-chat-message.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
*
44
* This is a generated file powered by the SAP Cloud SDK for JavaScript.
55
*/
6-
6+
import type { ChatCompletionRequestSystemMessage } from './chat-completion-request-system-message.js';
7+
import type { ChatCompletionRequestUserMessage } from './chat-completion-request-user-message.js';
8+
import type { ChatCompletionRequestAssistantMessage } from './chat-completion-request-assistant-message.js';
9+
import type { ChatCompletionRequestToolMessage } from './chat-completion-request-tool-message.js';
710
/**
811
* Representation of the 'SingleChatMessage' schema.
912
*/
10-
export type SingleChatMessage = {
11-
/**
12-
* @example "user"
13-
*/
14-
role: string;
15-
content: string;
16-
};
13+
export type SingleChatMessage =
14+
| ChatCompletionRequestSystemMessage
15+
| ChatCompletionRequestUserMessage
16+
| ChatCompletionRequestAssistantMessage
17+
| ChatCompletionRequestToolMessage;

packages/orchestration/src/spec/api.yaml

+87-11
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,46 @@ components:
7878
$ref: '#/components/schemas/ChatMessage'
7979

8080
SingleChatMessage:
81+
type: object
82+
oneOf:
83+
- $ref: '#/components/schemas/ChatCompletionRequestSystemMessage'
84+
- $ref: '#/components/schemas/ChatCompletionRequestUserMessage'
85+
- $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage'
86+
- $ref: '#/components/schemas/ChatCompletionRequestToolMessage'
87+
88+
ChatCompletionRequestSystemMessage:
89+
type: object
90+
required:
91+
- role
92+
- content
93+
additionalProperties: false
94+
properties:
95+
role:
96+
type: string
97+
enum: [system]
98+
example: system
99+
content:
100+
type: string
101+
ChatCompletionRequestAssistantMessage:
102+
type: object
103+
required:
104+
- role
105+
additionalProperties: false
106+
properties:
107+
role:
108+
type: string
109+
enum: [assistant]
110+
example: assistant
111+
content:
112+
type: string
113+
nullable: true
114+
refusal:
115+
type: string
116+
nullable: true
117+
tool_calls:
118+
nullable: true
119+
$ref: '#/components/schemas/ResponseMessageToolCalls'
120+
ChatCompletionRequestUserMessage:
81121
type: object
82122
required:
83123
- role
@@ -86,21 +126,47 @@ components:
86126
properties:
87127
role:
88128
type: string
129+
enum: [user]
89130
example: user
90131
content:
91132
type: string
133+
ChatCompletionRequestToolMessage:
134+
type: object
135+
required:
136+
- role
137+
- content
138+
- tool_call_id
139+
additionalProperties: false
140+
properties:
141+
role:
142+
type: string
143+
enum: [tool]
144+
example: tool
145+
tool_call_id:
146+
type: string
147+
nullable: true
148+
content:
149+
type: string
150+
nullable: true
92151

93152
ResponseChatMessage:
94-
allOf:
95-
- $ref: '#/components/schemas/SingleChatMessage'
96-
- type: object
97-
additionalProperties: false
98-
properties:
99-
refusal:
100-
type: string
101-
example: "I'm sorry, I can't answer that question."
102-
tool_calls:
103-
$ref: '#/components/schemas/ResponseMessageToolCalls'
153+
type: object
154+
additionalProperties: false
155+
properties:
156+
role:
157+
type: string
158+
enum: [assistant]
159+
example: assistant
160+
content:
161+
type: string
162+
nullable: true
163+
refusal:
164+
type: string
165+
example: "I'm sorry, I can't answer that question."
166+
nullable: true
167+
tool_calls:
168+
nullable: true
169+
$ref: '#/components/schemas/ResponseMessageToolCalls'
104170
# below tool message definitions are copied from openai spec: https://github.com/openai/openai-openapi/blob/e0cb2d721753e13e69e918465795d6e9f87ab15a/openapi.yaml#L11007
105171
# only renaming them to differentiate them from the openai python classes
106172
ResponseMessageToolCalls:
@@ -156,6 +222,15 @@ components:
156222
type: array
157223
items:
158224
$ref: '#/components/schemas/MultiChatMessageContent'
225+
tool_calls:
226+
nullable: true
227+
$ref: '#/components/schemas/ResponseMessageToolCalls'
228+
refusal:
229+
type: string
230+
nullable: true
231+
tool_call_id:
232+
type: string
233+
nullable: true
159234

160235
MultiChatMessageContent:
161236
oneOf:
@@ -206,9 +281,10 @@ components:
206281
type: string
207282
content:
208283
type: string
209-
default: ''
284+
nullable: true
210285
refusal:
211286
type: string
287+
nullable: true
212288
description: The refusal message generated by the model.
213289
tool_calls:
214290
type: array

0 commit comments

Comments
 (0)