安装
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,get_json_string(m, 'ans') as answer\n3"""
print(mydb.get(query))
#[['document', 'sr', 'c', 'distance'], ('中国有一个北京1', '测试', 'A1', 272.8261536366944), ('中国有一个北京', '测试', '', 272.8261536366944), ('中国有一个北京', '测试', '', 272.8261536366944)]
部署
pip install -r requirements.txt
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py createsuperuser
#启动数据
python3 manage.py runserver 0.0.0.0:8000
Metadata
Release files for smart-vector 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smart_vector-1.1.4.tar.gz | 10.9 MB | Without provenance | Details for smart_vector-1.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| smart_vector-1.1.4-py3-none-any.whl | Python 3 | none | any | Details for smart_vector-1.1.4-py3-none-any.whl |
Total release size: 10.9 MB
Release files / smart_vector-1.1.4.tar.gz
| Download URL | smart_vector-1.1.4.tar.gz |
|---|---|
| Size | 10.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2d6bd34c6b355ca0838b8122e91a6b45337619afad0119e53e0c5bb71557f98
|
|
BLAKE2b-256 checksum How to use checksums |
34f933ff6c11a9f2637134f76dcd053ca74b8f08b5aa687a1de676fa903e118c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.0
|
Release files / smart_vector-1.1.4-py3-none-any.whl
| Download URL | smart_vector-1.1.4-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47b657f7d51317c0b5ccc74dd1a6671de19292df8fdeed4c6a7364abc9190738
|
|
BLAKE2b-256 checksum How to use checksums |
5be466896f35cf720660e99ac68363176ea811204d02d59602c849c456b4876a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.0
|
Security for smart-vector 1.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.