Skip to main content

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


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 hashes)

Uploaded Source

Built Distribution

smart_vector-1.0-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page