@synova-cloud/sdk 1.5.0 → 1.6.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/README.md +23 -92
- package/dist/index.cjs +7 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -149
- package/dist/index.d.ts +18 -149
- package/dist/index.js +7 -123
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -102,8 +102,10 @@ interface ISynovaExecuteOptions {
|
|
|
102
102
|
provider: string;
|
|
103
103
|
/** LLM model to use (e.g., 'gpt-4o', 'claude-sonnet-4-20250514') */
|
|
104
104
|
model: string;
|
|
105
|
-
/**
|
|
106
|
-
|
|
105
|
+
/** Raw API key for the LLM provider */
|
|
106
|
+
apiKey?: string;
|
|
107
|
+
/** Azure OpenAI endpoint URL (required for azure_openai provider) */
|
|
108
|
+
azureEndpoint?: string;
|
|
107
109
|
/** Variables to substitute in prompt template */
|
|
108
110
|
variables?: Record<string, unknown>;
|
|
109
111
|
/** Previous messages for multi-turn conversation */
|
|
@@ -144,10 +146,8 @@ interface ISynovaProviderResponse {
|
|
|
144
146
|
interface ISynovaExecutionErrorDetails {
|
|
145
147
|
/** Model used for the execution */
|
|
146
148
|
model?: string;
|
|
147
|
-
/** API key
|
|
148
|
-
|
|
149
|
-
/** API key label (human-readable name) */
|
|
150
|
-
apiKeyLabel?: string;
|
|
149
|
+
/** Last 5 characters of the API key used (for debugging) */
|
|
150
|
+
apiKeyHint?: string;
|
|
151
151
|
/** Prompt ID (if execution was via prompt) */
|
|
152
152
|
promptId?: string;
|
|
153
153
|
/** Prompt version (if execution was via prompt) */
|
|
@@ -276,49 +276,6 @@ interface ISynovaUploadOptions {
|
|
|
276
276
|
/** Project ID to associate files with */
|
|
277
277
|
projectId: string;
|
|
278
278
|
}
|
|
279
|
-
type TSynovaLlmProvider = 'openai' | 'anthropic' | 'google' | 'azure_openai' | 'deepseek' | 'replicate' | 'xai' | 'openrouter';
|
|
280
|
-
interface ISynovaAzureConfig {
|
|
281
|
-
/** Azure OpenAI endpoint URL */
|
|
282
|
-
endpoint: string;
|
|
283
|
-
}
|
|
284
|
-
interface ISynovaLlmProviderKey {
|
|
285
|
-
/** Key ID */
|
|
286
|
-
id: string;
|
|
287
|
-
/** LLM provider */
|
|
288
|
-
provider: TSynovaLlmProvider;
|
|
289
|
-
/** Masked API key (last 4 characters visible) */
|
|
290
|
-
maskedKey: string;
|
|
291
|
-
/** Whether this is the default key for the provider */
|
|
292
|
-
isDefault: boolean;
|
|
293
|
-
/** Default model for this provider */
|
|
294
|
-
defaultModel?: string;
|
|
295
|
-
/** Azure OpenAI configuration */
|
|
296
|
-
azure?: ISynovaAzureConfig;
|
|
297
|
-
/** Optional label to identify this key */
|
|
298
|
-
label?: string;
|
|
299
|
-
/** Creation date (ISO 8601) */
|
|
300
|
-
createdAt: string;
|
|
301
|
-
/** Last update date (ISO 8601) */
|
|
302
|
-
updatedAt: string;
|
|
303
|
-
}
|
|
304
|
-
interface ISynovaLlmProviderKeyListResponse {
|
|
305
|
-
items: ISynovaLlmProviderKey[];
|
|
306
|
-
total: number;
|
|
307
|
-
}
|
|
308
|
-
interface ISynovaCreateLlmProviderKeyOptions {
|
|
309
|
-
/** LLM provider */
|
|
310
|
-
provider: TSynovaLlmProvider;
|
|
311
|
-
/** API key for the LLM provider */
|
|
312
|
-
apiKey: string;
|
|
313
|
-
/** Whether this is the default key for the provider */
|
|
314
|
-
isDefault?: boolean;
|
|
315
|
-
/** Default model for this provider */
|
|
316
|
-
defaultModel?: string;
|
|
317
|
-
/** Azure OpenAI configuration (required for azure_openai provider) */
|
|
318
|
-
azure?: ISynovaAzureConfig;
|
|
319
|
-
/** Optional label to identify this key */
|
|
320
|
-
label?: string;
|
|
321
|
-
}
|
|
322
279
|
interface IApiErrorResponse {
|
|
323
280
|
code: string;
|
|
324
281
|
httpCode: number;
|
|
@@ -556,95 +513,6 @@ declare class FilesResource {
|
|
|
556
513
|
upload(files: (File | Blob)[], options: ISynovaUploadOptions): Promise<ISynovaUploadResponse>;
|
|
557
514
|
}
|
|
558
515
|
|
|
559
|
-
declare class LlmProviderKeysResource {
|
|
560
|
-
private readonly http;
|
|
561
|
-
constructor(http: HttpClient);
|
|
562
|
-
/**
|
|
563
|
-
* List all LLM provider keys
|
|
564
|
-
*
|
|
565
|
-
* @returns List of LLM provider keys
|
|
566
|
-
*
|
|
567
|
-
* @example
|
|
568
|
-
* ```ts
|
|
569
|
-
* const { items, total } = await client.llmProviderKeys.list();
|
|
570
|
-
* console.log(`Found ${total} keys`);
|
|
571
|
-
* for (const key of items) {
|
|
572
|
-
* console.log(`${key.provider}: ${key.maskedKey} (default: ${key.isDefault})`);
|
|
573
|
-
* }
|
|
574
|
-
* ```
|
|
575
|
-
*/
|
|
576
|
-
list(): Promise<ISynovaLlmProviderKeyListResponse>;
|
|
577
|
-
/**
|
|
578
|
-
* Get an LLM provider key by ID
|
|
579
|
-
*
|
|
580
|
-
* @param id - Key ID (e.g., 'lpk_abc123')
|
|
581
|
-
* @returns LLM provider key details
|
|
582
|
-
*
|
|
583
|
-
* @example
|
|
584
|
-
* ```ts
|
|
585
|
-
* const key = await client.llmProviderKeys.get('lpk_abc123');
|
|
586
|
-
* console.log(`Provider: ${key.provider}, Default: ${key.isDefault}`);
|
|
587
|
-
* ```
|
|
588
|
-
*/
|
|
589
|
-
get(id: string): Promise<ISynovaLlmProviderKey>;
|
|
590
|
-
/**
|
|
591
|
-
* Create a new LLM provider key
|
|
592
|
-
*
|
|
593
|
-
* The first key created for a provider will automatically be set as the default.
|
|
594
|
-
*
|
|
595
|
-
* @param options - Key creation options
|
|
596
|
-
* @returns Created LLM provider key
|
|
597
|
-
*
|
|
598
|
-
* @example
|
|
599
|
-
* ```ts
|
|
600
|
-
* // Create OpenAI key
|
|
601
|
-
* const key = await client.llmProviderKeys.create({
|
|
602
|
-
* provider: 'openai',
|
|
603
|
-
* apiKey: 'sk-...',
|
|
604
|
-
* label: 'Production Key',
|
|
605
|
-
* defaultModel: 'gpt-4o',
|
|
606
|
-
* });
|
|
607
|
-
*
|
|
608
|
-
* // Create Azure OpenAI key
|
|
609
|
-
* const azureKey = await client.llmProviderKeys.create({
|
|
610
|
-
* provider: 'azure_openai',
|
|
611
|
-
* apiKey: 'your-azure-key',
|
|
612
|
-
* azure: {
|
|
613
|
-
* endpoint: 'https://my-resource.openai.azure.com',
|
|
614
|
-
* },
|
|
615
|
-
* label: 'Azure Production',
|
|
616
|
-
* });
|
|
617
|
-
* ```
|
|
618
|
-
*/
|
|
619
|
-
create(options: ISynovaCreateLlmProviderKeyOptions): Promise<ISynovaLlmProviderKey>;
|
|
620
|
-
/**
|
|
621
|
-
* Set an LLM provider key as the default for its provider
|
|
622
|
-
*
|
|
623
|
-
* The previous default key for this provider will be unset.
|
|
624
|
-
*
|
|
625
|
-
* @param id - Key ID to set as default
|
|
626
|
-
* @returns Updated LLM provider key
|
|
627
|
-
*
|
|
628
|
-
* @example
|
|
629
|
-
* ```ts
|
|
630
|
-
* const key = await client.llmProviderKeys.setDefault('lpk_abc123');
|
|
631
|
-
* console.log(`${key.id} is now the default for ${key.provider}`);
|
|
632
|
-
* ```
|
|
633
|
-
*/
|
|
634
|
-
setDefault(id: string): Promise<ISynovaLlmProviderKey>;
|
|
635
|
-
/**
|
|
636
|
-
* Delete an LLM provider key
|
|
637
|
-
*
|
|
638
|
-
* @param id - Key ID to delete
|
|
639
|
-
*
|
|
640
|
-
* @example
|
|
641
|
-
* ```ts
|
|
642
|
-
* await client.llmProviderKeys.delete('lpk_abc123');
|
|
643
|
-
* ```
|
|
644
|
-
*/
|
|
645
|
-
delete(id: string): Promise<void>;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
516
|
/**
|
|
649
517
|
* Synova Cloud SDK client
|
|
650
518
|
*
|
|
@@ -657,10 +525,20 @@ declare class LlmProviderKeysResource {
|
|
|
657
525
|
* // Get a prompt
|
|
658
526
|
* const prompt = await client.prompts.get('prm_abc123');
|
|
659
527
|
*
|
|
660
|
-
* // Execute a prompt
|
|
528
|
+
* // Execute a prompt with direct API key
|
|
661
529
|
* const result = await client.prompts.execute('prm_abc123', {
|
|
662
530
|
* provider: 'openai',
|
|
663
531
|
* model: 'gpt-4o',
|
|
532
|
+
* apiKey: 'sk-...',
|
|
533
|
+
* variables: { topic: 'TypeScript' },
|
|
534
|
+
* });
|
|
535
|
+
*
|
|
536
|
+
* // Execute with Azure OpenAI
|
|
537
|
+
* const azureResult = await client.prompts.execute('prm_abc123', {
|
|
538
|
+
* provider: 'azure_openai',
|
|
539
|
+
* model: 'gpt-4o',
|
|
540
|
+
* apiKey: 'your-azure-key',
|
|
541
|
+
* azureEndpoint: 'https://my-resource.openai.azure.com',
|
|
664
542
|
* variables: { topic: 'TypeScript' },
|
|
665
543
|
* });
|
|
666
544
|
*
|
|
@@ -670,14 +548,6 @@ declare class LlmProviderKeysResource {
|
|
|
670
548
|
* // Get models for a specific provider
|
|
671
549
|
* const openaiModels = await client.models.getByProvider('openai');
|
|
672
550
|
*
|
|
673
|
-
* // Manage LLM provider keys
|
|
674
|
-
* const { items } = await client.llmProviderKeys.list();
|
|
675
|
-
* const newKey = await client.llmProviderKeys.create({
|
|
676
|
-
* provider: 'openai',
|
|
677
|
-
* apiKey: 'sk-...',
|
|
678
|
-
* label: 'Production',
|
|
679
|
-
* });
|
|
680
|
-
*
|
|
681
551
|
* // With custom retry config
|
|
682
552
|
* const clientWithRetry = new SynovaCloudSdk('your-api-key', {
|
|
683
553
|
* retry: {
|
|
@@ -692,7 +562,6 @@ declare class SynovaCloudSdk {
|
|
|
692
562
|
readonly prompts: PromptsResource;
|
|
693
563
|
readonly models: ModelsResource;
|
|
694
564
|
readonly files: FilesResource;
|
|
695
|
-
readonly llmProviderKeys: LlmProviderKeysResource;
|
|
696
565
|
private readonly http;
|
|
697
566
|
/**
|
|
698
567
|
* Create a new Synova Cloud SDK client
|
|
@@ -764,4 +633,4 @@ declare class NetworkSynovaError extends SynovaError {
|
|
|
764
633
|
constructor(message: string, cause?: Error);
|
|
765
634
|
}
|
|
766
635
|
|
|
767
|
-
export { ApiSynovaError, AuthSynovaError, type
|
|
636
|
+
export { ApiSynovaError, AuthSynovaError, type ISynovaConfig, type ISynovaExecuteOptions, type ISynovaExecuteResponse, type ISynovaExecutionError, type ISynovaExecutionErrorDetails, 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 ISynovaProviderResponse, 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
|
@@ -102,8 +102,10 @@ interface ISynovaExecuteOptions {
|
|
|
102
102
|
provider: string;
|
|
103
103
|
/** LLM model to use (e.g., 'gpt-4o', 'claude-sonnet-4-20250514') */
|
|
104
104
|
model: string;
|
|
105
|
-
/**
|
|
106
|
-
|
|
105
|
+
/** Raw API key for the LLM provider */
|
|
106
|
+
apiKey?: string;
|
|
107
|
+
/** Azure OpenAI endpoint URL (required for azure_openai provider) */
|
|
108
|
+
azureEndpoint?: string;
|
|
107
109
|
/** Variables to substitute in prompt template */
|
|
108
110
|
variables?: Record<string, unknown>;
|
|
109
111
|
/** Previous messages for multi-turn conversation */
|
|
@@ -144,10 +146,8 @@ interface ISynovaProviderResponse {
|
|
|
144
146
|
interface ISynovaExecutionErrorDetails {
|
|
145
147
|
/** Model used for the execution */
|
|
146
148
|
model?: string;
|
|
147
|
-
/** API key
|
|
148
|
-
|
|
149
|
-
/** API key label (human-readable name) */
|
|
150
|
-
apiKeyLabel?: string;
|
|
149
|
+
/** Last 5 characters of the API key used (for debugging) */
|
|
150
|
+
apiKeyHint?: string;
|
|
151
151
|
/** Prompt ID (if execution was via prompt) */
|
|
152
152
|
promptId?: string;
|
|
153
153
|
/** Prompt version (if execution was via prompt) */
|
|
@@ -276,49 +276,6 @@ interface ISynovaUploadOptions {
|
|
|
276
276
|
/** Project ID to associate files with */
|
|
277
277
|
projectId: string;
|
|
278
278
|
}
|
|
279
|
-
type TSynovaLlmProvider = 'openai' | 'anthropic' | 'google' | 'azure_openai' | 'deepseek' | 'replicate' | 'xai' | 'openrouter';
|
|
280
|
-
interface ISynovaAzureConfig {
|
|
281
|
-
/** Azure OpenAI endpoint URL */
|
|
282
|
-
endpoint: string;
|
|
283
|
-
}
|
|
284
|
-
interface ISynovaLlmProviderKey {
|
|
285
|
-
/** Key ID */
|
|
286
|
-
id: string;
|
|
287
|
-
/** LLM provider */
|
|
288
|
-
provider: TSynovaLlmProvider;
|
|
289
|
-
/** Masked API key (last 4 characters visible) */
|
|
290
|
-
maskedKey: string;
|
|
291
|
-
/** Whether this is the default key for the provider */
|
|
292
|
-
isDefault: boolean;
|
|
293
|
-
/** Default model for this provider */
|
|
294
|
-
defaultModel?: string;
|
|
295
|
-
/** Azure OpenAI configuration */
|
|
296
|
-
azure?: ISynovaAzureConfig;
|
|
297
|
-
/** Optional label to identify this key */
|
|
298
|
-
label?: string;
|
|
299
|
-
/** Creation date (ISO 8601) */
|
|
300
|
-
createdAt: string;
|
|
301
|
-
/** Last update date (ISO 8601) */
|
|
302
|
-
updatedAt: string;
|
|
303
|
-
}
|
|
304
|
-
interface ISynovaLlmProviderKeyListResponse {
|
|
305
|
-
items: ISynovaLlmProviderKey[];
|
|
306
|
-
total: number;
|
|
307
|
-
}
|
|
308
|
-
interface ISynovaCreateLlmProviderKeyOptions {
|
|
309
|
-
/** LLM provider */
|
|
310
|
-
provider: TSynovaLlmProvider;
|
|
311
|
-
/** API key for the LLM provider */
|
|
312
|
-
apiKey: string;
|
|
313
|
-
/** Whether this is the default key for the provider */
|
|
314
|
-
isDefault?: boolean;
|
|
315
|
-
/** Default model for this provider */
|
|
316
|
-
defaultModel?: string;
|
|
317
|
-
/** Azure OpenAI configuration (required for azure_openai provider) */
|
|
318
|
-
azure?: ISynovaAzureConfig;
|
|
319
|
-
/** Optional label to identify this key */
|
|
320
|
-
label?: string;
|
|
321
|
-
}
|
|
322
279
|
interface IApiErrorResponse {
|
|
323
280
|
code: string;
|
|
324
281
|
httpCode: number;
|
|
@@ -556,95 +513,6 @@ declare class FilesResource {
|
|
|
556
513
|
upload(files: (File | Blob)[], options: ISynovaUploadOptions): Promise<ISynovaUploadResponse>;
|
|
557
514
|
}
|
|
558
515
|
|
|
559
|
-
declare class LlmProviderKeysResource {
|
|
560
|
-
private readonly http;
|
|
561
|
-
constructor(http: HttpClient);
|
|
562
|
-
/**
|
|
563
|
-
* List all LLM provider keys
|
|
564
|
-
*
|
|
565
|
-
* @returns List of LLM provider keys
|
|
566
|
-
*
|
|
567
|
-
* @example
|
|
568
|
-
* ```ts
|
|
569
|
-
* const { items, total } = await client.llmProviderKeys.list();
|
|
570
|
-
* console.log(`Found ${total} keys`);
|
|
571
|
-
* for (const key of items) {
|
|
572
|
-
* console.log(`${key.provider}: ${key.maskedKey} (default: ${key.isDefault})`);
|
|
573
|
-
* }
|
|
574
|
-
* ```
|
|
575
|
-
*/
|
|
576
|
-
list(): Promise<ISynovaLlmProviderKeyListResponse>;
|
|
577
|
-
/**
|
|
578
|
-
* Get an LLM provider key by ID
|
|
579
|
-
*
|
|
580
|
-
* @param id - Key ID (e.g., 'lpk_abc123')
|
|
581
|
-
* @returns LLM provider key details
|
|
582
|
-
*
|
|
583
|
-
* @example
|
|
584
|
-
* ```ts
|
|
585
|
-
* const key = await client.llmProviderKeys.get('lpk_abc123');
|
|
586
|
-
* console.log(`Provider: ${key.provider}, Default: ${key.isDefault}`);
|
|
587
|
-
* ```
|
|
588
|
-
*/
|
|
589
|
-
get(id: string): Promise<ISynovaLlmProviderKey>;
|
|
590
|
-
/**
|
|
591
|
-
* Create a new LLM provider key
|
|
592
|
-
*
|
|
593
|
-
* The first key created for a provider will automatically be set as the default.
|
|
594
|
-
*
|
|
595
|
-
* @param options - Key creation options
|
|
596
|
-
* @returns Created LLM provider key
|
|
597
|
-
*
|
|
598
|
-
* @example
|
|
599
|
-
* ```ts
|
|
600
|
-
* // Create OpenAI key
|
|
601
|
-
* const key = await client.llmProviderKeys.create({
|
|
602
|
-
* provider: 'openai',
|
|
603
|
-
* apiKey: 'sk-...',
|
|
604
|
-
* label: 'Production Key',
|
|
605
|
-
* defaultModel: 'gpt-4o',
|
|
606
|
-
* });
|
|
607
|
-
*
|
|
608
|
-
* // Create Azure OpenAI key
|
|
609
|
-
* const azureKey = await client.llmProviderKeys.create({
|
|
610
|
-
* provider: 'azure_openai',
|
|
611
|
-
* apiKey: 'your-azure-key',
|
|
612
|
-
* azure: {
|
|
613
|
-
* endpoint: 'https://my-resource.openai.azure.com',
|
|
614
|
-
* },
|
|
615
|
-
* label: 'Azure Production',
|
|
616
|
-
* });
|
|
617
|
-
* ```
|
|
618
|
-
*/
|
|
619
|
-
create(options: ISynovaCreateLlmProviderKeyOptions): Promise<ISynovaLlmProviderKey>;
|
|
620
|
-
/**
|
|
621
|
-
* Set an LLM provider key as the default for its provider
|
|
622
|
-
*
|
|
623
|
-
* The previous default key for this provider will be unset.
|
|
624
|
-
*
|
|
625
|
-
* @param id - Key ID to set as default
|
|
626
|
-
* @returns Updated LLM provider key
|
|
627
|
-
*
|
|
628
|
-
* @example
|
|
629
|
-
* ```ts
|
|
630
|
-
* const key = await client.llmProviderKeys.setDefault('lpk_abc123');
|
|
631
|
-
* console.log(`${key.id} is now the default for ${key.provider}`);
|
|
632
|
-
* ```
|
|
633
|
-
*/
|
|
634
|
-
setDefault(id: string): Promise<ISynovaLlmProviderKey>;
|
|
635
|
-
/**
|
|
636
|
-
* Delete an LLM provider key
|
|
637
|
-
*
|
|
638
|
-
* @param id - Key ID to delete
|
|
639
|
-
*
|
|
640
|
-
* @example
|
|
641
|
-
* ```ts
|
|
642
|
-
* await client.llmProviderKeys.delete('lpk_abc123');
|
|
643
|
-
* ```
|
|
644
|
-
*/
|
|
645
|
-
delete(id: string): Promise<void>;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
516
|
/**
|
|
649
517
|
* Synova Cloud SDK client
|
|
650
518
|
*
|
|
@@ -657,10 +525,20 @@ declare class LlmProviderKeysResource {
|
|
|
657
525
|
* // Get a prompt
|
|
658
526
|
* const prompt = await client.prompts.get('prm_abc123');
|
|
659
527
|
*
|
|
660
|
-
* // Execute a prompt
|
|
528
|
+
* // Execute a prompt with direct API key
|
|
661
529
|
* const result = await client.prompts.execute('prm_abc123', {
|
|
662
530
|
* provider: 'openai',
|
|
663
531
|
* model: 'gpt-4o',
|
|
532
|
+
* apiKey: 'sk-...',
|
|
533
|
+
* variables: { topic: 'TypeScript' },
|
|
534
|
+
* });
|
|
535
|
+
*
|
|
536
|
+
* // Execute with Azure OpenAI
|
|
537
|
+
* const azureResult = await client.prompts.execute('prm_abc123', {
|
|
538
|
+
* provider: 'azure_openai',
|
|
539
|
+
* model: 'gpt-4o',
|
|
540
|
+
* apiKey: 'your-azure-key',
|
|
541
|
+
* azureEndpoint: 'https://my-resource.openai.azure.com',
|
|
664
542
|
* variables: { topic: 'TypeScript' },
|
|
665
543
|
* });
|
|
666
544
|
*
|
|
@@ -670,14 +548,6 @@ declare class LlmProviderKeysResource {
|
|
|
670
548
|
* // Get models for a specific provider
|
|
671
549
|
* const openaiModels = await client.models.getByProvider('openai');
|
|
672
550
|
*
|
|
673
|
-
* // Manage LLM provider keys
|
|
674
|
-
* const { items } = await client.llmProviderKeys.list();
|
|
675
|
-
* const newKey = await client.llmProviderKeys.create({
|
|
676
|
-
* provider: 'openai',
|
|
677
|
-
* apiKey: 'sk-...',
|
|
678
|
-
* label: 'Production',
|
|
679
|
-
* });
|
|
680
|
-
*
|
|
681
551
|
* // With custom retry config
|
|
682
552
|
* const clientWithRetry = new SynovaCloudSdk('your-api-key', {
|
|
683
553
|
* retry: {
|
|
@@ -692,7 +562,6 @@ declare class SynovaCloudSdk {
|
|
|
692
562
|
readonly prompts: PromptsResource;
|
|
693
563
|
readonly models: ModelsResource;
|
|
694
564
|
readonly files: FilesResource;
|
|
695
|
-
readonly llmProviderKeys: LlmProviderKeysResource;
|
|
696
565
|
private readonly http;
|
|
697
566
|
/**
|
|
698
567
|
* Create a new Synova Cloud SDK client
|
|
@@ -764,4 +633,4 @@ declare class NetworkSynovaError extends SynovaError {
|
|
|
764
633
|
constructor(message: string, cause?: Error);
|
|
765
634
|
}
|
|
766
635
|
|
|
767
|
-
export { ApiSynovaError, AuthSynovaError, type
|
|
636
|
+
export { ApiSynovaError, AuthSynovaError, type ISynovaConfig, type ISynovaExecuteOptions, type ISynovaExecuteResponse, type ISynovaExecutionError, type ISynovaExecutionErrorDetails, 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 ISynovaProviderResponse, 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.js
CHANGED
|
@@ -71,7 +71,7 @@ var NetworkSynovaError = class extends SynovaError {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
// src/version.ts
|
|
74
|
-
var SDK_VERSION = "1.
|
|
74
|
+
var SDK_VERSION = "1.6.0" ;
|
|
75
75
|
|
|
76
76
|
// src/utils/http.ts
|
|
77
77
|
var HttpClient = class {
|
|
@@ -361,7 +361,8 @@ var PromptsResource = class {
|
|
|
361
361
|
provider: options.provider,
|
|
362
362
|
model: options.model
|
|
363
363
|
};
|
|
364
|
-
if (options.
|
|
364
|
+
if (options.apiKey !== void 0) body.apiKey = options.apiKey;
|
|
365
|
+
if (options.azureEndpoint !== void 0) body.azureEndpoint = options.azureEndpoint;
|
|
365
366
|
if (options.variables !== void 0) body.variables = options.variables;
|
|
366
367
|
if (options.messages !== void 0) body.messages = options.messages;
|
|
367
368
|
if (options.tag !== void 0) body.tag = options.tag;
|
|
@@ -400,7 +401,8 @@ var PromptsResource = class {
|
|
|
400
401
|
tag,
|
|
401
402
|
provider: options.provider,
|
|
402
403
|
model: options.model,
|
|
403
|
-
|
|
404
|
+
apiKey: options.apiKey,
|
|
405
|
+
azureEndpoint: options.azureEndpoint,
|
|
404
406
|
variables: options.variables,
|
|
405
407
|
messages: options.messages,
|
|
406
408
|
metadata: options.metadata,
|
|
@@ -433,7 +435,8 @@ var PromptsResource = class {
|
|
|
433
435
|
version,
|
|
434
436
|
provider: options.provider,
|
|
435
437
|
model: options.model,
|
|
436
|
-
|
|
438
|
+
apiKey: options.apiKey,
|
|
439
|
+
azureEndpoint: options.azureEndpoint,
|
|
437
440
|
variables: options.variables,
|
|
438
441
|
messages: options.messages,
|
|
439
442
|
metadata: options.metadata,
|
|
@@ -571,123 +574,6 @@ var FilesResource = class {
|
|
|
571
574
|
}
|
|
572
575
|
};
|
|
573
576
|
|
|
574
|
-
// src/resources/llm-provider-keys.ts
|
|
575
|
-
var LlmProviderKeysResource = class {
|
|
576
|
-
constructor(http) {
|
|
577
|
-
this.http = http;
|
|
578
|
-
}
|
|
579
|
-
/**
|
|
580
|
-
* List all LLM provider keys
|
|
581
|
-
*
|
|
582
|
-
* @returns List of LLM provider keys
|
|
583
|
-
*
|
|
584
|
-
* @example
|
|
585
|
-
* ```ts
|
|
586
|
-
* const { items, total } = await client.llmProviderKeys.list();
|
|
587
|
-
* console.log(`Found ${total} keys`);
|
|
588
|
-
* for (const key of items) {
|
|
589
|
-
* console.log(`${key.provider}: ${key.maskedKey} (default: ${key.isDefault})`);
|
|
590
|
-
* }
|
|
591
|
-
* ```
|
|
592
|
-
*/
|
|
593
|
-
async list() {
|
|
594
|
-
return this.http.request({
|
|
595
|
-
method: "GET",
|
|
596
|
-
path: "/api/v1/llm-provider-keys"
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
/**
|
|
600
|
-
* Get an LLM provider key by ID
|
|
601
|
-
*
|
|
602
|
-
* @param id - Key ID (e.g., 'lpk_abc123')
|
|
603
|
-
* @returns LLM provider key details
|
|
604
|
-
*
|
|
605
|
-
* @example
|
|
606
|
-
* ```ts
|
|
607
|
-
* const key = await client.llmProviderKeys.get('lpk_abc123');
|
|
608
|
-
* console.log(`Provider: ${key.provider}, Default: ${key.isDefault}`);
|
|
609
|
-
* ```
|
|
610
|
-
*/
|
|
611
|
-
async get(id) {
|
|
612
|
-
return this.http.request({
|
|
613
|
-
method: "GET",
|
|
614
|
-
path: `/api/v1/llm-provider-keys/${id}`
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* Create a new LLM provider key
|
|
619
|
-
*
|
|
620
|
-
* The first key created for a provider will automatically be set as the default.
|
|
621
|
-
*
|
|
622
|
-
* @param options - Key creation options
|
|
623
|
-
* @returns Created LLM provider key
|
|
624
|
-
*
|
|
625
|
-
* @example
|
|
626
|
-
* ```ts
|
|
627
|
-
* // Create OpenAI key
|
|
628
|
-
* const key = await client.llmProviderKeys.create({
|
|
629
|
-
* provider: 'openai',
|
|
630
|
-
* apiKey: 'sk-...',
|
|
631
|
-
* label: 'Production Key',
|
|
632
|
-
* defaultModel: 'gpt-4o',
|
|
633
|
-
* });
|
|
634
|
-
*
|
|
635
|
-
* // Create Azure OpenAI key
|
|
636
|
-
* const azureKey = await client.llmProviderKeys.create({
|
|
637
|
-
* provider: 'azure_openai',
|
|
638
|
-
* apiKey: 'your-azure-key',
|
|
639
|
-
* azure: {
|
|
640
|
-
* endpoint: 'https://my-resource.openai.azure.com',
|
|
641
|
-
* },
|
|
642
|
-
* label: 'Azure Production',
|
|
643
|
-
* });
|
|
644
|
-
* ```
|
|
645
|
-
*/
|
|
646
|
-
async create(options) {
|
|
647
|
-
return this.http.request({
|
|
648
|
-
method: "POST",
|
|
649
|
-
path: "/api/v1/llm-provider-keys",
|
|
650
|
-
body: options
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* Set an LLM provider key as the default for its provider
|
|
655
|
-
*
|
|
656
|
-
* The previous default key for this provider will be unset.
|
|
657
|
-
*
|
|
658
|
-
* @param id - Key ID to set as default
|
|
659
|
-
* @returns Updated LLM provider key
|
|
660
|
-
*
|
|
661
|
-
* @example
|
|
662
|
-
* ```ts
|
|
663
|
-
* const key = await client.llmProviderKeys.setDefault('lpk_abc123');
|
|
664
|
-
* console.log(`${key.id} is now the default for ${key.provider}`);
|
|
665
|
-
* ```
|
|
666
|
-
*/
|
|
667
|
-
async setDefault(id) {
|
|
668
|
-
return this.http.request({
|
|
669
|
-
method: "POST",
|
|
670
|
-
path: `/api/v1/llm-provider-keys/${id}/set-default`
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
/**
|
|
674
|
-
* Delete an LLM provider key
|
|
675
|
-
*
|
|
676
|
-
* @param id - Key ID to delete
|
|
677
|
-
*
|
|
678
|
-
* @example
|
|
679
|
-
* ```ts
|
|
680
|
-
* await client.llmProviderKeys.delete('lpk_abc123');
|
|
681
|
-
* ```
|
|
682
|
-
*/
|
|
683
|
-
async delete(id) {
|
|
684
|
-
await this.http.request({
|
|
685
|
-
method: "DELETE",
|
|
686
|
-
path: `/api/v1/llm-provider-keys/${id}`
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
};
|
|
690
|
-
|
|
691
577
|
// src/client.ts
|
|
692
578
|
var DEFAULT_BASE_URL = "https://api.synova.cloud";
|
|
693
579
|
var DEFAULT_TIMEOUT = 3e4;
|
|
@@ -708,7 +594,6 @@ var SynovaCloudSdk = class {
|
|
|
708
594
|
prompts;
|
|
709
595
|
models;
|
|
710
596
|
files;
|
|
711
|
-
llmProviderKeys;
|
|
712
597
|
http;
|
|
713
598
|
/**
|
|
714
599
|
* Create a new Synova Cloud SDK client
|
|
@@ -737,7 +622,6 @@ var SynovaCloudSdk = class {
|
|
|
737
622
|
this.prompts = new PromptsResource(this.http);
|
|
738
623
|
this.models = new ModelsResource(this.http);
|
|
739
624
|
this.files = new FilesResource(this.http);
|
|
740
|
-
this.llmProviderKeys = new LlmProviderKeysResource(this.http);
|
|
741
625
|
}
|
|
742
626
|
};
|
|
743
627
|
|