监控端点
使用 /monitor
端点来监控和修改在 Langflow 组件、顶点构建和事务之间传递的消息。
获取顶点构建
检索特定流的顶点构建。
_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"
结果
_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}
删除顶点构建
删除特定流的顶点构建。
_10curl -X DELETE \_10 "$LANGFLOW_URL/api/v1/monitor/builds?flow_id=$FLOW_ID" \_10 -H "accept: */*" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
结果
_10204 No Content
获取消息
检索所有消息的列表:
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/monitor/messages" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
要过滤消息,请使用 flow_id
、session_id
、sender
和 sender_name
查询参数。
要对结果进行排序,请使用 order_by
查询参数。
此示例检索在给定聊天会话(session_id
)中由 Machine
和 AI
发送的消息,并按时间戳对消息进行排序。
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/monitor/messages?flow_id=$FLOW_ID&session_id=01ce083d-748b-4b8d-97b6-33adbb6a528a&sender=Machine&sender_name=AI&order_by=timestamp" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
结果
_30[_30 {_30 "id": "1c1d6134-9b8b-4079-931c-84dcaddf19ba",_30 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_30 "timestamp": "2024-12-23 19:20:11 UTC",_30 "sender": "Machine",_30 "sender_name": "AI",_30 "session_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_30 "text": "Hello! It's great to see you here! What exciting project or idea are you thinking about diving into today? Whether it's something fresh and innovative or a classic concept with a twist, I'm here to help you get started! Let's brainstorm together!",_30 "files": "[]",_30 "edit": false,_30 "properties": {_30 "text_color": "",_30 "background_color": "",_30 "edited": false,_30 "source": {_30 "id": "OpenAIModel-7AjrN",_30 "display_name": "OpenAI",_30 "source": "gpt-4o-mini"_30 },_30 "icon": "OpenAI",_30 "allow_markdown": false,_30 "positive_feedback": null,_30 "state": "complete",_30 "targets": []_30 },_30 "category": "message",_30 "content_blocks": []_30 }_30]
删除消息
根据ID删除特定消息。
此示例删除在前面的 GET /messages
示例中检索到的消息。
_10curl -v -X DELETE \_10 "$LANGFLOW_URL/api/v1/monitor/messages" \_10 -H "accept: */*" \_10 -H "Content-Type: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY" \_10 -d '["MESSAGE_ID_1", "MESSAGE_ID_2"]'
结果
_10204 No Content
更新消息
根据ID更新特定消息。
此示例更新消息 3ab66cc6-c048-48f8-ab07-570f5af7b160
的 text
值。
_10curl -X PUT \_10 "$LANGFLOW_URL/api/v1/monitor/messages/3ab66cc6-c048-48f8-ab07-570f5af7b160" \_10 -H "accept: application/json" \_10 -H "Content-Type: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY" \_10 -d '{_10 "text": "testing 1234"_10}'
结果
_25{_25 "timestamp": "2024-12-23T18:49:06",_25 "sender": "string",_25 "sender_name": "string",_25 "session_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_25 "text": "testing 1234",_25 "files": ["string"],_25 "error": true,_25 "edit": true,_25 "properties": {_25 "text_color": "string",_25 "background_color": "string",_25 "edited": false,_25 "source": { "id": "string", "display_name": "string", "source": "string" },_25 "icon": "string",_25 "allow_markdown": false,_25 "positive_feedback": true,_25 "state": "complete",_25 "targets": []_25 },_25 "category": "message",_25 "content_blocks": [],_25 "id": "3ab66cc6-c048-48f8-ab07-570f5af7b160",_25 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a"_25}
更新会话ID
更新消息的会话ID。
此示例将 session_ID
值 01ce083d-748b-4b8d-97b6-33adbb6a528a
更新为 different_session_id
。
_10curl -X PATCH \_10 "$LANGFLOW_URL/api/v1/monitor/messages/session/01ce083d-748b-4b8d-97b6-33adbb6a528a?new_session_id=different_session_id" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
结果
_30[_30 {_30 "id": "8dd7f064-e63a-4773-b472-ca0475249dfd",_30 "flow_id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_30 "timestamp": "2024-12-23 18:49:55 UTC",_30 "sender": "User",_30 "sender_name": "User",_30 "session_id": "different_session_id",_30 "text": "message",_30 "files": "[]",_30 "edit": false,_30 "properties": {_30 "text_color": "",_30 "background_color": "",_30 "edited": false,_30 "source": {_30 "id": null,_30 "display_name": null,_30 "source": null_30 },_30 "icon": "",_30 "allow_markdown": false,_30 "positive_feedback": null,_30 "state": "complete",_30 "targets": []_30 },_30 "category": "message",_30 "content_blocks": []_30 }_30]
按会话删除消息
删除特定会话的所有消息。
_10curl -X DELETE \_10 "$LANGFLOW_URL/api/v1/monitor/messages/session/different_session_id_2" \_10 -H "accept: */*" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
结果
_10HTTP/1.1 204 No Content
获取事务
检索特定流的所有事务,即组件之间的交互。
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/monitor/transactions?flow_id=$FLOW_ID&page=1&size=50" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
结果
_19{_19 "items": [_19 {_19 "timestamp": "2024-12-23T20:05:01.061Z",_19 "vertex_id": "string",_19 "target_id": "string",_19 "inputs": {},_19 "outputs": {},_19 "status": "string",_19 "error": "string",_19 "flow_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",_19 "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"_19 }_19 ],_19 "total": 0,_19 "page": 1,_19 "size": 1,_19 "pages": 0_19}