@synova-cloud/sdk 1.0.0 → 1.1.1
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/README.md +0 -55
- package/dist/index.d.cts +20 -8
- package/dist/index.d.ts +20 -8
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -149,28 +149,6 @@ const response = await client.prompts.execute('prm_chat456', {
|
|
|
149
149
|
});
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
#### With Structured Output (JSON Schema)
|
|
153
|
-
|
|
154
|
-
```typescript
|
|
155
|
-
const response = await client.prompts.execute('prm_extract789', {
|
|
156
|
-
provider: 'openai',
|
|
157
|
-
model: 'gpt-4o',
|
|
158
|
-
variables: { text: 'John Doe, age 30, from New York' },
|
|
159
|
-
responseSchema: {
|
|
160
|
-
type: 'object',
|
|
161
|
-
properties: {
|
|
162
|
-
name: { type: 'string' },
|
|
163
|
-
age: { type: 'number' },
|
|
164
|
-
city: { type: 'string' },
|
|
165
|
-
},
|
|
166
|
-
required: ['name', 'age', 'city'],
|
|
167
|
-
},
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
// Access parsed object directly
|
|
171
|
-
console.log(response.object); // { name: 'John Doe', age: 30, city: 'New York' }
|
|
172
|
-
```
|
|
173
|
-
|
|
174
152
|
#### Image Generation
|
|
175
153
|
|
|
176
154
|
```typescript
|
|
@@ -190,37 +168,6 @@ if (response.type === 'image') {
|
|
|
190
168
|
|
|
191
169
|
#### With Tool Calls
|
|
192
170
|
|
|
193
|
-
```typescript
|
|
194
|
-
const response = await client.prompts.execute('prm_assistant012', {
|
|
195
|
-
provider: 'openai',
|
|
196
|
-
model: 'gpt-4o',
|
|
197
|
-
variables: { query: 'What is the weather in Tokyo?' },
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
if (response.type === 'tool_calls') {
|
|
201
|
-
for (const toolCall of response.toolCalls) {
|
|
202
|
-
console.log(`Tool: ${toolCall.name}`);
|
|
203
|
-
console.log(`Arguments: ${JSON.stringify(toolCall.arguments)}`);
|
|
204
|
-
|
|
205
|
-
// Execute your tool
|
|
206
|
-
const result = await executeMyTool(toolCall.name, toolCall.arguments);
|
|
207
|
-
|
|
208
|
-
// Continue conversation with tool results
|
|
209
|
-
const finalResponse = await client.prompts.execute('prm_assistant012', {
|
|
210
|
-
provider: 'openai',
|
|
211
|
-
model: 'gpt-4o',
|
|
212
|
-
messages: [
|
|
213
|
-
{ role: 'user', content: 'What is the weather in Tokyo?' },
|
|
214
|
-
{ role: 'assistant', toolCalls: [toolCall] },
|
|
215
|
-
{ role: 'tool', toolResults: [{ toolCallId: toolCall.id, content: JSON.stringify(result) }] },
|
|
216
|
-
],
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
console.log(finalResponse.content);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
```
|
|
223
|
-
|
|
224
171
|
### Models
|
|
225
172
|
|
|
226
173
|
#### List All Models
|
|
@@ -434,8 +381,6 @@ import type {
|
|
|
434
381
|
ISynovaExecutionError,
|
|
435
382
|
// Messages
|
|
436
383
|
ISynovaMessage,
|
|
437
|
-
ISynovaToolCall,
|
|
438
|
-
ISynovaToolResult,
|
|
439
384
|
TSynovaMessageRole,
|
|
440
385
|
TSynovaResponseType,
|
|
441
386
|
// Files
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type TSynovaMessageRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
2
|
-
type TSynovaResponseType = 'message' | 'tool_calls' | 'image' | 'error';
|
|
2
|
+
type TSynovaResponseType = 'message' | 'tool_calls' | 'image' | 'audio' | 'error';
|
|
3
3
|
type TSynovaModelType = 'text' | 'image';
|
|
4
|
+
type TSynovaUsageType = 'tokens' | 'images' | 'time';
|
|
4
5
|
interface ISynovaLogger {
|
|
5
6
|
debug: (message: string, ...args: unknown[]) => void;
|
|
6
7
|
info: (message: string, ...args: unknown[]) => void;
|
|
@@ -99,10 +100,21 @@ interface ISynovaExecuteOptions {
|
|
|
99
100
|
/** JSON Schema for structured output */
|
|
100
101
|
responseSchema?: Record<string, unknown>;
|
|
101
102
|
}
|
|
102
|
-
interface
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
interface ISynovaExecutionUsage {
|
|
104
|
+
/** Usage type: 'tokens' for LLM, 'images' for image generation, 'time' for time-based billing */
|
|
105
|
+
type: TSynovaUsageType;
|
|
106
|
+
/** Input tokens (when type='tokens') */
|
|
107
|
+
inputTokens?: number;
|
|
108
|
+
/** Output tokens (when type='tokens') */
|
|
109
|
+
outputTokens?: number;
|
|
110
|
+
/** Total tokens (when type='tokens') */
|
|
111
|
+
totalTokens?: number;
|
|
112
|
+
/** Number of images generated (when type='images') */
|
|
113
|
+
imageCount?: number;
|
|
114
|
+
/** Image resolution (when type='images') */
|
|
115
|
+
resolution?: string;
|
|
116
|
+
/** Prediction time in seconds (when type='time') */
|
|
117
|
+
predictTimeSeconds?: number;
|
|
106
118
|
}
|
|
107
119
|
interface ISynovaExecutionError {
|
|
108
120
|
code: string;
|
|
@@ -142,8 +154,8 @@ interface ISynovaExecuteResponse {
|
|
|
142
154
|
files?: ISynovaFileAttachment[];
|
|
143
155
|
/** Error details (when type='error') */
|
|
144
156
|
error?: ISynovaExecutionError;
|
|
145
|
-
/**
|
|
146
|
-
|
|
157
|
+
/** Execution usage statistics (tokens, images, or time-based) */
|
|
158
|
+
executionUsage?: ISynovaExecutionUsage;
|
|
147
159
|
}
|
|
148
160
|
interface ISynovaModelCapabilities {
|
|
149
161
|
text_generation?: boolean;
|
|
@@ -561,4 +573,4 @@ declare class ServerSynovaError extends SynovaError {
|
|
|
561
573
|
constructor(httpCode: number, message?: string);
|
|
562
574
|
}
|
|
563
575
|
|
|
564
|
-
export { ApiSynovaError, AuthSynovaError, type ISynovaConfig, type ISynovaExecuteOptions, type ISynovaExecuteResponse, type ISynovaExecutionError, type ISynovaFileAttachment, type ISynovaFileThumbnails, type ISynovaGetPromptOptions, type ISynovaListModelsOptions, type ISynovaLogger, type ISynovaMessage, type ISynovaModel, type ISynovaModelCapabilities, type ISynovaModelLimits, type ISynovaModelPricing, type ISynovaModelsResponse, type ISynovaPrompt, type ISynovaPromptVariable, type ISynovaProvider, type ISynovaRetryConfig, type ISynovaToolCall, type ISynovaToolResult, type ISynovaUploadOptions, type ISynovaUploadResponse, type ISynovaUploadedFile,
|
|
576
|
+
export { ApiSynovaError, AuthSynovaError, type ISynovaConfig, type ISynovaExecuteOptions, type ISynovaExecuteResponse, type ISynovaExecutionError, type ISynovaExecutionUsage, type ISynovaFileAttachment, type ISynovaFileThumbnails, type ISynovaGetPromptOptions, type ISynovaListModelsOptions, type ISynovaLogger, type ISynovaMessage, type ISynovaModel, type ISynovaModelCapabilities, type ISynovaModelLimits, type ISynovaModelPricing, type ISynovaModelsResponse, type ISynovaPrompt, type ISynovaPromptVariable, type ISynovaProvider, type ISynovaRetryConfig, type ISynovaToolCall, type ISynovaToolResult, type ISynovaUploadOptions, type ISynovaUploadResponse, type ISynovaUploadedFile, NetworkSynovaError, NotFoundSynovaError, RateLimitSynovaError, ServerSynovaError, SynovaCloudSdk, SynovaError, type TSynovaMessageRole, type TSynovaModelType, type TSynovaResponseType, type TSynovaRetryStrategy, type TSynovaUsageType, TimeoutSynovaError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type TSynovaMessageRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
2
|
-
type TSynovaResponseType = 'message' | 'tool_calls' | 'image' | 'error';
|
|
2
|
+
type TSynovaResponseType = 'message' | 'tool_calls' | 'image' | 'audio' | 'error';
|
|
3
3
|
type TSynovaModelType = 'text' | 'image';
|
|
4
|
+
type TSynovaUsageType = 'tokens' | 'images' | 'time';
|
|
4
5
|
interface ISynovaLogger {
|
|
5
6
|
debug: (message: string, ...args: unknown[]) => void;
|
|
6
7
|
info: (message: string, ...args: unknown[]) => void;
|
|
@@ -99,10 +100,21 @@ interface ISynovaExecuteOptions {
|
|
|
99
100
|
/** JSON Schema for structured output */
|
|
100
101
|
responseSchema?: Record<string, unknown>;
|
|
101
102
|
}
|
|
102
|
-
interface
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
interface ISynovaExecutionUsage {
|
|
104
|
+
/** Usage type: 'tokens' for LLM, 'images' for image generation, 'time' for time-based billing */
|
|
105
|
+
type: TSynovaUsageType;
|
|
106
|
+
/** Input tokens (when type='tokens') */
|
|
107
|
+
inputTokens?: number;
|
|
108
|
+
/** Output tokens (when type='tokens') */
|
|
109
|
+
outputTokens?: number;
|
|
110
|
+
/** Total tokens (when type='tokens') */
|
|
111
|
+
totalTokens?: number;
|
|
112
|
+
/** Number of images generated (when type='images') */
|
|
113
|
+
imageCount?: number;
|
|
114
|
+
/** Image resolution (when type='images') */
|
|
115
|
+
resolution?: string;
|
|
116
|
+
/** Prediction time in seconds (when type='time') */
|
|
117
|
+
predictTimeSeconds?: number;
|
|
106
118
|
}
|
|
107
119
|
interface ISynovaExecutionError {
|
|
108
120
|
code: string;
|
|
@@ -142,8 +154,8 @@ interface ISynovaExecuteResponse {
|
|
|
142
154
|
files?: ISynovaFileAttachment[];
|
|
143
155
|
/** Error details (when type='error') */
|
|
144
156
|
error?: ISynovaExecutionError;
|
|
145
|
-
/**
|
|
146
|
-
|
|
157
|
+
/** Execution usage statistics (tokens, images, or time-based) */
|
|
158
|
+
executionUsage?: ISynovaExecutionUsage;
|
|
147
159
|
}
|
|
148
160
|
interface ISynovaModelCapabilities {
|
|
149
161
|
text_generation?: boolean;
|
|
@@ -561,4 +573,4 @@ declare class ServerSynovaError extends SynovaError {
|
|
|
561
573
|
constructor(httpCode: number, message?: string);
|
|
562
574
|
}
|
|
563
575
|
|
|
564
|
-
export { ApiSynovaError, AuthSynovaError, type ISynovaConfig, type ISynovaExecuteOptions, type ISynovaExecuteResponse, type ISynovaExecutionError, type ISynovaFileAttachment, type ISynovaFileThumbnails, type ISynovaGetPromptOptions, type ISynovaListModelsOptions, type ISynovaLogger, type ISynovaMessage, type ISynovaModel, type ISynovaModelCapabilities, type ISynovaModelLimits, type ISynovaModelPricing, type ISynovaModelsResponse, type ISynovaPrompt, type ISynovaPromptVariable, type ISynovaProvider, type ISynovaRetryConfig, type ISynovaToolCall, type ISynovaToolResult, type ISynovaUploadOptions, type ISynovaUploadResponse, type ISynovaUploadedFile,
|
|
576
|
+
export { ApiSynovaError, AuthSynovaError, type ISynovaConfig, type ISynovaExecuteOptions, type ISynovaExecuteResponse, type ISynovaExecutionError, type ISynovaExecutionUsage, type ISynovaFileAttachment, type ISynovaFileThumbnails, type ISynovaGetPromptOptions, type ISynovaListModelsOptions, type ISynovaLogger, type ISynovaMessage, type ISynovaModel, type ISynovaModelCapabilities, type ISynovaModelLimits, type ISynovaModelPricing, type ISynovaModelsResponse, type ISynovaPrompt, type ISynovaPromptVariable, type ISynovaProvider, type ISynovaRetryConfig, type ISynovaToolCall, type ISynovaToolResult, type ISynovaUploadOptions, type ISynovaUploadResponse, type ISynovaUploadedFile, NetworkSynovaError, NotFoundSynovaError, RateLimitSynovaError, ServerSynovaError, SynovaCloudSdk, SynovaError, type TSynovaMessageRole, type TSynovaModelType, type TSynovaResponseType, type TSynovaRetryStrategy, type TSynovaUsageType, TimeoutSynovaError };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synova-cloud/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Official Node.js SDK for Synova Cloud API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"author": "Synova Cloud",
|
|
47
47
|
"homepage": "https://synova.cloud",
|
|
48
48
|
"bugs": {
|
|
49
|
-
"url": "https://github.com/synova-cloud/synova-cloud-sdk
|
|
49
|
+
"url": "https://github.com/synova-cloud/synova-cloud-node-sdk/issues"
|
|
50
50
|
},
|
|
51
51
|
"license": "MIT",
|
|
52
52
|
"repository": {
|
|
53
53
|
"type": "git",
|
|
54
|
-
"url": "https://github.com/synova-cloud/synova-cloud-sdk
|
|
54
|
+
"url": "https://github.com/synova-cloud/synova-cloud-node-sdk.git"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=18"
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@eslint/js": "^9.39.1",
|
|
61
61
|
"@semantic-release/changelog": "^6.0.3",
|
|
62
62
|
"@semantic-release/git": "^10.0.1",
|
|
63
|
+
"@semantic-release/npm": "^13.1.3",
|
|
63
64
|
"@types/node": "^20.10.0",
|
|
64
65
|
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
|
65
66
|
"@typescript-eslint/parser": "^8.48.0",
|
|
@@ -67,7 +68,7 @@
|
|
|
67
68
|
"eslint-config-prettier": "^10.1.8",
|
|
68
69
|
"eslint-plugin-prettier": "^5.5.4",
|
|
69
70
|
"prettier": "^3.6.2",
|
|
70
|
-
"semantic-release": "^
|
|
71
|
+
"semantic-release": "^25.0.2",
|
|
71
72
|
"tsup": "^8.0.0",
|
|
72
73
|
"typescript": "^5.3.0",
|
|
73
74
|
"typescript-eslint": "^8.48.0",
|