@toothfairyai/sdk 0.6.3 → 0.6.4
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 +171 -75
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
Official TypeScript SDK for the ToothFairyAI API - A comprehensive toolkit for building AI-powered applications with chat, document processing, agent management, and more.
|
|
4
4
|
|
|
5
|
+
**Status**: Production Ready | **Version**: 0.6.4
|
|
6
|
+
|
|
7
|
+
## Test Results
|
|
8
|
+
|
|
9
|
+
The SDK includes comprehensive verification tests ensuring all managers and methods are properly implemented:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Test Suites: 1 passed, 1 total
|
|
13
|
+
Tests: 62 passed, 62 total
|
|
14
|
+
|
|
15
|
+
✓ SDK Structure (3 tests)
|
|
16
|
+
- Client initialization with proper parameters
|
|
17
|
+
- All 24 managers accessible
|
|
18
|
+
- Expected methods on each manager
|
|
19
|
+
|
|
20
|
+
✓ Method Signatures (17 tests)
|
|
21
|
+
- Agent, Chat, Document, Entity, Streaming, Billing managers
|
|
22
|
+
|
|
23
|
+
✓ Error Handling (5 tests)
|
|
24
|
+
- Missing API key/workspace ID validation
|
|
25
|
+
- ToothFairyError properties and inheritance
|
|
26
|
+
|
|
27
|
+
✓ SDK Completeness (27 tests)
|
|
28
|
+
- Core files present
|
|
29
|
+
- All 24 manager directories with manager files
|
|
30
|
+
- Proper export structure
|
|
31
|
+
|
|
32
|
+
✓ Type Definitions (4 tests)
|
|
33
|
+
- AgentMode, EntityType, DocumentType, StreamEventType
|
|
34
|
+
|
|
35
|
+
✓ Client Methods (6 tests)
|
|
36
|
+
- testConnection, getHealth, getStreamingUrl, getWorkspaceId, getConfig, request, aiRequest
|
|
37
|
+
```
|
|
38
|
+
|
|
5
39
|
## Installation
|
|
6
40
|
|
|
7
41
|
```bash
|
|
@@ -697,26 +731,33 @@ const cloned = await client.prompts.clone('prompt-id', 'user-123', {
|
|
|
697
731
|
#### Create an Agent Function
|
|
698
732
|
|
|
699
733
|
```typescript
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
734
|
+
// Create a GET function
|
|
735
|
+
const getFunc = await client.agentFunctions.create('Weather API', {
|
|
736
|
+
description: 'Get current weather data for a location',
|
|
703
737
|
url: 'https://api.weather.com/current',
|
|
704
|
-
model: 'gpt-4',
|
|
705
738
|
requestType: 'GET',
|
|
706
739
|
authorisationType: 'bearer',
|
|
707
740
|
authorisationKey: 'your-token',
|
|
708
|
-
description: 'Get current weather data',
|
|
709
741
|
parameters: [
|
|
710
742
|
{ name: 'location', type: 'string', required: true }
|
|
711
743
|
]
|
|
712
744
|
});
|
|
745
|
+
|
|
746
|
+
// Create a POST function with headers
|
|
747
|
+
const postFunc = await client.agentFunctions.create('Create Order', {
|
|
748
|
+
description: 'Create a new order in the system',
|
|
749
|
+
url: 'https://api.example.com/orders',
|
|
750
|
+
requestType: 'POST',
|
|
751
|
+
authorisationType: 'apikey',
|
|
752
|
+
headers: [{ key: 'Content-Type', value: 'application/json' }],
|
|
753
|
+
staticArgs: [{ key: 'source', value: 'chatbot' }]
|
|
754
|
+
});
|
|
713
755
|
```
|
|
714
756
|
|
|
715
757
|
#### Update Agent Function
|
|
716
758
|
|
|
717
759
|
```typescript
|
|
718
|
-
const func = await client.agentFunctions.update({
|
|
719
|
-
id: 'function-1',
|
|
760
|
+
const func = await client.agentFunctions.update('function-id', {
|
|
720
761
|
name: 'Updated Function Name',
|
|
721
762
|
url: 'https://new-url.com'
|
|
722
763
|
});
|
|
@@ -725,13 +766,13 @@ const func = await client.agentFunctions.update({
|
|
|
725
766
|
#### Delete Agent Function
|
|
726
767
|
|
|
727
768
|
```typescript
|
|
728
|
-
await client.agentFunctions.delete('function-
|
|
769
|
+
await client.agentFunctions.delete('function-id');
|
|
729
770
|
```
|
|
730
771
|
|
|
731
772
|
#### Get Agent Function
|
|
732
773
|
|
|
733
774
|
```typescript
|
|
734
|
-
const func = await client.agentFunctions.get('function-
|
|
775
|
+
const func = await client.agentFunctions.get('function-id');
|
|
735
776
|
console.log(`Name: ${func.name}`);
|
|
736
777
|
console.log(`URL: ${func.url}`);
|
|
737
778
|
```
|
|
@@ -739,23 +780,40 @@ console.log(`URL: ${func.url}`);
|
|
|
739
780
|
#### List Agent Functions
|
|
740
781
|
|
|
741
782
|
```typescript
|
|
742
|
-
const functions = await client.agentFunctions.list(20);
|
|
783
|
+
const functions = await client.agentFunctions.list(20, 0);
|
|
743
784
|
for (const func of functions.items) {
|
|
744
785
|
console.log(`${func.name}`);
|
|
745
786
|
}
|
|
746
787
|
```
|
|
747
788
|
|
|
789
|
+
#### Search Agent Functions
|
|
790
|
+
|
|
791
|
+
```typescript
|
|
792
|
+
const results = await client.agentFunctions.search('weather');
|
|
793
|
+
for (const func of results) {
|
|
794
|
+
console.log(`${func.name}`);
|
|
795
|
+
}
|
|
796
|
+
```
|
|
797
|
+
|
|
748
798
|
### Authorisations
|
|
749
799
|
|
|
750
800
|
#### Create an Authorisation
|
|
751
801
|
|
|
752
802
|
```typescript
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
803
|
+
// API Key authorisation
|
|
804
|
+
const apiKeyAuth = await client.authorisations.create('External API Key', 'apikey', {
|
|
805
|
+
description: 'API key for external service',
|
|
806
|
+
tokenSecret: 'your-api-key-value'
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
// Bearer token authorisation
|
|
810
|
+
const bearerAuth = await client.authorisations.create('Service Token', 'bearer', {
|
|
811
|
+
tokenSecret: 'your-bearer-token'
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
// OAuth authorisation
|
|
815
|
+
const oauthAuth = await client.authorisations.create('GitHub OAuth', 'oauth', {
|
|
816
|
+
description: 'GitHub OAuth for API access',
|
|
759
817
|
scope: 'repo,user',
|
|
760
818
|
grantType: 'authorization_code',
|
|
761
819
|
clientId: 'github-client-id',
|
|
@@ -768,23 +826,22 @@ const auth = await client.authorisations.create({
|
|
|
768
826
|
#### Update Authorisation
|
|
769
827
|
|
|
770
828
|
```typescript
|
|
771
|
-
const auth = await client.authorisations.update({
|
|
772
|
-
id: 'auth-1',
|
|
829
|
+
const auth = await client.authorisations.update('auth-id', {
|
|
773
830
|
name: 'Updated Auth Name',
|
|
774
|
-
|
|
831
|
+
description: 'New description'
|
|
775
832
|
});
|
|
776
833
|
```
|
|
777
834
|
|
|
778
835
|
#### Delete Authorisation
|
|
779
836
|
|
|
780
837
|
```typescript
|
|
781
|
-
await client.authorisations.delete('auth-
|
|
838
|
+
await client.authorisations.delete('auth-id');
|
|
782
839
|
```
|
|
783
840
|
|
|
784
841
|
#### Get Authorisation
|
|
785
842
|
|
|
786
843
|
```typescript
|
|
787
|
-
const auth = await client.authorisations.get('auth-
|
|
844
|
+
const auth = await client.authorisations.get('auth-id');
|
|
788
845
|
console.log(`Name: ${auth.name}`);
|
|
789
846
|
console.log(`Type: ${auth.type}`);
|
|
790
847
|
```
|
|
@@ -792,23 +849,35 @@ console.log(`Type: ${auth.type}`);
|
|
|
792
849
|
#### List Authorisations
|
|
793
850
|
|
|
794
851
|
```typescript
|
|
795
|
-
const auths = await client.authorisations.list(20);
|
|
852
|
+
const auths = await client.authorisations.list(20, 0);
|
|
796
853
|
for (const auth of auths.items) {
|
|
797
854
|
console.log(`${auth.name} (${auth.type})`);
|
|
798
855
|
}
|
|
799
856
|
```
|
|
800
857
|
|
|
858
|
+
#### Get Authorisations by Type
|
|
859
|
+
|
|
860
|
+
```typescript
|
|
861
|
+
const apiKeys = await client.authorisations.getByType('apikey');
|
|
862
|
+
const oauthAuths = await client.authorisations.getByType('oauth');
|
|
863
|
+
```
|
|
864
|
+
|
|
865
|
+
#### Search Authorisations
|
|
866
|
+
|
|
867
|
+
```typescript
|
|
868
|
+
const results = await client.authorisations.search('github');
|
|
869
|
+
for (const auth of results) {
|
|
870
|
+
console.log(`${auth.name}`);
|
|
871
|
+
}
|
|
872
|
+
```
|
|
873
|
+
|
|
801
874
|
### Channels
|
|
802
875
|
|
|
803
876
|
#### Create a Channel
|
|
804
877
|
|
|
805
878
|
```typescript
|
|
806
|
-
const channel = await client.channels.create({
|
|
807
|
-
|
|
808
|
-
name: 'SMS Channel',
|
|
809
|
-
channel: 'sms',
|
|
810
|
-
provider: 'twilio',
|
|
811
|
-
senderid: '+1234567890',
|
|
879
|
+
const channel = await client.channels.create('SMS Channel', 'sms', 'twilio', {
|
|
880
|
+
senderId: '+1234567890',
|
|
812
881
|
description: 'SMS notifications via Twilio',
|
|
813
882
|
isActive: true
|
|
814
883
|
});
|
|
@@ -817,8 +886,7 @@ const channel = await client.channels.create({
|
|
|
817
886
|
#### Update Channel
|
|
818
887
|
|
|
819
888
|
```typescript
|
|
820
|
-
const channel = await client.channels.update({
|
|
821
|
-
id: 'channel-1',
|
|
889
|
+
const channel = await client.channels.update('channel-id', {
|
|
822
890
|
name: 'Updated Channel',
|
|
823
891
|
isActive: false
|
|
824
892
|
});
|
|
@@ -827,13 +895,13 @@ const channel = await client.channels.update({
|
|
|
827
895
|
#### Delete Channel
|
|
828
896
|
|
|
829
897
|
```typescript
|
|
830
|
-
await client.channels.delete('channel-
|
|
898
|
+
await client.channels.delete('channel-id');
|
|
831
899
|
```
|
|
832
900
|
|
|
833
901
|
#### Get Channel
|
|
834
902
|
|
|
835
903
|
```typescript
|
|
836
|
-
const channel = await client.channels.get('channel-
|
|
904
|
+
const channel = await client.channels.get('channel-id');
|
|
837
905
|
console.log(`Name: ${channel.name}`);
|
|
838
906
|
console.log(`Provider: ${channel.provider}`);
|
|
839
907
|
```
|
|
@@ -841,7 +909,7 @@ console.log(`Provider: ${channel.provider}`);
|
|
|
841
909
|
#### List Channels
|
|
842
910
|
|
|
843
911
|
```typescript
|
|
844
|
-
const channels = await client.channels.list(20);
|
|
912
|
+
const channels = await client.channels.list(20, 0);
|
|
845
913
|
for (const channel of channels.items) {
|
|
846
914
|
console.log(`${channel.name} (${channel.provider})`);
|
|
847
915
|
}
|
|
@@ -861,12 +929,28 @@ console.log(`Host: ${connection.host}`);
|
|
|
861
929
|
#### List Connections
|
|
862
930
|
|
|
863
931
|
```typescript
|
|
864
|
-
const connections = await client.connections.list(20);
|
|
932
|
+
const connections = await client.connections.list(20, 0);
|
|
865
933
|
for (const conn of connections.items) {
|
|
866
934
|
console.log(`${conn.name} (${conn.type})`);
|
|
867
935
|
}
|
|
868
936
|
```
|
|
869
937
|
|
|
938
|
+
#### Get Connections by Type
|
|
939
|
+
|
|
940
|
+
```typescript
|
|
941
|
+
const postgresConns = await client.connections.getByType('postgres');
|
|
942
|
+
const mysqlConns = await client.connections.getByType('mysql');
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
#### Search Connections
|
|
946
|
+
|
|
947
|
+
```typescript
|
|
948
|
+
const results = await client.connections.search('database');
|
|
949
|
+
for (const conn of results) {
|
|
950
|
+
console.log(`${conn.name}`);
|
|
951
|
+
}
|
|
952
|
+
```
|
|
953
|
+
|
|
870
954
|
#### Delete Connection
|
|
871
955
|
|
|
872
956
|
```typescript
|
|
@@ -923,7 +1007,7 @@ console.log(`Status: ${site.status}`);
|
|
|
923
1007
|
#### List Sites
|
|
924
1008
|
|
|
925
1009
|
```typescript
|
|
926
|
-
const sites = await client.sites.list(20);
|
|
1010
|
+
const sites = await client.sites.list(20, 0);
|
|
927
1011
|
for (const site of sites.items) {
|
|
928
1012
|
console.log(`${site.name} - ${site.url}`);
|
|
929
1013
|
}
|
|
@@ -932,8 +1016,7 @@ for (const site of sites.items) {
|
|
|
932
1016
|
#### Update Site
|
|
933
1017
|
|
|
934
1018
|
```typescript
|
|
935
|
-
const site = await client.sites.update({
|
|
936
|
-
id: 'site-id',
|
|
1019
|
+
const site = await client.sites.update('site-id', {
|
|
937
1020
|
name: 'Updated Site',
|
|
938
1021
|
status: 'active',
|
|
939
1022
|
allowedPaths: ['/docs', '/blog']
|
|
@@ -951,9 +1034,7 @@ await client.sites.delete('site-id');
|
|
|
951
1034
|
#### Create a Benchmark
|
|
952
1035
|
|
|
953
1036
|
```typescript
|
|
954
|
-
const benchmark = await client.benchmarks.create({
|
|
955
|
-
id: 'benchmark-1',
|
|
956
|
-
name: 'Customer Support Test',
|
|
1037
|
+
const benchmark = await client.benchmarks.create('Customer Support Test', {
|
|
957
1038
|
description: 'Test agent performance on customer support queries',
|
|
958
1039
|
questions: [
|
|
959
1040
|
{
|
|
@@ -970,8 +1051,7 @@ const benchmark = await client.benchmarks.create({
|
|
|
970
1051
|
#### Update Benchmark
|
|
971
1052
|
|
|
972
1053
|
```typescript
|
|
973
|
-
const benchmark = await client.benchmarks.update({
|
|
974
|
-
id: 'benchmark-1',
|
|
1054
|
+
const benchmark = await client.benchmarks.update('benchmark-id', {
|
|
975
1055
|
name: 'Updated Benchmark',
|
|
976
1056
|
description: 'New description'
|
|
977
1057
|
});
|
|
@@ -980,13 +1060,13 @@ const benchmark = await client.benchmarks.update({
|
|
|
980
1060
|
#### Delete Benchmark
|
|
981
1061
|
|
|
982
1062
|
```typescript
|
|
983
|
-
await client.benchmarks.delete('benchmark-
|
|
1063
|
+
await client.benchmarks.delete('benchmark-id');
|
|
984
1064
|
```
|
|
985
1065
|
|
|
986
1066
|
#### Get Benchmark
|
|
987
1067
|
|
|
988
1068
|
```typescript
|
|
989
|
-
const benchmark = await client.benchmarks.get('benchmark-
|
|
1069
|
+
const benchmark = await client.benchmarks.get('benchmark-id');
|
|
990
1070
|
console.log(`Name: ${benchmark.name}`);
|
|
991
1071
|
console.log(`Questions: ${benchmark.questions?.length}`);
|
|
992
1072
|
```
|
|
@@ -994,7 +1074,7 @@ console.log(`Questions: ${benchmark.questions?.length}`);
|
|
|
994
1074
|
#### List Benchmarks
|
|
995
1075
|
|
|
996
1076
|
```typescript
|
|
997
|
-
const benchmarks = await client.benchmarks.list(20);
|
|
1077
|
+
const benchmarks = await client.benchmarks.list(20, 0);
|
|
998
1078
|
for (const benchmark of benchmarks.items) {
|
|
999
1079
|
console.log(`${benchmark.name}`);
|
|
1000
1080
|
}
|
|
@@ -1005,14 +1085,11 @@ for (const benchmark of benchmarks.items) {
|
|
|
1005
1085
|
#### Create a Hook
|
|
1006
1086
|
|
|
1007
1087
|
```typescript
|
|
1008
|
-
const hook = await client.hooks.create({
|
|
1009
|
-
id: 'hook-1',
|
|
1010
|
-
name: 'Data Processing Hook',
|
|
1011
|
-
functionName: 'process_data',
|
|
1088
|
+
const hook = await client.hooks.create('Data Processing Hook', 'process_data', {
|
|
1012
1089
|
customExecutionCode: 'def process_data(data): return data.upper()',
|
|
1013
1090
|
customExecutionInstructions: 'Process incoming data',
|
|
1014
1091
|
availableLibraries: 'pandas,numpy',
|
|
1015
|
-
|
|
1092
|
+
allowExternalApi: true,
|
|
1016
1093
|
hardcodedScript: false
|
|
1017
1094
|
});
|
|
1018
1095
|
```
|
|
@@ -1020,8 +1097,7 @@ const hook = await client.hooks.create({
|
|
|
1020
1097
|
#### Update Hook
|
|
1021
1098
|
|
|
1022
1099
|
```typescript
|
|
1023
|
-
const hook = await client.hooks.update({
|
|
1024
|
-
id: 'hook-1',
|
|
1100
|
+
const hook = await client.hooks.update('hook-id', {
|
|
1025
1101
|
name: 'Updated Hook',
|
|
1026
1102
|
customExecutionCode: 'def process_data(data): return data.lower()'
|
|
1027
1103
|
});
|
|
@@ -1030,13 +1106,13 @@ const hook = await client.hooks.update({
|
|
|
1030
1106
|
#### Delete Hook
|
|
1031
1107
|
|
|
1032
1108
|
```typescript
|
|
1033
|
-
await client.hooks.delete('hook-
|
|
1109
|
+
await client.hooks.delete('hook-id');
|
|
1034
1110
|
```
|
|
1035
1111
|
|
|
1036
1112
|
#### Get Hook
|
|
1037
1113
|
|
|
1038
1114
|
```typescript
|
|
1039
|
-
const hook = await client.hooks.get('hook-
|
|
1115
|
+
const hook = await client.hooks.get('hook-id');
|
|
1040
1116
|
console.log(`Name: ${hook.name}`);
|
|
1041
1117
|
console.log(`Function: ${hook.functionName}`);
|
|
1042
1118
|
```
|
|
@@ -1044,7 +1120,7 @@ console.log(`Function: ${hook.functionName}`);
|
|
|
1044
1120
|
#### List Hooks
|
|
1045
1121
|
|
|
1046
1122
|
```typescript
|
|
1047
|
-
const hooks = await client.hooks.list(20);
|
|
1123
|
+
const hooks = await client.hooks.list(20, 0);
|
|
1048
1124
|
for (const hook of hooks.items) {
|
|
1049
1125
|
console.log(`${hook.name}`);
|
|
1050
1126
|
}
|
|
@@ -1055,12 +1131,10 @@ for (const hook of hooks.items) {
|
|
|
1055
1131
|
#### Create a Scheduled Job
|
|
1056
1132
|
|
|
1057
1133
|
```typescript
|
|
1058
|
-
const job = await client.scheduledJobs.create({
|
|
1059
|
-
id: 'job-1',
|
|
1060
|
-
name: 'Daily Report',
|
|
1134
|
+
const job = await client.scheduledJobs.create('Daily Report', {
|
|
1061
1135
|
description: 'Generate daily report at 9 AM',
|
|
1062
|
-
|
|
1063
|
-
|
|
1136
|
+
agentId: 'agent-id',
|
|
1137
|
+
customPromptId: 'prompt-id',
|
|
1064
1138
|
forcedPrompt: 'Generate a daily summary report',
|
|
1065
1139
|
schedule: {
|
|
1066
1140
|
frequency: 'DAILY',
|
|
@@ -1076,8 +1150,7 @@ const job = await client.scheduledJobs.create({
|
|
|
1076
1150
|
#### Update Scheduled Job
|
|
1077
1151
|
|
|
1078
1152
|
```typescript
|
|
1079
|
-
const job = await client.scheduledJobs.update({
|
|
1080
|
-
id: 'job-1',
|
|
1153
|
+
const job = await client.scheduledJobs.update('job-id', {
|
|
1081
1154
|
name: 'Updated Job',
|
|
1082
1155
|
isActive: false,
|
|
1083
1156
|
schedule: {
|
|
@@ -1091,13 +1164,13 @@ const job = await client.scheduledJobs.update({
|
|
|
1091
1164
|
#### Delete Scheduled Job
|
|
1092
1165
|
|
|
1093
1166
|
```typescript
|
|
1094
|
-
await client.scheduledJobs.delete('job-
|
|
1167
|
+
await client.scheduledJobs.delete('job-id');
|
|
1095
1168
|
```
|
|
1096
1169
|
|
|
1097
1170
|
#### Get Scheduled Job
|
|
1098
1171
|
|
|
1099
1172
|
```typescript
|
|
1100
|
-
const job = await client.scheduledJobs.get('job-
|
|
1173
|
+
const job = await client.scheduledJobs.get('job-id');
|
|
1101
1174
|
console.log(`Name: ${job.name}`);
|
|
1102
1175
|
console.log(`Status: ${job.status}`);
|
|
1103
1176
|
console.log(`Schedule: ${JSON.stringify(job.schedule)}`);
|
|
@@ -1106,7 +1179,7 @@ console.log(`Schedule: ${JSON.stringify(job.schedule)}`);
|
|
|
1106
1179
|
#### List Scheduled Jobs
|
|
1107
1180
|
|
|
1108
1181
|
```typescript
|
|
1109
|
-
const jobs = await client.scheduledJobs.list(20);
|
|
1182
|
+
const jobs = await client.scheduledJobs.list(20, 0);
|
|
1110
1183
|
for (const job of jobs.items) {
|
|
1111
1184
|
console.log(`${job.name} (${job.status})`);
|
|
1112
1185
|
}
|
|
@@ -1114,20 +1187,41 @@ for (const job of jobs.items) {
|
|
|
1114
1187
|
|
|
1115
1188
|
### Secrets
|
|
1116
1189
|
|
|
1190
|
+
Secrets are linked to authorisations. You must first create an authorisation, then create a secret for it.
|
|
1191
|
+
|
|
1117
1192
|
#### Create a Secret
|
|
1118
1193
|
|
|
1119
1194
|
```typescript
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
description: 'External API key for service X'
|
|
1195
|
+
// First, create an authorisation
|
|
1196
|
+
const auth = await client.authorisations.create('External Service Auth', 'apikey', {
|
|
1197
|
+
description: 'Authorisation for external service'
|
|
1124
1198
|
});
|
|
1199
|
+
|
|
1200
|
+
// Then create a secret linked to that authorisation
|
|
1201
|
+
const secret = await client.secrets.create(auth.id, 'your-secret-api-key-12345');
|
|
1202
|
+
console.log(`Secret created: ${secret.name}`);
|
|
1203
|
+
```
|
|
1204
|
+
|
|
1205
|
+
#### Get a Secret
|
|
1206
|
+
|
|
1207
|
+
```typescript
|
|
1208
|
+
const secret = await client.secrets.get('secret-id');
|
|
1209
|
+
console.log(`Secret: ${secret.name}`);
|
|
1210
|
+
```
|
|
1211
|
+
|
|
1212
|
+
#### List Secrets
|
|
1213
|
+
|
|
1214
|
+
```typescript
|
|
1215
|
+
const secrets = await client.secrets.list(20, 0);
|
|
1216
|
+
for (const secret of secrets.items) {
|
|
1217
|
+
console.log(`${secret.name}`);
|
|
1218
|
+
}
|
|
1125
1219
|
```
|
|
1126
1220
|
|
|
1127
1221
|
#### Delete Secret
|
|
1128
1222
|
|
|
1129
1223
|
```typescript
|
|
1130
|
-
await client.secrets.delete('secret-
|
|
1224
|
+
await client.secrets.delete('secret-id');
|
|
1131
1225
|
```
|
|
1132
1226
|
|
|
1133
1227
|
### Dictionary
|
|
@@ -1169,13 +1263,12 @@ for (const emb of embeddings) {
|
|
|
1169
1263
|
|
|
1170
1264
|
```typescript
|
|
1171
1265
|
// Get charting settings
|
|
1172
|
-
const settings = await client.chartingSettings.get(
|
|
1266
|
+
const settings = await client.chartingSettings.get();
|
|
1173
1267
|
console.log(`Primary Color: ${settings.primaryColor}`);
|
|
1174
1268
|
console.log(`Secondary Color: ${settings.secondaryColor}`);
|
|
1175
1269
|
|
|
1176
1270
|
// Update charting settings
|
|
1177
1271
|
const updated = await client.chartingSettings.update({
|
|
1178
|
-
id: 'settings-id',
|
|
1179
1272
|
primaryColor: '#FF5733',
|
|
1180
1273
|
secondaryColor: '#33FF57',
|
|
1181
1274
|
lineColor: '#3357FF'
|
|
@@ -1186,13 +1279,12 @@ const updated = await client.chartingSettings.update({
|
|
|
1186
1279
|
|
|
1187
1280
|
```typescript
|
|
1188
1281
|
// Get embeddings settings
|
|
1189
|
-
const settings = await client.embeddingsSettings.get(
|
|
1282
|
+
const settings = await client.embeddingsSettings.get();
|
|
1190
1283
|
console.log(`Max Chunk Words: ${settings.maxChunkWords}`);
|
|
1191
1284
|
console.log(`Chunking Strategy: ${settings.chunkingStrategy}`);
|
|
1192
1285
|
|
|
1193
1286
|
// Update embeddings settings
|
|
1194
1287
|
const updated = await client.embeddingsSettings.update({
|
|
1195
|
-
id: 'settings-id',
|
|
1196
1288
|
maxChunkWords: 1000,
|
|
1197
1289
|
chunkingStrategy: 'summary',
|
|
1198
1290
|
imageExtractionStrategy: 'safe'
|
|
@@ -1204,10 +1296,14 @@ const updated = await client.embeddingsSettings.update({
|
|
|
1204
1296
|
#### Get Monthly Costs
|
|
1205
1297
|
|
|
1206
1298
|
```typescript
|
|
1207
|
-
|
|
1299
|
+
// Using get() method (like Python SDK)
|
|
1300
|
+
const costs = await client.billing.get();
|
|
1208
1301
|
console.log(`API Usage: ${JSON.stringify(costs.apiUsage)}`);
|
|
1209
1302
|
console.log(`Training Usage: ${JSON.stringify(costs.trainingUsage)}`);
|
|
1210
1303
|
console.log(`Total Cost: $${costs.apiUsage?.totalCostUSD || 0}`);
|
|
1304
|
+
|
|
1305
|
+
// Or using getMonthCosts() alias
|
|
1306
|
+
const costs2 = await client.billing.getMonthCosts();
|
|
1211
1307
|
```
|
|
1212
1308
|
|
|
1213
1309
|
### Streams
|