vectocore4 0.0.2 → 0.0.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/dist/cjs/index.js CHANGED
@@ -35,7 +35,7 @@ class Vectocore {
35
35
  requestPost(requestBody) {
36
36
  return __awaiter(this, void 0, void 0, function* () {
37
37
  let config = {
38
- headers: { "Content-Type": "application/json", "x-api-key": this.tenantKey },
38
+ headers: { "Content-Type": "application/json", "x-tenant-key": this.tenantKey },
39
39
  };
40
40
  const response = yield axios_1.default.post(this.baseURL, requestBody, config);
41
41
  return response.data;
@@ -45,8 +45,10 @@ class Vectocore {
45
45
  return __awaiter(this, arguments, void 0, function* ({ indexName, description }) {
46
46
  const requestParam = {
47
47
  command: "put_index",
48
- index_name: indexName,
49
- description: description !== null && description !== void 0 ? description : "",
48
+ params: {
49
+ index_name: indexName,
50
+ description: description !== null && description !== void 0 ? description : "",
51
+ },
50
52
  };
51
53
  const response = yield this.requestPost(requestParam);
52
54
  return response;
@@ -56,7 +58,9 @@ class Vectocore {
56
58
  return __awaiter(this, arguments, void 0, function* ({ indexName }) {
57
59
  const requestParam = {
58
60
  command: "delete_index",
59
- index_name: indexName,
61
+ params: {
62
+ index_name: indexName,
63
+ },
60
64
  };
61
65
  const response = yield this.requestPost(requestParam);
62
66
  return response;
@@ -73,22 +77,25 @@ class Vectocore {
73
77
  }
74
78
  putExtreamData(_a) {
75
79
  return __awaiter(this, arguments, void 0, function* ({ indexName, docBody }) {
80
+ var _b, _c;
76
81
  const requestParam = {
77
82
  command: "put_extream_data",
78
- index_name: indexName,
79
- doc_body: {
80
- id: docBody.id,
81
- keywords: docBody.keywords,
82
- data: docBody.data,
83
- doc_type: docBody.docType,
84
- ref_only_text: docBody.refOnlyText,
83
+ params: {
84
+ index_name: indexName,
85
+ doc_body: {
86
+ id: docBody.id,
87
+ keywords: docBody.keywords,
88
+ data: docBody.data,
89
+ doc_type: (_b = docBody.docType) !== null && _b !== void 0 ? _b : "text",
90
+ ref_only_text: (_c = docBody.refOnlyText) !== null && _c !== void 0 ? _c : false,
91
+ },
85
92
  },
86
93
  };
87
- if (docBody.imageUrl) {
88
- requestParam.doc_body.image_url = docBody.imageUrl;
89
- }
90
94
  if (docBody.metadata) {
91
- requestParam.doc_body.metadata = docBody.metadata;
95
+ requestParam.params.doc_body.metadata = docBody.metadata;
96
+ }
97
+ if (docBody.imageUrl) {
98
+ requestParam.params.doc_body.image_url = docBody.imageUrl;
92
99
  }
93
100
  const response = yield this.requestPost(requestParam);
94
101
  return response;
@@ -98,8 +105,10 @@ class Vectocore {
98
105
  return __awaiter(this, arguments, void 0, function* ({ indexName, documentId }) {
99
106
  const requestParam = {
100
107
  command: "get_extream_data",
101
- index_name: indexName,
102
- document_id: documentId,
108
+ params: {
109
+ index_name: indexName,
110
+ document_id: documentId,
111
+ },
103
112
  };
104
113
  const response = yield this.requestPost(requestParam);
105
114
  return response;
@@ -109,15 +118,29 @@ class Vectocore {
109
118
  return __awaiter(this, arguments, void 0, function* ({ indexName, lastKey }) {
110
119
  const requestParam = {
111
120
  command: "list_extream_data",
112
- index_name: indexName,
121
+ params: {
122
+ index_name: indexName,
123
+ },
113
124
  };
114
- if (lastKey !== undefined && lastKey !== null) {
115
- requestParam.last_key = lastKey;
125
+ if (lastKey) {
126
+ requestParam.params.last_key = lastKey;
116
127
  }
117
128
  const response = yield this.requestPost(requestParam);
118
129
  return response;
119
130
  });
120
131
  }
132
+ listAllExtreamData(_a) {
133
+ return __awaiter(this, arguments, void 0, function* ({ indexName }) {
134
+ const requestParam = {
135
+ command: "list_all_extream_data",
136
+ params: {
137
+ index_name: indexName,
138
+ },
139
+ };
140
+ const response = yield this.requestPost(requestParam);
141
+ return response;
142
+ });
143
+ }
121
144
  deleteExtreamData(_a) {
122
145
  return __awaiter(this, arguments, void 0, function* ({ indexName, documentId }) {
123
146
  const requestParam = {
@@ -201,7 +224,7 @@ class Lens {
201
224
  requestStream(requestBody) {
202
225
  return __awaiter(this, void 0, void 0, function* () {
203
226
  let header = {
204
- "x-api-key": this.tenantKey ? this.tenantKey : "",
227
+ "x-tenant-key": this.tenantKey ? this.tenantKey : "",
205
228
  };
206
229
  const request = {
207
230
  method: "POST",
@@ -363,7 +386,7 @@ class AIMS {
363
386
  requestStream(requestBody) {
364
387
  return __awaiter(this, void 0, void 0, function* () {
365
388
  let header = {
366
- "x-api-key": this.tenantKey ? this.tenantKey : "",
389
+ "x-tenant-key": this.tenantKey ? this.tenantKey : "",
367
390
  };
368
391
  const request = {
369
392
  method: "POST",
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ export interface CustomDataParams {
17
17
  }
18
18
  export interface LensClientOptions {
19
19
  tenantKey?: string;
20
- baseURL?: string | null | undefined;
20
+ baseURL?: string;
21
21
  role?: string;
22
22
  rule?: string;
23
23
  outputFormat?: any;
@@ -43,30 +43,57 @@ export interface PutIndexParams {
43
43
  description?: string;
44
44
  }
45
45
  export interface DeleteIndexParams {
46
+ /**
47
+ * 삭제할 인덱스의 이름입니다.
48
+ * 인덱스를 삭제하면 인덱스내 모든 문서도 함께 삭제됩니다.
49
+ */
46
50
  indexName: string;
47
51
  }
48
52
  export interface PutExtreamDataParams {
53
+ /**
54
+ * 지식을 추가할 인덱스의 이름입니다.
55
+ */
49
56
  indexName: string;
57
+ /**
58
+ * 추가할 문서의 실제 본문 데이터입니다.
59
+ */
50
60
  docBody: {
61
+ /** 문서의 고유 식별자(ID) ""로 전송하면 자동으로 채번합니다.*/
51
62
  id: string;
63
+ /** 검색 최적화를 위한 키워드 목록 (쉼표로 구분하거나 공백으로 구분하세요.) */
52
64
  keywords: string;
65
+ /** 실제 지식 본문 텍스트 데이터 */
53
66
  data: string;
54
- docType: string;
55
- imageUrl?: string | undefined;
67
+ /** 저장하는 지식의 타입 */
68
+ docType: "text" | "image";
69
+ /** docType이 "image"인 경우 함께 업로드할 이미지의 URL입니다. */
70
+ imageUrl?: string;
71
+ /** 문서 저장시 추가로 남기고 싶은 정보를 json 형식으로 추가하면 향후 검색 결과시 리턴. 문서명이나, 페이지 번호 등을 입력하여 출처 확인용으로 사용할 수 있습니다. */
56
72
  metadata?: any;
73
+ /** lens 기능 사용시 사용하는 옵션으로 doc_type이 "image"인 경우 "image_url"의 경로를 자동으로 멀티모달로 전달하는데 ref_only_text : true로 설정한 경우 멀티모달을 전달하지 않고 "data" 필드의 정보만 context로 활용합니다. */
57
74
  refOnlyText?: boolean;
58
75
  };
59
76
  }
60
77
  export interface ListExtreamDataParams {
78
+ /** 데이터 목록을 조회할 인덱스의 이름입니다. */
79
+ indexName: string;
80
+ /** 페이징된 결과를 받았을때 해당 key부터 다음 페이징까지 결과를 조회하는 기준 키 입니다. */
81
+ lastKey?: string | null;
82
+ }
83
+ export interface ListAllExtreamDataParams {
84
+ /** 데이터 목록을 조회할 인덱스의 이름입니다. */
61
85
  indexName: string;
62
- lastKey?: any | null;
63
86
  }
64
87
  export interface GetExtreamDataParams {
88
+ /** 조회할 문서가 저장되어 있는 인덱스의 이름입니다. */
65
89
  indexName: string;
90
+ /** 조회할 문서의 ID입니다. */
66
91
  documentId: string;
67
92
  }
68
93
  export interface DeleteExtreamDataParams {
94
+ /** 삭제할 문서가 저장되어 있는 인덱스의 이름입니다. */
69
95
  indexName: string;
96
+ /** 삭제할 문서의 ID입니다. */
70
97
  documentId: string;
71
98
  }
72
99
  export interface ExtreamSearchParams {
@@ -137,6 +164,7 @@ export declare class Vectocore {
137
164
  putExtreamData({ indexName, docBody }: PutExtreamDataParams): Promise<any>;
138
165
  getExtreamData({ indexName, documentId }: GetExtreamDataParams): Promise<any>;
139
166
  listExtreamData({ indexName, lastKey }: ListExtreamDataParams): Promise<any>;
167
+ listAllExtreamData({ indexName }: ListAllExtreamDataParams): Promise<any>;
140
168
  deleteExtreamData({ indexName, documentId }: DeleteExtreamDataParams): Promise<any>;
141
169
  extreamSearch({ indexName, question, maxCount, mode, webSearch, findIndexPrompt, docOnly, }: ExtreamSearchParams): Promise<any>;
142
170
  webSearch({ question }: WebSearchParams): Promise<any>;
package/dist/mjs/index.js CHANGED
@@ -21,7 +21,7 @@ export class Vectocore {
21
21
  }
22
22
  async requestPost(requestBody) {
23
23
  let config = {
24
- headers: { "Content-Type": "application/json", "x-api-key": this.tenantKey },
24
+ headers: { "Content-Type": "application/json", "x-tenant-key": this.tenantKey },
25
25
  };
26
26
  const response = await axios.post(this.baseURL, requestBody, config);
27
27
  return response.data;
@@ -29,8 +29,10 @@ export class Vectocore {
29
29
  async putIndex({ indexName, description }) {
30
30
  const requestParam = {
31
31
  command: "put_index",
32
- index_name: indexName,
33
- description: description ?? "",
32
+ params: {
33
+ index_name: indexName,
34
+ description: description ?? "",
35
+ },
34
36
  };
35
37
  const response = await this.requestPost(requestParam);
36
38
  return response;
@@ -38,7 +40,9 @@ export class Vectocore {
38
40
  async deleteIndex({ indexName }) {
39
41
  const requestParam = {
40
42
  command: "delete_index",
41
- index_name: indexName,
43
+ params: {
44
+ index_name: indexName,
45
+ },
42
46
  };
43
47
  const response = await this.requestPost(requestParam);
44
48
  return response;
@@ -53,20 +57,22 @@ export class Vectocore {
53
57
  async putExtreamData({ indexName, docBody }) {
54
58
  const requestParam = {
55
59
  command: "put_extream_data",
56
- index_name: indexName,
57
- doc_body: {
58
- id: docBody.id,
59
- keywords: docBody.keywords,
60
- data: docBody.data,
61
- doc_type: docBody.docType,
62
- ref_only_text: docBody.refOnlyText,
60
+ params: {
61
+ index_name: indexName,
62
+ doc_body: {
63
+ id: docBody.id,
64
+ keywords: docBody.keywords,
65
+ data: docBody.data,
66
+ doc_type: docBody.docType ?? "text",
67
+ ref_only_text: docBody.refOnlyText ?? false,
68
+ },
63
69
  },
64
70
  };
65
- if (docBody.imageUrl) {
66
- requestParam.doc_body.image_url = docBody.imageUrl;
67
- }
68
71
  if (docBody.metadata) {
69
- requestParam.doc_body.metadata = docBody.metadata;
72
+ requestParam.params.doc_body.metadata = docBody.metadata;
73
+ }
74
+ if (docBody.imageUrl) {
75
+ requestParam.params.doc_body.image_url = docBody.imageUrl;
70
76
  }
71
77
  const response = await this.requestPost(requestParam);
72
78
  return response;
@@ -74,8 +80,10 @@ export class Vectocore {
74
80
  async getExtreamData({ indexName, documentId }) {
75
81
  const requestParam = {
76
82
  command: "get_extream_data",
77
- index_name: indexName,
78
- document_id: documentId,
83
+ params: {
84
+ index_name: indexName,
85
+ document_id: documentId,
86
+ },
79
87
  };
80
88
  const response = await this.requestPost(requestParam);
81
89
  return response;
@@ -83,14 +91,26 @@ export class Vectocore {
83
91
  async listExtreamData({ indexName, lastKey }) {
84
92
  const requestParam = {
85
93
  command: "list_extream_data",
86
- index_name: indexName,
94
+ params: {
95
+ index_name: indexName,
96
+ },
87
97
  };
88
- if (lastKey !== undefined && lastKey !== null) {
89
- requestParam.last_key = lastKey;
98
+ if (lastKey) {
99
+ requestParam.params.last_key = lastKey;
90
100
  }
91
101
  const response = await this.requestPost(requestParam);
92
102
  return response;
93
103
  }
104
+ async listAllExtreamData({ indexName }) {
105
+ const requestParam = {
106
+ command: "list_all_extream_data",
107
+ params: {
108
+ index_name: indexName,
109
+ },
110
+ };
111
+ const response = await this.requestPost(requestParam);
112
+ return response;
113
+ }
94
114
  async deleteExtreamData({ indexName, documentId }) {
95
115
  const requestParam = {
96
116
  command: "delete_extream_data",
@@ -178,7 +198,7 @@ export class Lens {
178
198
  }
179
199
  async requestStream(requestBody) {
180
200
  let header = {
181
- "x-api-key": this.tenantKey ? this.tenantKey : "",
201
+ "x-tenant-key": this.tenantKey ? this.tenantKey : "",
182
202
  };
183
203
  const request = {
184
204
  method: "POST",
@@ -333,7 +353,7 @@ export class AIMS {
333
353
  }
334
354
  async requestStream(requestBody) {
335
355
  let header = {
336
- "x-api-key": this.tenantKey ? this.tenantKey : "",
356
+ "x-tenant-key": this.tenantKey ? this.tenantKey : "",
337
357
  };
338
358
  const request = {
339
359
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vectocore4",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/cjs/index.js",