跳到主要内容

seekdb 文档

seekdb 文档提供了丰富的各类内容,包括 step-by-step 的上手实践、AI 应用搭建示例和 Live Demos、SDK 和 API 代码示例、详细的功能介绍和使用文档等,来帮助您快速了解和使用 seekdb。

快速开始

极简的 API 设计,让您专注于构建 AI 应用。

使用嵌入式 seekdb

以轻量级库的形式嵌入您的应用,支持 pip 一键安装。适用于个人学习、快速原型开发,并可高效运行于多种端侧设备。

使用服务器模式 seekdb

推荐用于测试及生产环境的部署模式,轻量易用,适合稳定高效地提供服务。

  1. Set up
import pyseekdb

client = pyseekdb.Client()

# create a knowledge base
collection = client.get_or_create_collection("product_database")

  1. Insert
# Add product documents
collection.upsert(
documents=[
"Laptop Pro with 16GB RAM, 512GB SSD, and high-speed processor",
"Gaming Laptop with 32GB RAM, 1TB SSD, and high-performance graphics",
"Business Ultrabook with 8GB RAM, 256GB SSD, and long battery life",
"Tablet with 6GB RAM, 128GB storage, and 10-inch display"
],
metadatas=[
{"category": "laptop", "ram": 16, "storage": 512, "price": 12000, "type": "professional"},
{"category": "laptop", "ram": 32, "storage": 1000, "price": 25000, "type": "gaming"},
{"category": "laptop", "ram": 8, "storage": 256, "price": 9000, "type": "business"},
{"category": "tablet", "ram": 6, "storage": 128, "price": 6000, "type": "consumer"}
],
ids=["1", "2", "3", "4"]
)

print("Product database built\n")

  1. Query
# Hybrid search for high-performance laptops
print("Hybrid Search: High-performance laptops for professional work")
results = collection.query(
query_texts=["powerful computer for professional work"], # Vector search
where={ # Relational filter
"category": "laptop",
"ram": {"$gte": 16}
},
where_document={"$contains": "RAM"}, # Full-text search
n_results=2
)

print("\nResults:")
for i, (doc, metadata) in enumerate(zip(results['documents'][0], results['metadatas'][0])):
print(f" {i+1}. {doc}")

开始构建

pyseekdb (Python SDK)

seekdb Python SDK 和 API 的详细介绍和使用示例

Integrations

seekdb 集成的三方生态和使用示例。

Tutorials

seekdb AI 能力使用实践和 AI 应用搭建实践。