コンテンツにスキップ

エッジとグラフ

Show:

バケットエッジは、supersedesreferencespart_ofなど、バケット内のノード間の関係を表します。これらのエッジを直接読み書きするv1ルートは、もはや公開コンシューマーAPIではありません。

注: 新しい統合ではこれらのルートを使用しないでください。Schiftは検索中に内部で関係シグナルを使用することがありますが、生のグラフエッジはサポートされている公開インターフェースではありません。v2バケット検索を使用してユーザー向けの取得を行ってください。

VersionStatusNotes
v1Deprecated直接エッジ変更ルート。既存の内部呼び出しのみで保持。
v2Currentバケット検索を介して関連コンテンツを取得。

バケットにエッジを追加します。

注: このエンドポイントは非推奨であり、公開OpenAPIスキーマには含まれていません。

NameTypeDescription
bucket_idstringバケットのUUID。
NameTypeRequiredDescription
edgesarrayYes最大10,000のエッジオブジェクト。
edges[].sourcestringYesソースノードID。
edges[].targetstringYesターゲットノードID。
edges[].relationstringNocontradictssupersedescaused_byis_arelated_to(デフォルト)、has_childfollowsreferencessummarizesalias_ofpart_ofのいずれか。
edges[].weightnumberNo0.0から1.0の信頼度。デフォルトは1.0
Terminal window
curl -X POST ${API_BASE_URL:-https://api.schift.io}/v1/buckets/550e8400-e29b-41d4-a716-446655440000/edges \
-H "Authorization: Bearer $SCHIFT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"edges": [
{
"source": "node-1",
"target": "node-2",
"relation": "supersedes",
"weight": 0.95
}
]
}'
{
"count": 1
}
// 400 invalid_relation_type
{
"error": "invalid_relation_type",
"unknown_relation_types": ["supersedes"]
}
// 402 Payment Required
{
"allowed": false,
"reason": "quota_exceeded"
}
// 403 Forbidden
{
"detail": "Ingest quota unavailable. Upgrade your plan."
}
// 404 Not Found
{
"detail": "Bucket not found"
}

GET /v1/buckets/{bucket_id}/edges/{node_id}

Section titled “GET /v1/buckets/{bucket_id}/edges/{node_id}”

ノードに接続されたエッジを一覧表示します。

注: このエンドポイントは非推奨であり、公開OpenAPIスキーマには含まれていません。

NameTypeDescription
bucket_idstringバケットのUUID。
node_idstringクエリ対象のノードID。
NameTypeRequiredDescription
directionstringNooutgoing(デフォルト)、incoming、またはboth
relationstringNo単一の関係タイプにフィルタリング。バケットのオントロジーで定義されている必要があります。
Terminal window
curl -G ${API_BASE_URL:-https://api.schift.io}/v1/buckets/550e8400-e29b-41d4-a716-446655440000/edges/node-1 \
-H "Authorization: Bearer $SCHIFT_API_KEY" \
-d "direction=both" \
-d "relation=supersedes"
{
"node_id": "node-1",
"direction": "both",
"edges": [
{
"source": "node-1",
"target": "node-2",
"relation": "supersedes",
"weight": 0.95
}
]
}
// 400 invalid_relation_type
{
"error": "invalid_relation_type",
"unknown_relation_types": ["supersedes"]
}
// 404 Not Found
{
"detail": "Bucket not found"
}

特定のエッジを削除します。

注: このエンドポイントは非推奨であり、公開OpenAPIスキーマには含まれていません。

NameTypeDescription
bucket_idstringバケットのUUID。
NameTypeRequiredDescription
sourcestringYesソースノードID。
targetstringYesターゲットノードID。
relationstringNo関係タイプ。デフォルトはrelated_to。バケットのオントロジーで定義されている必要があります。
Terminal window
curl -X DELETE ${API_BASE_URL:-https://api.schift.io}/v1/buckets/550e8400-e29b-41d4-a716-446655440000/edges \
-H "Authorization: Bearer $SCHIFT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source": "node-1",
"target": "node-2",
"relation": "supersedes"
}'

成功時には204 No Content

// 400 invalid_relation_type
{
"error": "invalid_relation_type",
"unknown_relation_types": ["supersedes"]
}
// 404 Not Found
{
"detail": "Bucket not found"
}

生のエッジを読む代わりに、自然言語クエリをv2検索エンドポイントに送信します。

Terminal window
curl -X POST ${API_BASE_URL:-https://api.schift.io}/v2/buckets/550e8400-e29b-41d4-a716-446655440000/search \
-H "Authorization: Bearer $SCHIFT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "Which policy supersedes the old refund rule?",
"top_k": 8,
"options": {
"rerank": {"enabled": true}
}
}'