smart vector db
Project description
安装
pip install smart_vector
使用方法
from smart_vector import SmartVectorDB, Text2VecEmbeddingFunction
# 定义向量转化函数
text_vector = Text2VecEmbeddingFunction()
# 数据库连接
connect_dict = {
'host': 'xxx',
'port': 9030,
'user': 'xxxx',
'password': 'xxx',
'db': 'smartdb'
}
mydb = SmartVectorDB(db_config=connect_dict, load_host='xxx', text_vector=text_vector)
# 插入数据
mydb.add(collection='test', sr='测试', documents=['中国有一个北京', '北京在中国', '台湾是中国的'])
mydb.add(collection='test', sr='测试', documents=['中国有一个北京1', '北京在中国1'],
categorys=['A1', 'A1'], metadatas=[{'s': 's1'}, {'s': 's2'}])
# 查询
query = """天安门\ncollection='test' and sr = '测试' and document like '%北京%'\ndocument,sr,c\n3"""
print(mydb.get(query))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
smart_vector-1.0.tar.gz
(3.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smart_vector-1.0.tar.gz.
File metadata
- Download URL: smart_vector-1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32631b3e073683737ab483062b4720e9c4d42acee4b6e3d8410192f32922d031
|
|
| MD5 |
a52dcc79b79e225787058d80eb1090b9
|
|
| BLAKE2b-256 |
86b22b9d0289650ef9d4a4e131cf73765436b84926ab324ccb6989d34e98a3fc
|
File details
Details for the file smart_vector-1.0-py3-none-any.whl.
File metadata
- Download URL: smart_vector-1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d88b28707f011b08bdacd782cd7be9dd3aa236f978b314cf7b24961e79ae1510
|
|
| MD5 |
84b5b3ee57551b486c789c113d2db66f
|
|
| BLAKE2b-256 |
ba94c8f53a926652871099e054329afde5127436e45d4809ba85d6c75b6b0c62
|