seekdbドキュメント
seekdbドキュメントでは、step-by-stepの実践手順、AIアプリケーションの構築例とライブデモ、SDKおよびAPIのコードサンプル、詳細な機能紹介や使用ドキュメントなど、豊富なコンテンツを提供しています。これにより、seekdbを迅速に理解し、活用することができます。
クイックスタート
シンプルなAPI設計で、AIアプリケーションの構築に集中できます。
軽量ライブラリとしてアプリケーションに組み込め、pipでワンクリックでインストールできます。個人学習やクイックプロトタイピングに適しており、さまざまなエンドデバイス上で効率的に動作します。
テストおよび本番環境でのデプロイメントモードとして推奨されています。軽量で使いやすく、安定して効率的なサービス提供に適しています。
- 組み込みモード
- サーバーモード
- Set up
import pyseekdb
client = pyseekdb.Client()
# create a knowledge base
collection = client.get_or_create_collection("product_database")
- 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")
- 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}")
- Set up
import pyseekdb
client = pyseekdb.Client(
host = "127.0.0.1", # server host
port = 2881, # server port (default: 2881)
)
# create a knowledge base
collection = client.get_or_create_collection("product_database")
- 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")
- 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}")
ビルドを開始する
seekdb Python SDKとAPIの詳細な紹介と使用例
seekdbと連携するサードパーティエコシステムとその利用方法。
seekdbのAI機能の活用実践とAIアプリケーションの構築実践。