パイプラインを実行
1 つ以上のデータソースに対して完全なナレッジパイプラインを実行します。response_mode でストリーミングまたはブロッキングのレスポンスを選択します。
curl --request POST \
--url https://{api_base_url}/datasets/{dataset_id}/pipeline/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputs": {},
"datasource_type": "local_file",
"datasource_info_list": [
{
"reference": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "quarterly-report.pdf"
}
],
"start_node_id": "1719288585006",
"is_published": true,
"response_mode": "blocking"
}
'<string>{
"status": 400,
"code": "invalid_param",
"message": "Pipeline not found"
}{
"status": 403,
"code": "forbidden",
"message": "Dataset api access is not enabled."
}{
"status": 404,
"code": "not_found",
"message": "Dataset not found."
}{
"status": 500,
"code": "pipeline_run_error",
"message": "Pipeline execution failed: connection timeout"
}Authorizations
すべてのリクエストは API キーで認証します:Authorization: Bearer {API_KEY}。アプリのエンドポイントにはアプリの API キーを、ナレッジのエンドポイントにはナレッジベースの API キーを使用します(Dify API クイックスタート)。
キーはサーバーサイドで保管し、クライアントコードには決して埋め込まないでください。キーが欠落または無効なリクエストは HTTP 401(unauthorized)で失敗します。
Path Parameters
ナレッジベース ID です。ナレッジベースリストを取得 から取得します。
Body
パイプライン入力変数のキーと値のペア。ワークフローで定義されたパイプライン変数に対応します。入力変数がない場合は {} を渡してください。
データソースのタイプ。datasource_info_list の各項目に必要なフィールドを決定します。
local_file, online_document, website_crawl, online_drive 処理対象のデータソースオブジェクトのリストです。項目の構造は datasource_type によって異なります。
- Local File
- Online Document
- Website Crawl
- Online Drive
Show child attributes
Show child attributes
実行を開始するノードの ID です。データソースプラグインリストを取得 から取得します。
現在のドラフトではなくパイプラインの公開バージョンを実行するかどうかを指定します。未公開の変更をテストするにはドラフトを実行します。
パイプライン実行のレスポンスモードです。streaming は Server-Sent Events ストリームを返し、blocking は完了まで待機して完全な結果を返します。
streaming, blocking Response
パイプライン実行結果。フォーマットは response_mode に依存します:ストリーミングは text/event-stream を返し、ブロッキングは完全な JSON 結果を返します。
Server-Sent Events ストリームです。response_mode が streaming の場合に返されます。ワイヤーフォーマットについては ストリーミングレスポンスの処理 を参照してください。
主なイベント:
workflow_started:実行開始node_started/node_finished:ノードごとの進捗(node_id、node_type、status、inputs、outputsを含む)workflow_finished:最終結果(status、outputs、total_tokens、elapsed_timeを含む)ping:キープアライブ
Was this page helpful?
curl --request POST \
--url https://{api_base_url}/datasets/{dataset_id}/pipeline/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputs": {},
"datasource_type": "local_file",
"datasource_info_list": [
{
"reference": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "quarterly-report.pdf"
}
],
"start_node_id": "1719288585006",
"is_published": true,
"response_mode": "blocking"
}
'<string>{
"status": 400,
"code": "invalid_param",
"message": "Pipeline not found"
}{
"status": 403,
"code": "forbidden",
"message": "Dataset api access is not enabled."
}{
"status": 404,
"code": "not_found",
"message": "Dataset not found."
}{
"status": 500,
"code": "pipeline_run_error",
"message": "Pipeline execution failed: connection timeout"
}