512. 조건 노드 플로 만들기 (Create a flow with a condition node)
- 원문: English
- 위치: Additional capabilities › Flows › Create and design a flow › Try example flows › Create a flow with a condition node
한 줄 요약
조건 노드 하나로 입력 JSON의 가격·유형을 평가해 3개 출력 노드 중 하나(“don’t buy” / “buy” / “undecided”)로 보내는 예제입니다. 조건은 순서대로 평가되고 먼저 충족된 조건이 우선합니다.
핵심 내용
구성
| 요소 | 설정 |
|---|
| 시작용 Prompt 노드 | 삭제 |
| Flow input | Type = Object |
| Condition 입력 | retailPrice(Number, $.data.retailPrice), marketPrice(Number, $.data.marketPrice), type(String, $.data.type) |
| 조건 1 | (retailPrice > 10) and (type == "produce") → 출력 1 |
| 조건 2 | (retailPrice < marketPrice) → 출력 2 |
| default | → 출력 3 |
| 출력 노드 1/2/3 | String, $.data.action[0] / [1] / [2] |
- Flow input 출력을 조건 노드 3개 입력과 세 출력 노드의
document 입력 모두에 연결합니다.
테스트 결과
입력 (action은 ["don't buy","buy","undecided"] 공통) | 충족 조건 | 결과 |
|---|
retailPrice: 11, marketPrice: 12, type: "produce" | 1, 2 모두 → 1 우선 | don't buy |
retailPrice: 11, marketPrice: 12, type: "meat" | 2 | buy |
retailPrice: 11, marketPrice: 11, type: "meat" | 없음 → default | undecided |
SA 관점
- 조건 노드는 데이터를 변형하지 않고 그대로 라우팅만 합니다. 그래서 출력 노드가 원본 입력에서 직접 값을 뽑는 구조입니다. 분기 후 가공이 필요하면 분기마다 Prompt/Lambda 노드를 두세요.