| """๊ณต์ ๊ด๋ จ tools - downstream ์์กด์ฑ + WIP + yield baseline |
| |
| ์ค fab์์ MES + Yield Management System์์ ์กฐํ๋๋ ๊ฐ |
| """ |
| from data.wip import get_affected_wip |
|
|
| |
| |
| _DOWNSTREAM = { |
| "Photo": [ |
| ("Etch", 18, "impacted"), |
| ("CMP", 5, "minor"), |
| ], |
| "Etch": [ |
| ("CMP", 15, "impacted"), |
| ("Diffusion", 3, "minor"), |
| ], |
| "CMP": [ |
| ("Diffusion", 8, "impacted"), |
| ("Implant", 12, "impacted"), |
| ("Test", 6, "minor"), |
| ], |
| "Diffusion": [ |
| ("Implant", 10, "impacted"), |
| ("Metal", 4, "minor"), |
| ], |
| "Implant": [ |
| ("Metal", 7, "impacted"), |
| ("Test", 5, "minor"), |
| ], |
| } |
|
|
| |
| _YIELD_BASELINE = { |
| "Photo": 96.4, |
| "Etch": 95.8, |
| "CMP": 96.1, |
| "Diffusion": 97.2, |
| "Implant": 96.7, |
| } |
|
|
|
|
| def get_downstream_steps(current_stage: str) -> dict: |
| """ํ์ฌ ๊ณต์ ์ดํ๋ก ์ํฅ ๋ฐ๋ ํ๊ณต์ ๋ชฉ๋ก ๋ฐํ |
| |
| ๊ฐ ํ๊ณต์ ์ ๋ํด typical delta(%, ์ํฅ ๊ฐ๋)์ severity(impacted/minor) ์ ๊ณต |
| """ |
| deps = _DOWNSTREAM.get(current_stage, []) |
| return { |
| "current_stage": current_stage, |
| "downstream": [ |
| {"stage": s, "typical_delta_pct": d, "severity": sev} |
| for s, d, sev in deps |
| ], |
| } |
|
|
|
|
| def query_wip_status(alarm_id: str) -> dict: |
| """์๋์ผ๋ก ์ํฅ ๋ฐ๋ WIP(๊ฐ๊ณต์คยท๋๊ธฐ์ค) lot ์ + wafer ์ ์กฐํ""" |
| lots = get_affected_wip(alarm_id) |
| return {"alarm_id": alarm_id, "wip": lots} |
|
|
|
|
| def get_yield_baseline(process: str) -> dict: |
| """๊ณต์ ์ ์ต๊ทผ 30์ผ yield ๊ธฐ์ค์ (%) ๋ฐํ |
| |
| ์ด์ ๋ฐ์ ์ baseline ๋๋น yield_loss ๊ณ์ฐ์ ์ฌ์ฉ |
| """ |
| baseline = _YIELD_BASELINE.get(process) |
| if baseline is None: |
| return {"error": f"๋ฑ๋ก๋์ง ์์ ๊ณต์ : {process}"} |
| return {"process": process, "baseline_yield_pct": baseline, "window": "์ต๊ทผ 30์ผ"} |
|
|
|
|
| SCHEMA_DOWNSTREAM = { |
| "type": "function", |
| "function": { |
| "name": "get_downstream_steps", |
| "description": ( |
| "ํ์ฌ ๊ณต์ ์ดํ ์ํฅ ๋ฐ๋ ํ๊ณต์ ๋ชฉ๋ก์ ๋ฐํํฉ๋๋ค. " |
| "๊ฐ ํ๊ณต์ ์ ์ผ๋ฐ์ ์ํฅ ๊ฐ๋(typical_delta_pct)์ severity(impacted/minor)๋ฅผ ํฌํจ. " |
| "Tier 3 ์ํฅ ํ๊ฐ์์ downstream_dependencies ์ฐ์ถ์ ์ฌ์ฉํ์ธ์." |
| ), |
| "parameters": { |
| "type": "object", |
| "properties": { |
| "current_stage": { |
| "type": "string", |
| "description": "ํ์ฌ ๊ณต์ (Photo, Etch, CMP, Diffusion, Implant ์ค)", |
| }, |
| }, |
| "required": ["current_stage"], |
| }, |
| }, |
| } |
|
|
| SCHEMA_WIP = { |
| "type": "function", |
| "function": { |
| "name": "query_wip_status", |
| "description": ( |
| "์๋์ผ๋ก ์ํฅ ๋ฐ๋ WIP(๊ฐ๊ณต์คยท๋๊ธฐ์ค) lot/wafer ์๋ฅผ MES์์ ์กฐํํฉ๋๋ค. " |
| "Tier 3 impact_lots ํ๋๋ฅผ ์ฑ์ธ ๋ ์ฌ์ฉํ์ธ์." |
| ), |
| "parameters": { |
| "type": "object", |
| "properties": { |
| "alarm_id": { |
| "type": "string", |
| "description": "์๋ ID (A1, A2, A3)", |
| }, |
| }, |
| "required": ["alarm_id"], |
| }, |
| }, |
| } |
|
|
| SCHEMA_YIELD = { |
| "type": "function", |
| "function": { |
| "name": "get_yield_baseline", |
| "description": ( |
| "๊ณต์ ์ ์ต๊ทผ 30์ผ yield ๊ธฐ์ค์ (%)์ ์กฐํํฉ๋๋ค. " |
| "yield_loss๋ฅผ baseline ๋๋น๋ก ์ ๋ํํ ๋ ์ฌ์ฉํ์ธ์." |
| ), |
| "parameters": { |
| "type": "object", |
| "properties": { |
| "process": { |
| "type": "string", |
| "description": "๊ณต์ ์ด๋ฆ (Photo, Etch, CMP, Diffusion, Implant)", |
| }, |
| }, |
| "required": ["process"], |
| }, |
| }, |
| } |
|
|