@@ -9,12 +9,15 @@ test("Create Client", async () => {
9
9
} ) ;
10
10
11
11
test ( "Create Namespace" , async ( ) => {
12
- const client = await IndexifyClient . createNamespace ( "testnamespace" , [
13
- {
14
- extractor : "tensorlake/minilm-l6" ,
15
- name : "testpolicy" ,
16
- } ,
17
- ] ) ;
12
+ const client = await IndexifyClient . createNamespace ( {
13
+ namespace : "testnamespace" ,
14
+ extraction_policies : [
15
+ {
16
+ extractor : "tensorlake/minilm-l6" ,
17
+ name : "testpolicy" ,
18
+ } ,
19
+ ] ,
20
+ } ) ;
18
21
19
22
expect ( client . namespace ) . toBe ( "testnamespace" ) ;
20
23
// test get namespaces
@@ -31,11 +34,9 @@ test("Get Extractors", async () => {
31
34
} ) ;
32
35
33
36
test ( "Add Documents" , async ( ) => {
34
- const client = await IndexifyClient . createNamespace (
35
- "test.adddocuments" ,
36
- [ ] ,
37
- { }
38
- ) ;
37
+ const client = await IndexifyClient . createNamespace ( {
38
+ namespace : "test.adddocuments" ,
39
+ } ) ;
39
40
40
41
// add single documents
41
42
await client . addDocuments ( { text : "This is a test" , labels : { } } ) ;
@@ -74,7 +75,10 @@ test("Search", async () => {
74
75
labels_eq : "source:test" ,
75
76
} ;
76
77
77
- const client = await IndexifyClient . createNamespace ( "testsearch" ) ;
78
+ const client = await IndexifyClient . createNamespace ( {
79
+ namespace : "testsearch" ,
80
+ } ) ;
81
+ console . log ( 'got namespace?' , client . namespace )
78
82
const resp = await client . addExtractionPolicy ( policy ) ;
79
83
expect ( resp . index_names . length ) . toBe ( 1 ) ;
80
84
@@ -85,7 +89,7 @@ test("Search", async () => {
85
89
{ text : "This is a test2" , labels : { source : "test" } } ,
86
90
] ) ;
87
91
88
- await new Promise ( ( r ) => setTimeout ( r , 10000 ) ) ;
92
+ await new Promise ( ( r ) => setTimeout ( r , 15000 ) ) ;
89
93
90
94
const searchResult = await client . searchIndex ( indexName , "test" , 3 ) ;
91
95
expect ( searchResult . length ) . toBe ( 2 ) ;
@@ -99,14 +103,18 @@ test("Upload file", async () => {
99
103
input_params : { } ,
100
104
} ;
101
105
102
- const client = await IndexifyClient . createNamespace ( "testuploadfile" ) ;
106
+ const client = await IndexifyClient . createNamespace ( {
107
+ namespace : "testuploadfile" ,
108
+ } ) ;
103
109
client . addExtractionPolicy ( policy ) ;
104
110
await client . uploadFile ( `${ __dirname } /files/test.txt` ) ;
105
111
console . log ( "done" ) ;
106
112
} ) ;
107
113
108
114
test ( "Get content" , async ( ) => {
109
- const client = await IndexifyClient . createNamespace ( "testgetcontent" ) ;
115
+ const client = await IndexifyClient . createNamespace ( {
116
+ namespace : "testgetcontent" ,
117
+ } ) ;
110
118
await client . addDocuments ( [
111
119
{ text : "This is a test1" , labels : { source : "test" } } ,
112
120
{ text : "This is a test2" , labels : { source : "test" } } ,
@@ -126,7 +134,9 @@ test("Get content", async () => {
126
134
} ) ;
127
135
128
136
test ( "Download content" , async ( ) => {
129
- const client = await IndexifyClient . createNamespace ( "testgetcontent" ) ;
137
+ const client = await IndexifyClient . createNamespace ( {
138
+ namespace : "testgetcontent" ,
139
+ } ) ;
130
140
await client . addDocuments ( [
131
141
{ text : "This is a download" , labels : { source : "testdownload" } } ,
132
142
] ) ;
@@ -139,7 +149,9 @@ test("Download content", async () => {
139
149
} ) ;
140
150
141
151
test ( "Get Extraction Policies" , async ( ) => {
142
- const client = await IndexifyClient . createNamespace ( "testgetpolicies" ) ;
152
+ const client = await IndexifyClient . createNamespace ( {
153
+ namespace : "testgetpolicies" ,
154
+ } ) ;
143
155
144
156
await client . addExtractionPolicy ( {
145
157
extractor : "tensorlake/minilm-l6" ,
0 commit comments