Phase 0.7 — Acceptance Gate 자동화 + LM Studio 통합 + OntoCast 버그 수정
- platform/ → ont_platform/ rename
Python 내장 platform 모듈과 이름 충돌. numpy/scipy가 platform.machine() 호출 시
우리 패키지를 가져와 AttributeError. ont_platform으로 변경하고 pyproject.toml,
ont_platform/**, tests/** import 경로 모두 업데이트.
- ont_platform/config.py: lenient LLM builder 추가
LM Studio/vLLM 등 OpenAI-호환 로컬 서버가 임의 모델 식별자(예: deepseek-r1-distill-
qwen-7b)를 쓸 수 있도록 OntoCast의 OpenAIModel enum validation을 Pydantic
model_construct로 우회. ToolConfig() 생성 시 충돌을 막기 위해 LLM_MODEL_NAME을
잠시 비웠다가 lenient 인스턴스로 교체.
- ont_platform/api/deps.py: ToolBox 초기화를 asyncio.to_thread로 격리
LLMTool.create()가 내부에서 asyncio.run()을 부르는데 lifespan/테스트가 이미
async 컨텍스트라 이중 loop 충돌. 별도 스레드에서 sync 생성자 실행.
- 테스트 인프라 정비
* tests/integration/test_api_smoke.py: TestClient 구버전 starlette 호환을 위해
lifespan='off' 대신 app.router.lifespan_context = noop 패턴 적용.
* tests/unit/test_convert_document.py, test_select_ontology.py: ontocast.agent
__init__.py가 re-export한 함수가 서브모듈을 가리는 문제로 sys.modules에서
실제 모듈 객체 직접 추출.
* tests/e2e/conftest.py: .env 자동 로드 + provider별 skip 조건 (Ollama는
LLM_API_KEY 불필요).
* tests/e2e/test_phase0_full_pipeline.py: provider별 키 분기,
HDBSCAN 클러스터링이 동작하도록 fixture 페이로드 16문장으로 확장.
- vendored OntoCast 버그 수정 3건 (VENDORED_MODIFICATIONS.md 기록):
* agent/render_ontology.py: render_ontology_fresh()의 .format() 호출에 누락된
ontology_prefix 인자 추가 (Bootstrap 단계에서 KeyError: 'ontology_prefix').
* stategraph/node_factories.py: render_ontology/render_facts 노드의
state.model_copy(deep=True)로 budget_tracker가 deep-copy되어 root state의
BudgetTracker가 영원히 0인 채로 남던 버그 수정. 원본 인스턴스 공유로 변경.
- 문서 갱신
README.md (Phase 0.7 부분완료 + ont_platform 폴더 이름),
docs/phases/PHASE0_ACCEPTANCE_GATE.md (검증 이력 + Ollama/LM Studio 옵션),
.env.example (LM Studio/Ollama/OpenAI 세 옵션 명시).
검증
- unit + integration 26/26 통과.
- e2e (LM Studio + Qwen3-8B / DeepSeek-R1-Distill-Qwen-7B): 워크플로우 끝까지
실행 + 5번 LLM 호출 + LangGraph 전 노드 traceable 확인. 7-8B 로컬 모델은
strict structured output(Turtle RDF in JSON) 한계로 ontology/facts TTL 자동
생성 부분 성공. 클라우드 LLM 환경에서 재검증 필요.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,16 +6,19 @@
|
||||
|
||||
| # | Acceptance Gate 항목 | 상태 | 검증 방법 |
|
||||
|---|---|---|---|
|
||||
| 1 | 단일 PDF/JSON 입력 → ontology TTL + facts TTL이 filesystem에 생성됨 | ⚠️ **코드 준비 완료, 실행 검증 보류** | `tests/e2e/test_phase0_full_pipeline.py`가 검증하나 LLM_API_KEY/Python 환경 필요 |
|
||||
| 2 | `/health`, `/info`, `/process` (FastAPI) 정상 동작 | ✅ **코드 작성 + 통합 테스트 통과 예상** | `tests/integration/test_api_smoke.py` 11개 케이스 |
|
||||
| 3 | BudgetTracker가 LLM call/triple count를 정확히 기록 | ⚠️ **코드 준비 완료, 실 LLM 호출 검증 보류** | 통합 테스트는 mock 검증, e2e 테스트가 실제 검증 |
|
||||
| 1 | 단일 PDF/JSON 입력 → ontology TTL + facts TTL이 filesystem에 생성됨 | ⚠️ **e2e 검증 대기** (로컬 LLM/API 키 필요) | `tests/e2e/test_phase0_full_pipeline.py` |
|
||||
| 2 | `/health`, `/info`, `/process` (FastAPI) 정상 동작 | ✅ **통합 테스트 10/10 통과** (2026-05-14) | `tests/integration/test_api_smoke.py` |
|
||||
| 3 | BudgetTracker가 LLM call/triple count를 정확히 기록 | ⚠️ **e2e 검증 대기** (mock 검증은 통합 테스트로 통과) | e2e 테스트가 실제 검증 |
|
||||
| 4 | LangGraph 워크플로우 (CONVERT→CHUNK→...→SERIALIZE) 전 노드 traceable | ✅ **OntoCast 원본 워크플로우 무수정 채택** | `vendored/ontocast/ontocast/stategraph/` 그대로 사용 |
|
||||
|
||||
⚠️ **현재 환경에서 자동 실행이 안 되는 이유**:
|
||||
1. 시스템에 Python 인터프리터가 설치되어 있지 않음 (`python.exe`가 Microsoft Store 별칭만 있음, `py` 없음)
|
||||
2. LLM API 키가 환경변수에 없음
|
||||
추가로 **단위 테스트 16/16 통과** (test_convert_document 7, test_platform_config 5, test_select_ontology 4).
|
||||
|
||||
따라서 **다음 작업자(또는 운영 환경)에서 아래 절차를 한 번 실행하여 4개 체크박스를 모두 통과 처리해야 한다**. 코드는 준비 완료.
|
||||
**현재 진척 (2026-05-14)**:
|
||||
- Python 3.13.13 환경 + `pip install -e ".[dev]"` 완료
|
||||
- `pip install -e vendored/ontocast` 로 OntoCast 의존성 설치 완료
|
||||
- 패키지 이름 충돌 수정: `platform/` → `ont_platform/` (Python 내장 `platform` 모듈과 충돌)
|
||||
- 단위 + 통합 테스트 26/26 모두 통과
|
||||
- **남은 작업**: e2e 테스트 (Acceptance Gate #1, #3) 실행 — 로컬 Ollama 또는 OpenAI 키 필요
|
||||
|
||||
## 다음 작업자가 실행할 검증 절차
|
||||
|
||||
@@ -54,8 +57,20 @@ pytest tests/unit tests/integration -v
|
||||
|
||||
### 3) End-to-end 검증 (Acceptance Gate #1, #3, #4)
|
||||
|
||||
LLM 호출이 실제로 일어남. OpenAI는 비용 발생, Ollama는 로컬에서 무료.
|
||||
|
||||
```powershell
|
||||
# LLM 호출이 일어남. 실 비용 발생.
|
||||
# (A) Ollama 로컬 사용 (권장 — 비용 무료)
|
||||
# 사전: Ollama 설치 후 `ollama pull qwen2.5`
|
||||
$env:LLM_PROVIDER = "ollama"
|
||||
$env:LLM_MODEL_NAME = "qwen2.5"
|
||||
$env:LLM_BASE_URL = "http://localhost:11434"
|
||||
pytest tests/e2e -m e2e -v
|
||||
|
||||
# (B) OpenAI 사용
|
||||
$env:LLM_PROVIDER = "openai"
|
||||
$env:LLM_MODEL_NAME = "gpt-4o-mini"
|
||||
$env:LLM_API_KEY = "sk-..."
|
||||
pytest tests/e2e -m e2e -v
|
||||
```
|
||||
|
||||
@@ -70,7 +85,7 @@ pytest tests/e2e -m e2e -v
|
||||
|
||||
```powershell
|
||||
# 서버 기동
|
||||
uvicorn platform.api.main:app --reload
|
||||
uvicorn ont_platform.api.main:app --reload
|
||||
|
||||
# 다른 셸에서
|
||||
curl http://localhost:8000/health
|
||||
@@ -100,4 +115,5 @@ curl -X POST http://localhost:8000/process `
|
||||
| 일자 | 검증자 | 결과 |
|
||||
|---|---|---|
|
||||
| 2026-05-13 | (코드 작성: ontology-platform agent) | 코드 준비 완료. 실 환경 검증 보류. |
|
||||
| 2026-05-14 | lasta + Claude | **unit 16/16, integration 10/10 통과** (Gate #2 ✅). 패키지 이름 충돌 수정 (`platform`→`ont_platform`). e2e는 LLM 필요로 대기. |
|
||||
| ____-__-__ | ________________ | __________________________________ |
|
||||
|
||||
Reference in New Issue
Block a user