監控端點
/monitor 端點用於內部 AgentBuilder 功能,主要與在 Playground 中執行FLOW、儲存聊天歷史記錄和生成FLOW日誌相關。
此資訊主要適用於那些正在建構自訂Components或以需要呼叫或理解這些端點的方式貢獻 AgentBuilder 程式碼庫的人。
對於使用 AgentBuilder 的典型應用程式開發,有更適當的選項用於監控、除錯和記憶體管理。 有關更多資訊,請參閱以下內容:
- 日誌:AgentBuilder 日誌儲存位置、自訂選項,以及在視覺編輯器中查看日誌的位置
- 在 Playground 中測試FLOW:執行FLOW並檢查訊息歷史記錄
- 記憶體管理選項:AgentBuilder 儲存位置和選項,包括資料庫、快取和聊天歷史記錄
頂點建構
頂點建構端點 (/monitor/builds) 專門用於 Playground 功能。
當您在 Playground 中執行FLOW時,AgentBuilder 會呼叫 chat.py 中的 /build/$FLOW_ID/flow 端點。此呼叫會檢索FLOW資料、建構圖形並執行圖形。當每個Components(或節點)被執行時,build_vertex 函數會呼叫 build_and_run,這可能會呼叫個別Components的 def_build 方法(如果存在)。如果Components沒有 def_build 函數,建構仍然會返回Components。
build 函數允許Components在執行時執行邏輯。例如,Recursive Character Text Splitter Components 是 LCTextSplitterComponent 類別的子類別。當需要處理文字時,會呼叫父類別的 build 方法,這會建立一個 RecursiveCharacterTextSplitter 物件並使用它根據定義的參數分割文字。分割的文字然後被傳遞到下一個Components。這一切都發生在Components被建構時。
獲取頂點建構
檢索特定FLOW的頂點建構。
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/monitor/builds?flow_id=$FLOW_ID" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
Result
_357{_357 "vertex_builds": {_357 "ChatInput-NCmix": [_357 {_357 "data": {_357 "results": {_357 "message": {_357 "text_key": "text",_357 "data": {_357 "timestamp": "2024-12-23 19:10:57",_357 "sender": "User",_357 "sender_name": "User",_357 "session_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_357 "text": "Hello",_357 "files": [],_357 "error": "False",_357 "edit": "False",_357 "properties": {_357 "text_color": "",_357 "background_color": "",_357 "edited": "False",_357 "source": {_357 "id": "None",_357 "display_name": "None",_357 "source": "None"_357 },_357 "icon": "",_357 "allow_markdown": "False",_357 "positive_feedback": "None",_357 "state": "complete",_357 "targets": []_357 },_357 "category": "message",_357 "content_blocks": [],_357 "id": "c95bed34-f906-4aa6-84e4-68553f6db772",_357 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a"_357 },_357 "default_value": "",_357 "text": "Hello",_357 "sender": "User",_357 "sender_name": "User",_357 "files": [],_357 "session_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_357 "timestamp": "2024-12-23 19:10:57+00:00",_357 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_357 "error": "False",_357 "edit": "False",_357 "properties": {_357 "text_color": "",_357 "background_color": "",_357 "edited": "False",_357 "source": {_357 "id": "None",_357 "display_name": "None",_357 "source": "None"_357 },_357 "icon": "",_357 "allow_markdown": "False",_357 "positive_feedback": "None",_357 "state": "complete",_357 "targets": []_357 },_357 "category": "message",_357 "content_blocks": []_357 }_357 },_357 "outputs": {_357 "message": {_357 "message": {_357 "timestamp": "2024-12-23T19:10:57",_357 "sender": "User",_357 "sender_name": "User",_357 "session_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_357 "text": "Hello",_357 "files": [],_357 "error": false,_357 "edit": false,_357 "properties": {_357 "text_color": "",_357 "background_color": "",_357 "edited": false,_357 "source": {_357 "id": null,_357 "display_name": null,_357 "source": null_357 },_357 "icon": "",_357 "allow_markdown": false,_357 "positive_feedback": null,_357 "state": "complete",_357 "targets": []_357 },_357 "category": "message",_357 "content_blocks": [],_357 "id": "c95bed34-f906-4aa6-84e4-68553f6db772",_357 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a"_357 },_357 "type": "object"_357 }_357 },_357 "logs": { "message": [] },_357 "message": {_357 "message": "Hello",_357 "sender": "User",_357 "sender_name": "User",_357 "files": [],_357 "type": "object"_357 },_357 "artifacts": {_357 "message": "Hello",_357 "sender": "User",_357 "sender_name": "User",_357 "files": [],_357 "type": "object"_357 },_357 "timedelta": 0.015060124918818474,_357 "duration": "15 ms",_357 "used_frozen_result": false_357 },_357 "artifacts": {_357 "message": "Hello",_357 "sender": "User",_357 "sender_name": "User",_357 "files": [],_357 "type": "object"_357 },_357 "params": "- Files: []\n Message: Hello\n Sender: User\n Sender Name: User\n Type: object\n",_357 "valid": true,_357 "build_id": "40aa200e-74db-4651-b698-f80301d2b26b",_357 "id": "ChatInput-NCmix",_357 "timestamp": "2024-12-23T19:10:58.772766Z",_357 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a"_357 }_357 ],_357 "Prompt-BEn9c": [_357 {_357 "data": {_357 "results": {},_357 "outputs": {_357 "prompt": {_357 "message": "Answer the user as if you were a GenAI expert, enthusiastic about helping them get started building something fresh.",_357 "type": "text"_357 }_357 },_357 "logs": { "prompt": [] },_357 "message": {_357 "prompt": {_357 "repr": "Answer the user as if you were a GenAI expert, enthusiastic about helping them get started building something fresh.",_357 "raw": "Answer the user as if you were a GenAI expert, enthusiastic about helping them get started building something fresh.",_357 "type": "text"_357 }_357 },_357 "artifacts": {_357 "prompt": {_357 "repr": "Answer the user as if you were a GenAI expert, enthusiastic about helping them get started building something fresh.",_357 "raw": "Answer the user as if you were a GenAI expert, enthusiastic about helping them get started building something fresh.",_357 "type": "text"_357 }_357 },_357 "timedelta": 0.0057758750626817346,_357 "duration": "6 ms",_357 "used_frozen_result": false_357 },_357 "artifacts": {_357 "prompt": {_357 "repr": "Answer the user as if you were a GenAI expert, enthusiastic about helping them get started building something fresh.",_357 "raw": "Answer the user as if you were a GenAI expert, enthusiastic about helping them get started building something fresh.",_357 "type": "text"_357 }_357 },_357 "params": "None",_357 "valid": true,_357 "build_id": "39bbbfde-97fd-42a5-a9ed-d42a5c5d532b",_357 "id": "Prompt-BEn9c",_357 "timestamp": "2024-12-23T19:10:58.781019Z",_357 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a"_357 }_357 ],_357 "OpenAIModel-7AjrN": [_357 {_357 "data": {_357 "results": {},_357 "outputs": {_357 "text_output": {_357 "message": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "type": "text"_357 },_357 "model_output": { "message": "", "type": "unknown" }_357 },_357 "logs": { "text_output": [] },_357 "message": {_357 "text_output": {_357 "repr": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "raw": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "type": "text"_357 }_357 },_357 "artifacts": {_357 "text_output": {_357 "repr": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "raw": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "type": "text"_357 }_357 },_357 "timedelta": 1.034765167045407,_357 "duration": "1.03 seconds",_357 "used_frozen_result": false_357 },_357 "artifacts": {_357 "text_output": {_357 "repr": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "raw": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "type": "text"_357 }_357 },_357 "params": "None",_357 "valid": true,_357 "build_id": "4f0ae730-a266-4d35-b89f-7b825c620a0f",_357 "id": "OpenAIModel-7AjrN",_357 "timestamp": "2024-12-23T19:10:58.790484Z",_357 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a"_357 }_357 ],_357 "ChatOutput-sfUhT": [_357 {_357 "data": {_357 "results": {_357 "message": {_357 "text_key": "text",_357 "data": {_357 "timestamp": "2024-12-23 19:10:58",_357 "sender": "Machine",_357 "sender_name": "AI",_357 "session_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_357 "text": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "files": [],_357 "error": "False",_357 "edit": "False",_357 "properties": {_357 "text_color": "",_357 "background_color": "",_357 "edited": "False",_357 "source": {_357 "id": "OpenAIModel-7AjrN",_357 "display_name": "OpenAI",_357 "source": "gpt-4o-mini"_357 },_357 "icon": "OpenAI",_357 "allow_markdown": "False",_357 "positive_feedback": "None",_357 "state": "complete",_357 "targets": []_357 },_357 "category": "message",_357 "content_blocks": [],_357 "id": "5688356d-9f30-40ca-9907-79a7a2fc16fd",_357 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a"_357 },_357 "default_value": "",_357 "text": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "sender": "Machine",_357 "sender_name": "AI",_357 "files": [],_357 "session_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_357 "timestamp": "2024-12-23 19:10:58+00:00",_357 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_357 "error": "False",_357 "edit": "False",_357 "properties": {_357 "text_color": "",_357 "background_color": "",_357 "edited": "False",_357 "source": {_357 "id": "OpenAIModel-7AjrN",_357 "display_name": "OpenAI",_357 "source": "gpt-4o-mini"_357 },_357 "icon": "OpenAI",_357 "allow_markdown": "False",_357 "positive_feedback": "None",_357 "state": "complete",_357 "targets": []_357 },_357 "category": "message",_357 "content_blocks": []_357 }_357 },_357 "outputs": {_357 "message": {_357 "message": {_357 "timestamp": "2024-12-23T19:10:58",_357 "sender": "Machine",_357 "sender_name": "AI",_357 "session_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_357 "text": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "files": [],_357 "error": false,_357 "edit": false,_357 "properties": {_357 "text_color": "",_357 "background_color": "",_357 "edited": false,_357 "source": {_357 "id": "OpenAIModel-7AjrN",_357 "display_name": "OpenAI",_357 "source": "gpt-4o-mini"_357 },_357 "icon": "OpenAI",_357 "allow_markdown": false,_357 "positive_feedback": null,_357 "state": "complete",_357 "targets": []_357 },_357 "category": "message",_357 "content_blocks": [],_357 "id": "5688356d-9f30-40ca-9907-79a7a2fc16fd",_357 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a"_357 },_357 "type": "object"_357 }_357 },_357 "logs": { "message": [] },_357 "message": {_357 "message": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "sender": "Machine",_357 "sender_name": "AI",_357 "files": [],_357 "type": "object"_357 },_357 "artifacts": {_357 "message": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "sender": "Machine",_357 "sender_name": "AI",_357 "files": [],_357 "type": "object"_357 },_357 "timedelta": 0.017838125000707805,_357 "duration": "18 ms",_357 "used_frozen_result": false_357 },_357 "artifacts": {_357 "message": "Hello! 🌟 I'm excited to help you get started on your journey to building something fresh! What do you have in mind? Whether it's a project, an idea, or a concept, let's dive in and make it happen!",_357 "sender": "Machine",_357 "sender_name": "AI",_357 "files": [],_357 "type": "object"_357 },_357 "params": "- Files: []\n Message: Hello! 🌟 I'm excited to help you get started on your journey to building\n something fresh! What do you have in mind? Whether it's a project, an idea, or\n a concept, let's dive in and make it happen!\n Sender: Machine\n Sender Name: AI\n Type: object\n",_357 "valid": true,_357 "build_id": "1e8b908b-aba7-403b-9e9b-eca92bb78668",_357 "id": "ChatOutput-sfUhT",_357 "timestamp": "2024-12-23T19:10:58.813268Z",_357 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a"_357 }_357 ]_357 }_357}