echoss-db 1.2.2__tar.gz → 1.2.4__tar.gz

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.
Files changed (30) hide show
  1. echoss_db-1.2.4/LICENSE +157 -0
  2. {echoss_db-1.2.2 → echoss_db-1.2.4}/MANIFEST.in +4 -1
  3. {echoss_db-1.2.2 → echoss_db-1.2.4}/PKG-INFO +94 -10
  4. {echoss_db-1.2.2 → echoss_db-1.2.4}/README.md +88 -7
  5. echoss_db-1.2.4/echoss_db/__init__.py +34 -0
  6. echoss_db-1.2.4/echoss_db/postgres_query.py +419 -0
  7. echoss_db-1.2.4/echoss_db/qdrant_vector.py +393 -0
  8. {echoss_db-1.2.2 → echoss_db-1.2.4}/echoss_db.egg-info/PKG-INFO +94 -10
  9. echoss_db-1.2.4/echoss_db.egg-info/SOURCES.txt +26 -0
  10. {echoss_db-1.2.2 → echoss_db-1.2.4}/echoss_db.egg-info/requires.txt +2 -1
  11. echoss_db-1.2.4/package_tests/test_package_imports.py +107 -0
  12. {echoss_db-1.2.2 → echoss_db-1.2.4}/requirements.txt +2 -1
  13. {echoss_db-1.2.2 → echoss_db-1.2.4}/setup.py +5 -6
  14. echoss_db-1.2.4/tutorial/example_elasticsearch.ipynb +500 -0
  15. echoss_db-1.2.4/tutorial/example_elasticsearch.py +148 -0
  16. echoss_db-1.2.4/tutorial/example_mongo.ipynb +919 -0
  17. echoss_db-1.2.4/tutorial/example_mongo.py +99 -0
  18. echoss_db-1.2.4/tutorial/example_mysql.ipynb +754 -0
  19. echoss_db-1.2.4/tutorial/example_mysql.py +108 -0
  20. echoss_db-1.2.4/tutorial/example_postgres.py +189 -0
  21. echoss_db-1.2.4/tutorial/example_postgres_qdrant_ingest.py +208 -0
  22. echoss_db-1.2.4/tutorial/example_qdrant.py +189 -0
  23. echoss_db-1.2.2/echoss_db/__init__.py +0 -3
  24. echoss_db-1.2.2/echoss_db.egg-info/SOURCES.txt +0 -13
  25. {echoss_db-1.2.2 → echoss_db-1.2.4}/echoss_db/elastic_search.py +0 -0
  26. {echoss_db-1.2.2 → echoss_db-1.2.4}/echoss_db/mongo_query.py +0 -0
  27. {echoss_db-1.2.2 → echoss_db-1.2.4}/echoss_db/mysql_query.py +0 -0
  28. {echoss_db-1.2.2 → echoss_db-1.2.4}/echoss_db.egg-info/dependency_links.txt +0 -0
  29. {echoss_db-1.2.2 → echoss_db-1.2.4}/echoss_db.egg-info/top_level.txt +0 -0
  30. {echoss_db-1.2.2 → echoss_db-1.2.4}/setup.cfg +0 -0
@@ -0,0 +1,157 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form, made
34
+ available under the License, as indicated by a copyright notice that is included
35
+ in or attached to the work (an example is provided in the Appendix below).
36
+
37
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
38
+ is based on (or derived from) the Work and for which the editorial revisions,
39
+ annotations, elaborations, or other modifications represent, as a whole, an
40
+ original work of authorship. For the purposes of this License, Derivative Works
41
+ shall not include works that remain separable from, or merely link (or bind by
42
+ name) to the interfaces of, the Work and Derivative Works thereof.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original version
45
+ of the Work and any modifications or additions to that Work or Derivative Works
46
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
47
+ by the copyright owner or by an individual or Legal Entity authorized to submit
48
+ on behalf of the copyright owner. For the purposes of this definition,
49
+ "submitted" means any form of electronic, verbal, or written communication sent
50
+ to the Licensor or its representatives, including but not limited to
51
+ communication on electronic mailing lists, source code control systems, and
52
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
53
+ the purpose of discussing and improving the Work, but excluding communication
54
+ that is conspicuously marked or otherwise designated in writing by the copyright
55
+ owner as "Not a Contribution."
56
+
57
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58
+ of whom a Contribution has been received by Licensor and subsequently
59
+ incorporated within the Work.
60
+
61
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
62
+ License, each Contributor hereby grants to You a perpetual, worldwide,
63
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
64
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
65
+ sublicense, and distribute the Work and such Derivative Works in Source or
66
+ Object form.
67
+
68
+ 3. Grant of Patent License. Subject to the terms and conditions of this License,
69
+ each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
70
+ no-charge, royalty-free, irrevocable (except as stated in this section) patent
71
+ license to make, have made, use, offer to sell, sell, import, and otherwise
72
+ transfer the Work, where such license applies only to those patent claims
73
+ licensable by such Contributor that are necessarily infringed by their
74
+ Contribution(s) alone or by combination of their Contribution(s) with the Work
75
+ to which such Contribution(s) was submitted. If You institute patent litigation
76
+ against any entity (including a cross-claim or counterclaim in a lawsuit)
77
+ alleging that the Work or a Contribution incorporated within the Work constitutes
78
+ direct or contributory patent infringement, then any patent licenses granted to
79
+ You under this License for that Work shall terminate as of the date such
80
+ litigation is filed.
81
+
82
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
83
+ Derivative Works thereof in any medium, with or without modifications, and in
84
+ Source or Object form, provided that You meet the following conditions:
85
+
86
+ (a) You must give any other recipients of the Work or Derivative Works a copy of
87
+ this License; and
88
+
89
+ (b) You must cause any modified files to carry prominent notices stating that You
90
+ changed the files; and
91
+
92
+ (c) You must retain, in the Source form of any Derivative Works that You
93
+ distribute, all copyright, patent, trademark, and attribution notices from the
94
+ Source form of the Work, excluding those notices that do not pertain to any part
95
+ of the Derivative Works; and
96
+
97
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
98
+ any Derivative Works that You distribute must include a readable copy of the
99
+ attribution notices contained within such NOTICE file, excluding those notices
100
+ that do not pertain to any part of the Derivative Works, in at least one of the
101
+ following places: within a NOTICE text file distributed as part of the
102
+ Derivative Works; within the Source form or documentation, if provided along with
103
+ the Derivative Works; or, within a display generated by the Derivative Works, if
104
+ and wherever such third-party notices normally appear. The contents of the
105
+ NOTICE file are for informational purposes only and do not modify the License.
106
+ You may add Your own attribution notices within Derivative Works that You
107
+ distribute, alongside or as an addendum to the NOTICE text from the Work,
108
+ provided that such additional attribution notices cannot be construed as
109
+ modifying the License.
110
+
111
+ You may add Your own copyright statement to Your modifications and may provide
112
+ additional or different license terms and conditions for use, reproduction, or
113
+ distribution of Your modifications, or for any such Derivative Works as a whole,
114
+ provided Your use, reproduction, and distribution of the Work otherwise complies
115
+ with the conditions stated in this License.
116
+
117
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
118
+ Contribution intentionally submitted for inclusion in the Work by You to the
119
+ Licensor shall be under the terms and conditions of this License, without any
120
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
121
+ supersede or modify the terms of any separate license agreement you may have
122
+ executed with Licensor regarding such Contributions.
123
+
124
+ 6. Trademarks. This License does not grant permission to use the trade names,
125
+ trademarks, service marks, or product names of the Licensor, except as required
126
+ for reasonable and customary use in describing the origin of the Work and
127
+ reproducing the content of the NOTICE file.
128
+
129
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
130
+ writing, Licensor provides the Work (and each Contributor provides its
131
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
132
+ KIND, either express or implied, including, without limitation, any warranties
133
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
134
+ PARTICULAR PURPOSE. You are solely responsible for determining the
135
+ appropriateness of using or redistributing the Work and assume any risks
136
+ associated with Your exercise of permissions under this License.
137
+
138
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
139
+ tort (including negligence), contract, or otherwise, unless required by
140
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
141
+ writing, shall any Contributor be liable to You for damages, including any
142
+ direct, indirect, special, incidental, or consequential damages of any
143
+ character arising as a result of this License or out of the use or inability to
144
+ use the Work (including but not limited to damages for loss of goodwill, work
145
+ stoppage, computer failure or malfunction, or any and all other commercial
146
+ damages or losses), even if such Contributor has been advised of the
147
+ possibility of such damages.
148
+
149
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
150
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
151
+ acceptance of support, warranty, indemnity, or other liability obligations
152
+ and/or rights consistent with this License. However, in accepting such
153
+ obligations, You may act only on Your own behalf and on Your sole
154
+ responsibility, not on behalf of any other Contributor, and only if You agree
155
+ to indemnify, defend, and hold each Contributor harmless for any liability
156
+ incurred by, or claims asserted against, such Contributor by reason of your
157
+ accepting any such warranty or additional liability.
@@ -2,7 +2,10 @@ include README.md
2
2
  include LICENSE
3
3
  include requirements.txt
4
4
  exclude config/
5
- include tutorial *.ipynb
5
+ recursive-include tutorial *.py *.ipynb
6
+ recursive-include package_tests *.py
7
+ recursive-exclude tutorial .ipynb_checkpoints/*
8
+ recursive-exclude tutorial *.env
6
9
  recursive-exclude * __pycache__/
7
10
  recursive-exclude * *.log *.log.*
8
11
  recursive-exclude * .*.un~
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: echoss-db
3
- Version: 1.2.2
3
+ Version: 1.2.4
4
4
  Summary: echoss AI Bigdata Solution - Database Query Package
5
5
  Home-page: https://github.com/12cmlab/echoss-query
6
6
  Author: ckkim
@@ -8,15 +8,17 @@ Author-email: ckkim@12cm.co.kr
8
8
  License: Apache License 2.0
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Operating System :: OS Independent
11
- Requires-Python: >3.7
11
+ Requires-Python: >=3.8
12
12
  Description-Content-Type: text/markdown
13
+ License-File: LICENSE
13
14
  Requires-Dist: pandas>=1.5.3
14
15
  Requires-Dist: pymongo>=4.3.3
15
16
  Requires-Dist: sqlalchemy>=2.0.0
16
17
  Requires-Dist: PyMySQL>=1.0.2
17
- Requires-Dist: PyYAML>=6.0
18
18
  Requires-Dist: opensearch-py>=2.2.0
19
19
  Requires-Dist: echoss-fileformat>=1.1.2
20
+ Requires-Dist: psycopg2-binary<3.0.0,>=2.9.11
21
+ Requires-Dist: qdrant-client[fastembed]<2.0.0,>=1.14.1
20
22
  Dynamic: author
21
23
  Dynamic: author-email
22
24
  Dynamic: classifier
@@ -24,6 +26,7 @@ Dynamic: description
24
26
  Dynamic: description-content-type
25
27
  Dynamic: home-page
26
28
  Dynamic: license
29
+ Dynamic: license-file
27
30
  Dynamic: requires-dist
28
31
  Dynamic: requires-python
29
32
  Dynamic: summary
@@ -38,6 +41,7 @@ Version History:
38
41
 
39
42
  - 1.1.0 : Add Scroll, Bulk functions in ElasticSearch
40
43
  - 1.2.0 : change mysql base package to sqlalchemy (previous version use pymysql)
44
+ - 1.2.4 : stabilize package imports for optional backends and keep PostgreSQL on psycopg2-binary for 1.2.x
41
45
 
42
46
  ## Prepare
43
47
 
@@ -79,6 +83,18 @@ To install this package, please use Python 3.8 or higher.
79
83
  pip install -U echoss-db
80
84
  ```
81
85
 
86
+ PostgreSQL driver policy for `1.2.x`:
87
+
88
+ - `psycopg2-binary` is the supported PostgreSQL driver for this release line.
89
+ - `psycopg` / `psycopg-binary` (psycopg3) is not part of the `1.2.x` compatibility target.
90
+ - If your application environment has both psycopg2 and psycopg3 installed, `echoss-db 1.2.x` will still use the psycopg2 SQLAlchemy dialect.
91
+
92
+ Dependency compatibility note:
93
+
94
+ - `echoss-db 1.2.x` does not pin `Pillow` directly.
95
+ - Qdrant support installs `qdrant-client[fastembed]`, so mixed environments may inherit additional `Pillow` constraints through `fastembed`.
96
+ - If your application also installs `echoss-storage`, align the shared environment with the `echoss-storage` line you are deploying. For `echoss-storage 1.2.1`, use `Pillow>=10.1.0,<11`.
97
+
82
98
  ## Quick Start
83
99
 
84
100
  ### Import package and class
@@ -136,15 +152,12 @@ To install this package, please use Python 3.8 or higher.
136
152
  # Ping
137
153
  mysql.ping()
138
154
 
139
- # get connection cursor
140
- mysql.conn_cursor(cursorclass=None)
141
-
142
155
  # Close
143
156
  # crash process close
144
157
  mysql.close()
145
158
 
146
159
  # debug query : default True
147
- mysql.debug_query(False)
160
+ mysql.query_debug(False)
148
161
  ```
149
162
 
150
163
  ### MongoDB
@@ -196,7 +209,7 @@ To install this package, please use Python 3.8 or higher.
196
209
  elastic.search_field(field='FIELD_NAME',value='VALUE') -> list
197
210
 
198
211
  # INSERT
199
- elastic.create(id='ID', body='JSON_BODY')
212
+ elastic.index(index='INDEX_NAME', body='JSON_BODY', id='ID')
200
213
 
201
214
  #UPDATE
202
215
  elastic.update(id='ID', body='JSON_BODY')
@@ -209,8 +222,8 @@ To install this package, please use Python 3.8 or higher.
209
222
  chunk_list = elastic.next_scroll_chunk()
210
223
 
211
224
  # BULK
212
- success, error_list = bulk_insert("farm_index", doc_list, id_field="farm_id")
213
- success, error_list = bulk_upsert("farm_index", doc_list, id_field="farm_id")
225
+ success, error_list = elastic.bulk_insert("farm_index", doc_list, id_field="farm_id")
226
+ success, error_list = elastic.bulk_upsert("farm_index", doc_list, id_field="farm_id")
214
227
 
215
228
  # Ping
216
229
  elastic.ping()
@@ -219,6 +232,77 @@ To install this package, please use Python 3.8 or higher.
219
232
  elastic.info()
220
233
  ```
221
234
 
235
+ ### Qdrant
236
+
237
+ ---
238
+
239
+ `QdrantVector`는 기본적으로 FastEmbed 모델을 사용합니다.
240
+
241
+ Tutorial 실행 순서:
242
+ 1. `tutorial/example_postgres_qdrant_ingest.py` (테스트용 충분한 chunk 데이터 생성)
243
+ 2. `tutorial/example_qdrant.py` (Qdrant 업서트/검색 확인)
244
+
245
+ 1. `fastembed_model` 미설정
246
+ - 기본값 `sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2`가 자동 적용됩니다.
247
+ - 단, 설치된 `qdrant-client/fastembed` 조합에서 미지원일 수 있으므로 아래 메서드로 확인하세요.
248
+ - 모델 상세(설명 포함) 목록: `list_supported_models_by_class("TextEmbedding")`
249
+ - `vector` 입력 없이 원문 텍스트(`document`/`text`/`content`)를 전달합니다.
250
+ - 명시 메서드 `upsert_texts()` / `search_text()` 사용을 권장합니다.
251
+ - `create_collection()`의 차원은 모델에서 자동 추론합니다.
252
+
253
+ 2. `fastembed_model` 설정
254
+ - 지정한 모델로 동작합니다.
255
+ - `create_collection()`의 차원은 설정 모델 기준으로 자동 추론합니다.
256
+
257
+ 3. `fastembed_model: null`
258
+ - FastEmbed를 비활성화하고 벡터 직접 주입 모드로 동작합니다.
259
+ - 이 경우 `upsert_vectors()` / `search_vector()` 사용을 권장합니다.
260
+ - `create_collection(dim=...)`에서 `dim`은 필수입니다.
261
+
262
+ Config example:
263
+
264
+ ```yaml
265
+ qdrant:
266
+ host: <IP addrress or domain>
267
+ port: 6333
268
+ scheme: http
269
+ collection: ai_rag_chunks
270
+ timeout: 5
271
+ default_limit: 10
272
+ fastembed_model: sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2
273
+ ```
274
+
275
+ Text-input upsert example (`fastembed_model` enabled):
276
+
277
+ ```python
278
+ points = [
279
+ {"id": 1, "document": "RAG 시스템 설계 문서", "payload": {"source": "wiki"}},
280
+ {"id": 2, "text": "Qdrant 검색 예제", "payload": {"source": "blog"}},
281
+ ]
282
+ qv.upsert_texts(points, collection="ai_rag_chunks")
283
+
284
+ hits = qv.search_text(query_text="RAG 아키텍처", limit=5, collection="ai_rag_chunks")
285
+ ```
286
+
287
+ External vector-input mode is documented as a code pattern only (for lightweight tutorial runtime):
288
+
289
+ ```python
290
+ qv = QdrantVector({
291
+ "qdrant": {
292
+ "host": "<host>",
293
+ "port": 6333,
294
+ "scheme": "http",
295
+ "collection": "ai_rag_chunks_external",
296
+ "fastembed_model": None
297
+ }
298
+ })
299
+
300
+ points = [{"id": 1, "vector": your_embed_fn("문서"), "payload": {"source": "external"}}]
301
+ qv.create_collection(dim=len(points[0]["vector"]))
302
+ qv.upsert_vectors(points)
303
+ hits = qv.search_vector(vector=your_embed_fn("질의"))
304
+ ```
305
+
222
306
  ### Code Quality
223
307
 
224
308
  When creating new functions, please follow the Google style Python docstrings. See example below:
@@ -8,6 +8,7 @@ Version History:
8
8
 
9
9
  - 1.1.0 : Add Scroll, Bulk functions in ElasticSearch
10
10
  - 1.2.0 : change mysql base package to sqlalchemy (previous version use pymysql)
11
+ - 1.2.4 : stabilize package imports for optional backends and keep PostgreSQL on psycopg2-binary for 1.2.x
11
12
 
12
13
  ## Prepare
13
14
 
@@ -49,6 +50,18 @@ To install this package, please use Python 3.8 or higher.
49
50
  pip install -U echoss-db
50
51
  ```
51
52
 
53
+ PostgreSQL driver policy for `1.2.x`:
54
+
55
+ - `psycopg2-binary` is the supported PostgreSQL driver for this release line.
56
+ - `psycopg` / `psycopg-binary` (psycopg3) is not part of the `1.2.x` compatibility target.
57
+ - If your application environment has both psycopg2 and psycopg3 installed, `echoss-db 1.2.x` will still use the psycopg2 SQLAlchemy dialect.
58
+
59
+ Dependency compatibility note:
60
+
61
+ - `echoss-db 1.2.x` does not pin `Pillow` directly.
62
+ - Qdrant support installs `qdrant-client[fastembed]`, so mixed environments may inherit additional `Pillow` constraints through `fastembed`.
63
+ - If your application also installs `echoss-storage`, align the shared environment with the `echoss-storage` line you are deploying. For `echoss-storage 1.2.1`, use `Pillow>=10.1.0,<11`.
64
+
52
65
  ## Quick Start
53
66
 
54
67
  ### Import package and class
@@ -106,15 +119,12 @@ To install this package, please use Python 3.8 or higher.
106
119
  # Ping
107
120
  mysql.ping()
108
121
 
109
- # get connection cursor
110
- mysql.conn_cursor(cursorclass=None)
111
-
112
122
  # Close
113
123
  # crash process close
114
124
  mysql.close()
115
125
 
116
126
  # debug query : default True
117
- mysql.debug_query(False)
127
+ mysql.query_debug(False)
118
128
  ```
119
129
 
120
130
  ### MongoDB
@@ -166,7 +176,7 @@ To install this package, please use Python 3.8 or higher.
166
176
  elastic.search_field(field='FIELD_NAME',value='VALUE') -> list
167
177
 
168
178
  # INSERT
169
- elastic.create(id='ID', body='JSON_BODY')
179
+ elastic.index(index='INDEX_NAME', body='JSON_BODY', id='ID')
170
180
 
171
181
  #UPDATE
172
182
  elastic.update(id='ID', body='JSON_BODY')
@@ -179,8 +189,8 @@ To install this package, please use Python 3.8 or higher.
179
189
  chunk_list = elastic.next_scroll_chunk()
180
190
 
181
191
  # BULK
182
- success, error_list = bulk_insert("farm_index", doc_list, id_field="farm_id")
183
- success, error_list = bulk_upsert("farm_index", doc_list, id_field="farm_id")
192
+ success, error_list = elastic.bulk_insert("farm_index", doc_list, id_field="farm_id")
193
+ success, error_list = elastic.bulk_upsert("farm_index", doc_list, id_field="farm_id")
184
194
 
185
195
  # Ping
186
196
  elastic.ping()
@@ -189,6 +199,77 @@ To install this package, please use Python 3.8 or higher.
189
199
  elastic.info()
190
200
  ```
191
201
 
202
+ ### Qdrant
203
+
204
+ ---
205
+
206
+ `QdrantVector`는 기본적으로 FastEmbed 모델을 사용합니다.
207
+
208
+ Tutorial 실행 순서:
209
+ 1. `tutorial/example_postgres_qdrant_ingest.py` (테스트용 충분한 chunk 데이터 생성)
210
+ 2. `tutorial/example_qdrant.py` (Qdrant 업서트/검색 확인)
211
+
212
+ 1. `fastembed_model` 미설정
213
+ - 기본값 `sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2`가 자동 적용됩니다.
214
+ - 단, 설치된 `qdrant-client/fastembed` 조합에서 미지원일 수 있으므로 아래 메서드로 확인하세요.
215
+ - 모델 상세(설명 포함) 목록: `list_supported_models_by_class("TextEmbedding")`
216
+ - `vector` 입력 없이 원문 텍스트(`document`/`text`/`content`)를 전달합니다.
217
+ - 명시 메서드 `upsert_texts()` / `search_text()` 사용을 권장합니다.
218
+ - `create_collection()`의 차원은 모델에서 자동 추론합니다.
219
+
220
+ 2. `fastembed_model` 설정
221
+ - 지정한 모델로 동작합니다.
222
+ - `create_collection()`의 차원은 설정 모델 기준으로 자동 추론합니다.
223
+
224
+ 3. `fastembed_model: null`
225
+ - FastEmbed를 비활성화하고 벡터 직접 주입 모드로 동작합니다.
226
+ - 이 경우 `upsert_vectors()` / `search_vector()` 사용을 권장합니다.
227
+ - `create_collection(dim=...)`에서 `dim`은 필수입니다.
228
+
229
+ Config example:
230
+
231
+ ```yaml
232
+ qdrant:
233
+ host: <IP addrress or domain>
234
+ port: 6333
235
+ scheme: http
236
+ collection: ai_rag_chunks
237
+ timeout: 5
238
+ default_limit: 10
239
+ fastembed_model: sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2
240
+ ```
241
+
242
+ Text-input upsert example (`fastembed_model` enabled):
243
+
244
+ ```python
245
+ points = [
246
+ {"id": 1, "document": "RAG 시스템 설계 문서", "payload": {"source": "wiki"}},
247
+ {"id": 2, "text": "Qdrant 검색 예제", "payload": {"source": "blog"}},
248
+ ]
249
+ qv.upsert_texts(points, collection="ai_rag_chunks")
250
+
251
+ hits = qv.search_text(query_text="RAG 아키텍처", limit=5, collection="ai_rag_chunks")
252
+ ```
253
+
254
+ External vector-input mode is documented as a code pattern only (for lightweight tutorial runtime):
255
+
256
+ ```python
257
+ qv = QdrantVector({
258
+ "qdrant": {
259
+ "host": "<host>",
260
+ "port": 6333,
261
+ "scheme": "http",
262
+ "collection": "ai_rag_chunks_external",
263
+ "fastembed_model": None
264
+ }
265
+ })
266
+
267
+ points = [{"id": 1, "vector": your_embed_fn("문서"), "payload": {"source": "external"}}]
268
+ qv.create_collection(dim=len(points[0]["vector"]))
269
+ qv.upsert_vectors(points)
270
+ hits = qv.search_vector(vector=your_embed_fn("질의"))
271
+ ```
272
+
192
273
  ### Code Quality
193
274
 
194
275
  When creating new functions, please follow the Google style Python docstrings. See example below:
@@ -0,0 +1,34 @@
1
+ from __future__ import annotations
2
+
3
+ from importlib import import_module
4
+
5
+ __all__ = [
6
+ "MysqlQuery",
7
+ "MongoQuery",
8
+ "ElasticSearch",
9
+ "PostgresQuery",
10
+ "QdrantVector",
11
+ ]
12
+
13
+ _EXPORTS = {
14
+ "MysqlQuery": ".mysql_query",
15
+ "MongoQuery": ".mongo_query",
16
+ "ElasticSearch": ".elastic_search",
17
+ "PostgresQuery": ".postgres_query",
18
+ "QdrantVector": ".qdrant_vector",
19
+ }
20
+
21
+
22
+ def __getattr__(name: str):
23
+ module_name = _EXPORTS.get(name)
24
+ if module_name is None:
25
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
26
+
27
+ module = import_module(module_name, __name__)
28
+ value = getattr(module, name)
29
+ globals()[name] = value
30
+ return value
31
+
32
+
33
+ def __dir__():
34
+ return sorted(list(globals().keys()) + __all__)