vectocore4 0.0.4 → 0.0.6

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
@@ -75,11 +75,11 @@ class Vectocore {
75
75
  return response;
76
76
  });
77
77
  }
78
- putExtreamData(_a) {
78
+ putExtremeData(_a) {
79
79
  return __awaiter(this, arguments, void 0, function* ({ indexName, docBody }) {
80
80
  var _b, _c;
81
81
  const requestParam = {
82
- command: "put_extream_data",
82
+ command: "put_extreme_data",
83
83
  params: {
84
84
  index_name: indexName,
85
85
  doc_body: {
@@ -101,10 +101,10 @@ class Vectocore {
101
101
  return response;
102
102
  });
103
103
  }
104
- getExtreamData(_a) {
104
+ getExtremeData(_a) {
105
105
  return __awaiter(this, arguments, void 0, function* ({ indexName, documentId }) {
106
106
  const requestParam = {
107
- command: "get_extream_data",
107
+ command: "get_extreme_data",
108
108
  params: {
109
109
  index_name: indexName,
110
110
  document_id: documentId,
@@ -114,10 +114,10 @@ class Vectocore {
114
114
  return response;
115
115
  });
116
116
  }
117
- listExtreamData(_a) {
117
+ listExtremeData(_a) {
118
118
  return __awaiter(this, arguments, void 0, function* ({ indexName, lastKey }) {
119
119
  const requestParam = {
120
- command: "list_extream_data",
120
+ command: "list_extreme_data",
121
121
  params: {
122
122
  index_name: indexName,
123
123
  },
@@ -129,10 +129,10 @@ class Vectocore {
129
129
  return response;
130
130
  });
131
131
  }
132
- listAllExtreamData(_a) {
132
+ listAllExtremeData(_a) {
133
133
  return __awaiter(this, arguments, void 0, function* ({ indexName }) {
134
134
  const requestParam = {
135
- command: "list_all_extream_data",
135
+ command: "list_all_extreme_data",
136
136
  params: {
137
137
  index_name: indexName,
138
138
  },
@@ -141,41 +141,31 @@ class Vectocore {
141
141
  return response;
142
142
  });
143
143
  }
144
- deleteExtreamData(_a) {
144
+ deleteExtremeData(_a) {
145
145
  return __awaiter(this, arguments, void 0, function* ({ indexName, documentId }) {
146
146
  const requestParam = {
147
- command: "delete_extream_data",
148
- index_name: indexName,
149
- document_id: documentId,
147
+ command: "delete_extreme_data",
148
+ params: {
149
+ index_name: indexName,
150
+ document_id: documentId,
151
+ },
150
152
  };
151
153
  const response = yield this.requestPost(requestParam);
152
154
  return response;
153
155
  });
154
156
  }
155
- extreamSearch(_a) {
156
- return __awaiter(this, arguments, void 0, function* ({ indexName, question, maxCount, mode, webSearch, findIndexPrompt, docOnly, }) {
157
- var _b, _c, _d;
157
+ extremeSearch(_a) {
158
+ return __awaiter(this, arguments, void 0, function* ({ mode, indexNames, question, top, rerank }) {
158
159
  const requestParam = {
159
- command: "extream_search",
160
- question: question,
161
- };
162
- if (indexName)
163
- requestParam.index_name = indexName;
164
- if (mode)
165
- requestParam.mode = mode;
166
- if (maxCount)
167
- requestParam.max_count = maxCount;
168
- if (findIndexPrompt)
169
- requestParam.find_index_prompt = findIndexPrompt;
170
- if (docOnly)
171
- requestParam.doc_only = docOnly;
172
- let __webSearch = {
173
- model: (_b = webSearch === null || webSearch === void 0 ? void 0 : webSearch.model) !== null && _b !== void 0 ? _b : "bing",
174
- with_image: (_c = webSearch === null || webSearch === void 0 ? void 0 : webSearch.withImage) !== null && _c !== void 0 ? _c : false,
175
- with_video: (_d = webSearch === null || webSearch === void 0 ? void 0 : webSearch.withVideo) !== null && _d !== void 0 ? _d : false,
160
+ command: "extreme_search",
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
+ },
176
168
  };
177
- if (webSearch)
178
- requestParam.web_search = __webSearch;
179
169
  const response = yield this.requestPost(requestParam);
180
170
  return response;
181
171
  });
@@ -184,7 +174,9 @@ class Vectocore {
184
174
  return __awaiter(this, arguments, void 0, function* ({ question }) {
185
175
  const requestParam = {
186
176
  command: "web_search",
187
- question: question,
177
+ params: {
178
+ question: question,
179
+ },
188
180
  };
189
181
  const response = yield this.requestPost(requestParam);
190
182
  return response;
package/dist/index.d.ts CHANGED
@@ -49,7 +49,7 @@ export interface DeleteIndexParams {
49
49
  */
50
50
  indexName: string;
51
51
  }
52
- export interface PutExtreamDataParams {
52
+ export interface PutExtremeDataParams {
53
53
  /**
54
54
  * 지식을 추가할 인덱스의 이름입니다.
55
55
  */
@@ -74,42 +74,47 @@ export interface PutExtreamDataParams {
74
74
  refOnlyText?: boolean;
75
75
  };
76
76
  }
77
- export interface ListExtreamDataParams {
77
+ export interface ListExtremeDataParams {
78
78
  /** 데이터 목록을 조회할 인덱스의 이름입니다. */
79
79
  indexName: string;
80
80
  /** 페이징된 결과를 받았을때 해당 key부터 다음 페이징까지 결과를 조회하는 기준 키 입니다. */
81
81
  lastKey?: string | null;
82
82
  }
83
- export interface ListAllExtreamDataParams {
83
+ export interface ListAllExtremeDataParams {
84
84
  /** 데이터 목록을 조회할 인덱스의 이름입니다. */
85
85
  indexName: string;
86
86
  }
87
- export interface GetExtreamDataParams {
87
+ export interface GetExtremeDataParams {
88
88
  /** 조회할 문서가 저장되어 있는 인덱스의 이름입니다. */
89
89
  indexName: string;
90
90
  /** 조회할 문서의 ID입니다. */
91
91
  documentId: string;
92
92
  }
93
- export interface DeleteExtreamDataParams {
93
+ export interface DeleteExtremeDataParams {
94
94
  /** 삭제할 문서가 저장되어 있는 인덱스의 이름입니다. */
95
95
  indexName: string;
96
96
  /** 삭제할 문서의 ID입니다. */
97
97
  documentId: string;
98
98
  }
99
- export interface ExtreamSearchParams {
100
- indexName?: string | string[] | undefined;
99
+ export interface ExtremeSearchParams {
100
+ /** 사용자의 질문을 검색하고자하는 인덱스 목록, 생략하거나 [] 전송시 전체 인덱스에서 검색 실행합니다. */
101
+ indexNames?: string[];
102
+ /** 사용자 질문 (시멘틱 검색을 사용하기때문에 서술형을 질문해도 의미를 파악하여 유사한 결과를 유사도 순위별로 리턴.) */
101
103
  question: string;
102
- maxCount?: number | undefined;
103
- mode?: "VECTOR" | "BOTH" | "WEB" | undefined;
104
- webSearch?: {
105
- model?: "google" | "bing";
106
- withImage?: boolean;
107
- withVideo?: boolean;
108
- };
109
- findIndexPrompt?: string | undefined;
110
- 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;
111
115
  }
112
116
  export interface WebSearchParams {
117
+ /** 검색어 */
113
118
  question: string;
114
119
  }
115
120
  export type FileType = {
@@ -161,12 +166,12 @@ export declare class Vectocore {
161
166
  putIndex({ indexName, description }: PutIndexParams): Promise<any>;
162
167
  deleteIndex({ indexName }: DeleteIndexParams): Promise<any>;
163
168
  listIndex(): Promise<any>;
164
- putExtreamData({ indexName, docBody }: PutExtreamDataParams): Promise<any>;
165
- getExtreamData({ indexName, documentId }: GetExtreamDataParams): Promise<any>;
166
- listExtreamData({ indexName, lastKey }: ListExtreamDataParams): Promise<any>;
167
- listAllExtreamData({ indexName }: ListAllExtreamDataParams): Promise<any>;
168
- deleteExtreamData({ indexName, documentId }: DeleteExtreamDataParams): Promise<any>;
169
- extreamSearch({ indexName, question, maxCount, mode, webSearch, findIndexPrompt, docOnly, }: ExtreamSearchParams): Promise<any>;
169
+ putExtremeData({ indexName, docBody }: PutExtremeDataParams): Promise<any>;
170
+ getExtremeData({ indexName, documentId }: GetExtremeDataParams): Promise<any>;
171
+ listExtremeData({ indexName, lastKey }: ListExtremeDataParams): Promise<any>;
172
+ listAllExtremeData({ indexName }: ListAllExtremeDataParams): Promise<any>;
173
+ deleteExtremeData({ indexName, documentId }: DeleteExtremeDataParams): Promise<any>;
174
+ extremeSearch({ mode, indexNames, question, top, rerank }: ExtremeSearchParams): Promise<any>;
170
175
  webSearch({ question }: WebSearchParams): Promise<any>;
171
176
  }
172
177
  export declare class Lens {
package/dist/mjs/index.js CHANGED
@@ -54,9 +54,9 @@ export class Vectocore {
54
54
  const response = await this.requestPost(requestParam);
55
55
  return response;
56
56
  }
57
- async putExtreamData({ indexName, docBody }) {
57
+ async putExtremeData({ indexName, docBody }) {
58
58
  const requestParam = {
59
- command: "put_extream_data",
59
+ command: "put_extreme_data",
60
60
  params: {
61
61
  index_name: indexName,
62
62
  doc_body: {
@@ -77,9 +77,9 @@ export class Vectocore {
77
77
  const response = await this.requestPost(requestParam);
78
78
  return response;
79
79
  }
80
- async getExtreamData({ indexName, documentId }) {
80
+ async getExtremeData({ indexName, documentId }) {
81
81
  const requestParam = {
82
- command: "get_extream_data",
82
+ command: "get_extreme_data",
83
83
  params: {
84
84
  index_name: indexName,
85
85
  document_id: documentId,
@@ -88,9 +88,9 @@ export class Vectocore {
88
88
  const response = await this.requestPost(requestParam);
89
89
  return response;
90
90
  }
91
- async listExtreamData({ indexName, lastKey }) {
91
+ async listExtremeData({ indexName, lastKey }) {
92
92
  const requestParam = {
93
- command: "list_extream_data",
93
+ command: "list_extreme_data",
94
94
  params: {
95
95
  index_name: indexName,
96
96
  },
@@ -101,9 +101,9 @@ export class Vectocore {
101
101
  const response = await this.requestPost(requestParam);
102
102
  return response;
103
103
  }
104
- async listAllExtreamData({ indexName }) {
104
+ async listAllExtremeData({ indexName }) {
105
105
  const requestParam = {
106
- command: "list_all_extream_data",
106
+ command: "list_all_extreme_data",
107
107
  params: {
108
108
  index_name: indexName,
109
109
  },
@@ -111,44 +111,37 @@ export class Vectocore {
111
111
  const response = await this.requestPost(requestParam);
112
112
  return response;
113
113
  }
114
- async deleteExtreamData({ indexName, documentId }) {
114
+ async deleteExtremeData({ indexName, documentId }) {
115
115
  const requestParam = {
116
- command: "delete_extream_data",
117
- index_name: indexName,
118
- document_id: documentId,
116
+ command: "delete_extreme_data",
117
+ params: {
118
+ index_name: indexName,
119
+ document_id: documentId,
120
+ },
119
121
  };
120
122
  const response = await this.requestPost(requestParam);
121
123
  return response;
122
124
  }
123
- async extreamSearch({ indexName, question, maxCount, mode, webSearch, findIndexPrompt, docOnly, }) {
125
+ async extremeSearch({ mode, indexNames, question, top, rerank }) {
124
126
  const requestParam = {
125
- command: "extream_search",
126
- question: question,
127
- };
128
- if (indexName)
129
- requestParam.index_name = indexName;
130
- if (mode)
131
- requestParam.mode = mode;
132
- if (maxCount)
133
- requestParam.max_count = maxCount;
134
- if (findIndexPrompt)
135
- requestParam.find_index_prompt = findIndexPrompt;
136
- if (docOnly)
137
- requestParam.doc_only = docOnly;
138
- let __webSearch = {
139
- model: webSearch?.model ?? "bing",
140
- with_image: webSearch?.withImage ?? false,
141
- with_video: webSearch?.withVideo ?? false,
127
+ command: "extreme_search",
128
+ params: {
129
+ mode: mode ?? "vector",
130
+ index_names: indexNames ?? [],
131
+ question: question,
132
+ top: top ?? 10,
133
+ rerank: rerank ?? false,
134
+ },
142
135
  };
143
- if (webSearch)
144
- requestParam.web_search = __webSearch;
145
136
  const response = await this.requestPost(requestParam);
146
137
  return response;
147
138
  }
148
139
  async webSearch({ question }) {
149
140
  const requestParam = {
150
141
  command: "web_search",
151
- question: question,
142
+ params: {
143
+ question: question,
144
+ },
152
145
  };
153
146
  const response = await this.requestPost(requestParam);
154
147
  return response;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vectocore4",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/cjs/index.js",