@compassdigital/sdk.typescript 4.400.0 → 4.402.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +8 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +9 -0
- package/lib/index.js.map +1 -1
- package/lib/interface/ai.d.ts +29 -0
- package/lib/interface/ai.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +15 -0
- package/src/interface/ai.ts +56 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1306,6 +1306,8 @@ import {
|
|
|
1306
1306
|
PostAiImageGenerateResponse,
|
|
1307
1307
|
PostAiTranslateBody,
|
|
1308
1308
|
PostAiTranslateResponse,
|
|
1309
|
+
PostOpenaiChatBody,
|
|
1310
|
+
PostOpenaiChatResponse,
|
|
1309
1311
|
} from './interface/ai';
|
|
1310
1312
|
|
|
1311
1313
|
import {
|
|
@@ -14274,6 +14276,19 @@ export class ServiceClient extends BaseServiceClient {
|
|
|
14274
14276
|
return this.request('ai', '/ai/translate', 'POST', `/ai/translate`, body, options);
|
|
14275
14277
|
}
|
|
14276
14278
|
|
|
14279
|
+
/**
|
|
14280
|
+
* POST /ai/openai/chat - Chat with OpenAI
|
|
14281
|
+
*
|
|
14282
|
+
* @param body
|
|
14283
|
+
* @param options - additional request options
|
|
14284
|
+
*/
|
|
14285
|
+
post_openai_chat(
|
|
14286
|
+
body: PostOpenaiChatBody,
|
|
14287
|
+
options?: RequestOptions,
|
|
14288
|
+
): ResponsePromise<PostOpenaiChatResponse> {
|
|
14289
|
+
return this.request('ai', '/ai/openai/chat', 'POST', `/ai/openai/chat`, body, options);
|
|
14290
|
+
}
|
|
14291
|
+
|
|
14277
14292
|
/**
|
|
14278
14293
|
* POST /centricos/ai/item/description - Generate item description
|
|
14279
14294
|
*
|
package/src/interface/ai.ts
CHANGED
|
@@ -78,6 +78,56 @@ export interface TranslateResponse {
|
|
|
78
78
|
translations: Record<string, string>;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
export interface OpenAiChatMessage {
|
|
82
|
+
// The role of the message
|
|
83
|
+
role: 'developer' | 'system' | 'user' | 'assistant' | 'tool' | 'function';
|
|
84
|
+
// The content of the message
|
|
85
|
+
content: string;
|
|
86
|
+
// The name of the message
|
|
87
|
+
name: string;
|
|
88
|
+
// The tool calls of the message
|
|
89
|
+
toolCalls: string[];
|
|
90
|
+
// The tool call ID (for tool role messages)
|
|
91
|
+
toolCallId: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface OpenAiChatBody {
|
|
95
|
+
// The model to use for the chat completion
|
|
96
|
+
model: string;
|
|
97
|
+
// The messages to send to the chat completion
|
|
98
|
+
messages: OpenAiChatMessage[];
|
|
99
|
+
// The tools to use for the chat completion
|
|
100
|
+
tools: string[];
|
|
101
|
+
// The tool choices to use for the chat completion
|
|
102
|
+
tool_choice: Record<string, any>;
|
|
103
|
+
// The temperature to use for the chat completion
|
|
104
|
+
temperature: number;
|
|
105
|
+
// The max tokens to use for the chat completion
|
|
106
|
+
max_tokens: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface OpenAiChatChoice {
|
|
110
|
+
// The index of the choice
|
|
111
|
+
index: number;
|
|
112
|
+
// The message of the choice
|
|
113
|
+
message: OpenAiChatMessage;
|
|
114
|
+
// The finish reason of the choice
|
|
115
|
+
finishReason: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface OpenAiChatResponse {
|
|
119
|
+
// The id of the chat completion
|
|
120
|
+
id: string;
|
|
121
|
+
// The object of the chat completion
|
|
122
|
+
object: string;
|
|
123
|
+
// The created at of the chat completion
|
|
124
|
+
created: number;
|
|
125
|
+
// The model of the chat completion
|
|
126
|
+
model: string;
|
|
127
|
+
// The choices of the chat completion
|
|
128
|
+
choices: OpenAiChatChoice[];
|
|
129
|
+
}
|
|
130
|
+
|
|
81
131
|
// POST /ai/language/generate - Generate text from a given prompt
|
|
82
132
|
|
|
83
133
|
export type PostAiLanguageGenerateBody = GenerateTextRequest;
|
|
@@ -95,3 +145,9 @@ export type PostAiImageGenerateResponse = GenerateImageResponse;
|
|
|
95
145
|
export type PostAiTranslateBody = TranslateRequest;
|
|
96
146
|
|
|
97
147
|
export type PostAiTranslateResponse = TranslateResponse;
|
|
148
|
+
|
|
149
|
+
// POST /ai/openai/chat - Chat with OpenAI
|
|
150
|
+
|
|
151
|
+
export type PostOpenaiChatBody = OpenAiChatBody;
|
|
152
|
+
|
|
153
|
+
export type PostOpenaiChatResponse = OpenAiChatResponse;
|