Skip to main content

匯入和匯出FLOW

您可以將FLOW匯出以在 AgentBuilder 實例之間傳輸、與他人分享,或建立備份。

匯出FLOW

有三種方式可以匯出FLOW:

  • 從專案匯出:在 專案 頁面,找到您要匯出的FLOW,按一下 更多,然後選取 匯出。要匯出專案中的所有FLOW,請按一下 專案 清單上的 選項,然後選取 下載

  • 透過分享匯出:編輯FLOW時,按一下 分享,然後按一下 匯出

  • 使用 AgentBuilder API 匯出:要匯出一個FLOW,請使用 /flows/download 端點。 要匯出專案中的所有FLOW,請使用 /projects/download 端點。

匯出的FLOW會下載到您的本機電腦作為 JSON 檔案,檔案名稱為 FLOW_NAME.json。 如果您匯出整個專案,JSON 檔案會打包在 zip 封存檔中。 如需詳細資訊,請參閱 AgentBuilder JSON 檔案內容

儲存我的 API 金鑰

專案 頁面或 分享 選單匯出時,您可以選取 儲存我的 API 金鑰 以匯出FLOW 以及 任何已定義的 API 金鑰變數。 非 API 金鑰變數無論 儲存我的 API 金鑰 設定為何,都會包含在匯出中。

warning

如果您在Components的 API 金鑰欄位中輸入實際金鑰值,則 儲存我的 API 金鑰 會匯出實際金鑰值。

如果您的金鑰儲存在 AgentBuilder 全域變數中,儲存我的 API 金鑰 只會匯出變數名稱。

當您或其他使用者將FLOW匯入到另一個 AgentBuilder 實例時,該實例必須有 AgentBuilder 全域變數,且名稱相同且有效值,才能成功執行FLOW。 如果任何變數遺失或無效,則在匯入FLOW後必須建立或編輯這些變數。

匯入FLOW

您可以從本機電腦匯入 AgentBuilder JSON 檔案,如下所示:

  • 匯入到專案:在 專案 頁面,按一下 上傳FLOW,然後選取要匯入的 AgentBuilder JSON 檔案。
  • 隨處匯入:將 AgentBuilder JSON 檔案從您的檔案總管拖放到您的 AgentBuilder 視窗中,從任何 AgentBuilder 頁面匯入FLOW。
  • 使用 AgentBuilder API 匯入:要匯入一個 AgentBuilder JSON 檔案,請使用 /flows/upload/ 端點。 要匯入 zip 封存檔的 AgentBuilder JSON 檔案,請使用 /projects/upload 端點。

執行已匯入的FLOW

匯入後,您的FLOW即可使用。 如果FLOW包含任何全域變數,請確保您的 AgentBuilder 實例有全域變數,且名稱相同且有效值。 如需詳細資訊,請參閱 儲存我的 API 金鑰

AgentBuilder JSON 檔案內容

匯出的FLOW會下載到您的本機電腦作為 JSON 檔案,檔案名稱為 FLOW_NAME.json

AgentBuilder JSON 檔案包含以下內容:

如需 AgentBuilder JSON 檔案範例,您可以檢查 AgentBuilder 儲存庫中的任何 https://github.com/langflow-ai/langflow/tree/main/src/backend/base/langflow/initial_setup/starter_projects[templates],或在 AgentBuilder 中從範本建立FLOW、匯出它,然後在文字編輯器中開啟匯出的 JSON 檔案。

節點

節點代表組成FLOW的Components。 例如,此物件代表 聊天輸入 Components:


_35
{
_35
"data": {
_35
"description": "Get chat inputs from the Playground.",
_35
"display_name": "Chat Input",
_35
"id": "ChatInput-jFwUm",
_35
"node": {
_35
"base_classes": ["Message"],
_35
"description": "Get chat inputs from the Playground.",
_35
"display_name": "Chat Input",
_35
"icon": "MessagesSquare",
_35
"template": {
_35
"input_value": {
_35
"display_name": "Text",
_35
"info": "Message to be passed as input.",
_35
"value": "Hello"
_35
},
_35
"sender": {
_35
"value": "User",
_35
"options": ["Machine", "User"]
_35
},
_35
"sender_name": {
_35
"value": "User"
_35
},
_35
"should_store_message": {
_35
"value": true
_35
}
_35
}
_35
},
_35
"type": "ChatInput"
_35
},
_35
"position": {
_35
"x": 689.5720422421635,
_35
"y": 765.155834131403
_35
}
_35
}

每個節點都有唯一識別碼,格式為 NODE_NAME-UUID,例如 ChatInput-jFwUm

入口節點,例如 ChatInput 節點,是執行FLOW時首先執行的節點。

邊緣

邊緣代表節點之間的連線。

以下範例代表 ChatInput Components和 OpenAIModel Components之間的邊緣(或連線):


_22
{
_22
"className": "",
_22
"data": {
_22
"sourceHandle": {
_22
"dataType": "ChatInput",
_22
"id": "ChatInput-jFwUm",
_22
"name": "message",
_22
"output_types": ["Message"]
_22
},
_22
"targetHandle": {
_22
"fieldName": "input_value",
_22
"id": "OpenAIModel-OcXkl",
_22
"inputTypes": ["Message"],
_22
"type": "str"
_22
}
_22
},
_22
"id": "reactflow__edge-ChatInput-jFwUm{œdataTypeœ:œChatInputœ,œidœ:œChatInput-jFwUmœ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}-OpenAIModel-OcXkl{œfieldNameœ:œinput_valueœ,œidœ:œOpenAIModel-OcXklœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
_22
"source": "ChatInput-jFwUm",
_22
"sourceHandle": "{œdataTypeœ: œChatInputœ, œidœ: œChatInput-jFwUmœ, œnameœ: œmessageœ, œoutput_typesœ: [œMessageœ]}",
_22
"target": "OpenAIModel-OcXkl",
_22
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œOpenAIModel-OcXklœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"
_22
}

此邊緣顯示 ChatInput Components輸出 Message 類型到目標節點,即 OpenAIModel 節點。 OpenAIModel Components在 input_value 欄位接受 Message 類型。

其他中繼資料和專案資訊

FLOW的其他資訊儲存在根 data 物件中:

  • 中繼資料和專案資訊包括FLOW的名稱、描述和 last_tested_version。 例如:


    _10
    {
    _10
    "name": "Basic Prompting",
    _10
    "description": "Perform basic prompting with an OpenAI model.",
    _10
    "tags": ["chatbots"],
    _10
    "id": "1511c230-d446-43a7-bfc3-539e69ce05b8",
    _10
    "last_tested_version": "1.0.19.post2",
    _10
    "gradient": "2",
    _10
    "icon": "Braces"
    _10
    }

  • 視覺資訊定義開啟FLOW時工作區中視口的視窗位置:


    _10
    "viewport": {
    _10
    "x": -37.61270157375441,
    _10
    "y": -155.91266341888854,
    _10
    "zoom": 0.7575251406952855
    _10
    }

  • 筆記 是幫助解釋FLOW目的、配置詳細資訊,或任何相關資訊的註釋,使用者編輯FLOW時可能會用到。 它們可以包含文字、連結、程式碼片段和其他資訊。 它們以 Markdown 格式編碼,並儲存為 node 物件。


    _10
    {
    _10
    "id": "undefined-kVLkG",
    _10
    "node": {
    _10
    "description": "## 📖 README\nPerform basic prompting with an OpenAI model.\n\n#### Quick Start\n- Add your **OpenAI API key** to the **OpenAI Model**\n- Open the **Playground** to chat with your bot.\n..."
    _10
    }
    _10
    }

另請參閱

Search