vectocore4 0.0.3 → 0.0.5

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.

Potentially problematic release.


This version of vectocore4 might be problematic. Click here for more details.

package/dist/cjs/index.js CHANGED
@@ -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,50 +118,54 @@ 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 = {
124
147
  command: "delete_extream_data",
125
- index_name: indexName,
126
- document_id: documentId,
148
+ params: {
149
+ index_name: indexName,
150
+ document_id: documentId,
151
+ },
127
152
  };
128
153
  const response = yield this.requestPost(requestParam);
129
154
  return response;
130
155
  });
131
156
  }
132
157
  extreamSearch(_a) {
133
- return __awaiter(this, arguments, void 0, function* ({ indexName, question, maxCount, mode, webSearch, findIndexPrompt, docOnly, }) {
134
- var _b, _c, _d;
158
+ return __awaiter(this, arguments, void 0, function* ({ mode, indexNames, question, top, rerank }) {
135
159
  const requestParam = {
136
160
  command: "extream_search",
137
- question: question,
138
- };
139
- if (indexName)
140
- requestParam.index_name = indexName;
141
- if (mode)
142
- requestParam.mode = mode;
143
- if (maxCount)
144
- requestParam.max_count = maxCount;
145
- if (findIndexPrompt)
146
- requestParam.find_index_prompt = findIndexPrompt;
147
- if (docOnly)
148
- requestParam.doc_only = docOnly;
149
- let __webSearch = {
150
- model: (_b = webSearch === null || webSearch === void 0 ? void 0 : webSearch.model) !== null && _b !== void 0 ? _b : "bing",
151
- with_image: (_c = webSearch === null || webSearch === void 0 ? void 0 : webSearch.withImage) !== null && _c !== void 0 ? _c : false,
152
- with_video: (_d = webSearch === null || webSearch === void 0 ? void 0 : webSearch.withVideo) !== null && _d !== void 0 ? _d : false,
161
+ params: {
162
+ mode: mode !== null && mode !== void 0 ? mode : "vector",
163
+ index_names: indexNames !== null && indexNames !== void 0 ? indexNames : [],
164
+ question: question,
165
+ top: top !== null && top !== void 0 ? top : 10,
166
+ rerank: rerank !== null && rerank !== void 0 ? rerank : false,
167
+ },
153
168
  };
154
- if (webSearch)
155
- requestParam.web_search = __webSearch;
156
169
  const response = yield this.requestPost(requestParam);
157
170
  return response;
158
171
  });
@@ -161,7 +174,9 @@ class Vectocore {
161
174
  return __awaiter(this, arguments, void 0, function* ({ question }) {
162
175
  const requestParam = {
163
176
  command: "web_search",
164
- question: question,
177
+ params: {
178
+ question: question,
179
+ },
165
180
  };
166
181
  const response = yield this.requestPost(requestParam);
167
182
  return response;
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,46 +43,78 @@ 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 {
73
- indexName?: string | string[] | undefined;
100
+ /** 사용자의 질문을 검색하고자하는 인덱스 목록, 생략하거나 [] 전송시 전체 인덱스에서 검색 실행합니다. */
101
+ indexNames?: string[];
102
+ /** 사용자 질문 (시멘틱 검색을 사용하기때문에 서술형을 질문해도 의미를 파악하여 유사한 결과를 유사도 순위별로 리턴.) */
74
103
  question: string;
75
- maxCount?: number | undefined;
76
- mode?: "VECTOR" | "BOTH" | "WEB" | undefined;
77
- webSearch?: {
78
- model?: "google" | "bing";
79
- withImage?: boolean;
80
- withVideo?: boolean;
81
- };
82
- findIndexPrompt?: string | undefined;
83
- docOnly?: boolean;
104
+ /**
105
+ * vector 모드 : 시멘틱 유사도만 사용
106
+ * • keyword 모드 : 키워드 유사도만 사용, 키워드 모드인 경우 해당 "단어"가 문서에 없으면 빈 list를 리턴
107
+ * hybrid 모드 : 시멘틱 검색 순위와 키워드 검색 순위를 모두 사용하여 순위 결정
108
+ * @default "vector"
109
+ */
110
+ mode?: "vector" | "keyword" | "hybrid";
111
+ /** 결과로 보고싶은 목록의 최대 건수, 생략시 10건을 조회. */
112
+ top?: number;
113
+ /** 검색 mode가 hybrid일 경우 벡터 검색과 키워드 검색 결과를 ai가 다시 score를 산정하는 방식으로 별도의 토큰이 소모 됨. */
114
+ rerank?: boolean;
84
115
  }
85
116
  export interface WebSearchParams {
117
+ /** 검색어 */
86
118
  question: string;
87
119
  }
88
120
  export type FileType = {
@@ -137,8 +169,9 @@ export declare class Vectocore {
137
169
  putExtreamData({ indexName, docBody }: PutExtreamDataParams): Promise<any>;
138
170
  getExtreamData({ indexName, documentId }: GetExtreamDataParams): Promise<any>;
139
171
  listExtreamData({ indexName, lastKey }: ListExtreamDataParams): Promise<any>;
172
+ listAllExtreamData({ indexName }: ListAllExtreamDataParams): Promise<any>;
140
173
  deleteExtreamData({ indexName, documentId }: DeleteExtreamDataParams): Promise<any>;
141
- extreamSearch({ indexName, question, maxCount, mode, webSearch, findIndexPrompt, docOnly, }: ExtreamSearchParams): Promise<any>;
174
+ extreamSearch({ mode, indexNames, question, top, rerank }: ExtreamSearchParams): Promise<any>;
142
175
  webSearch({ question }: WebSearchParams): Promise<any>;
143
176
  }
144
177
  export declare class Lens {
package/dist/mjs/index.js CHANGED
@@ -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,52 +91,57 @@ 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",
97
- index_name: indexName,
98
- document_id: documentId,
117
+ params: {
118
+ index_name: indexName,
119
+ document_id: documentId,
120
+ },
99
121
  };
100
122
  const response = await this.requestPost(requestParam);
101
123
  return response;
102
124
  }
103
- async extreamSearch({ indexName, question, maxCount, mode, webSearch, findIndexPrompt, docOnly, }) {
125
+ async extreamSearch({ mode, indexNames, question, top, rerank }) {
104
126
  const requestParam = {
105
127
  command: "extream_search",
106
- question: question,
107
- };
108
- if (indexName)
109
- requestParam.index_name = indexName;
110
- if (mode)
111
- requestParam.mode = mode;
112
- if (maxCount)
113
- requestParam.max_count = maxCount;
114
- if (findIndexPrompt)
115
- requestParam.find_index_prompt = findIndexPrompt;
116
- if (docOnly)
117
- requestParam.doc_only = docOnly;
118
- let __webSearch = {
119
- model: webSearch?.model ?? "bing",
120
- with_image: webSearch?.withImage ?? false,
121
- with_video: webSearch?.withVideo ?? false,
128
+ params: {
129
+ mode: mode ?? "vector",
130
+ index_names: indexNames ?? [],
131
+ question: question,
132
+ top: top ?? 10,
133
+ rerank: rerank ?? false,
134
+ },
122
135
  };
123
- if (webSearch)
124
- requestParam.web_search = __webSearch;
125
136
  const response = await this.requestPost(requestParam);
126
137
  return response;
127
138
  }
128
139
  async webSearch({ question }) {
129
140
  const requestParam = {
130
141
  command: "web_search",
131
- question: question,
142
+ params: {
143
+ question: question,
144
+ },
132
145
  };
133
146
  const response = await this.requestPost(requestParam);
134
147
  return response;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vectocore4",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/cjs/index.js",