- 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>
147 lines
4.8 KiB
TOML
147 lines
4.8 KiB
TOML
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[project]
|
|
name = "ontology-platform"
|
|
version = "0.0.1"
|
|
description = "Universal ontology construction platform integrating OntoCast (RDF core), Crawl4AI, Trafilatura, Guardrails, and Neo4j GraphRAG"
|
|
readme = "README.md"
|
|
requires-python = ">=3.12"
|
|
authors = [
|
|
{ name = "Ontology Platform Team" },
|
|
]
|
|
|
|
# Phase별로 필요할 때 주석을 해제하여 활성화한다.
|
|
# 통합설계서 §5 단계별 통합 로드맵 참조.
|
|
dependencies = [
|
|
# ─── Phase 0: Base (OntoCast 의존성) ──────────────────────────────
|
|
# 통합설계서 §11 기술 스택 요약 + OntoCast 분석 §2.2
|
|
"fastapi>=0.115.0",
|
|
"uvicorn[standard]>=0.32.0",
|
|
"pydantic>=2.9.0",
|
|
"pydantic-settings>=2.6.0",
|
|
"python-dotenv>=1.0.1",
|
|
"click>=8.1.7",
|
|
|
|
# LangGraph 워크플로우 (OntoCast 코어 의존성)
|
|
"langgraph>=0.2.40",
|
|
"langchain>=0.3.7",
|
|
"langchain-openai>=0.2.8",
|
|
"langchain-ollama>=0.1.0",
|
|
|
|
# RDF 처리 (OntoCast 코어 의존성)
|
|
"rdflib>=7.1.0",
|
|
"owlready2>=0.46",
|
|
"pyld>=2.0.4",
|
|
"oxrdflib>=0.4.0",
|
|
|
|
# 문서 처리
|
|
"docling>=2.0.0",
|
|
"pypdf>=5.1.0",
|
|
|
|
# 청킹/임베딩 (OntoCast Phase 0에서 사용)
|
|
"langchain-experimental>=0.3.3",
|
|
"sentence-transformers>=3.3.0",
|
|
|
|
# 엔티티 군집화 (OntoCast Entity Aggregation)
|
|
"hdbscan>=0.8.39",
|
|
"umap-learn>=0.5.7",
|
|
"rapidfuzz>=3.10.0",
|
|
|
|
# ─── Phase 1: Trafilatura 통합 ─────────────────────────────────────
|
|
# 통합설계서 §5 Phase 1
|
|
# PHASE0 Acceptance Gate 통과 후 활성화
|
|
# "trafilatura[all]>=2.0.0",
|
|
|
|
# ─── Phase 2: Crawl4AI 통합 ────────────────────────────────────────
|
|
# 통합설계서 §5 Phase 2
|
|
# PHASE1 Acceptance Gate 통과 후 활성화
|
|
# "crawl4ai>=0.4.0",
|
|
|
|
# ─── Phase 3: Guardrails 통합 ──────────────────────────────────────
|
|
# 통합설계서 §5 Phase 3
|
|
# PHASE2 Acceptance Gate 통과 후 활성화
|
|
# Hub/telemetry 비활성화 환경변수 사용 필수 (§10 리스크)
|
|
# "guardrails-ai>=0.5.0",
|
|
|
|
# ─── Phase 4: Neo4j GraphRAG 통합 ──────────────────────────────────
|
|
# 통합설계서 §5 Phase 4
|
|
# PHASE3 Acceptance Gate 통과 후 활성화
|
|
# 버전 고정: experimental API 변경 위험 (Neo4j GraphRAG 분석 §13.1)
|
|
# "neo4j-graphrag[openai,experimental]==1.16.0",
|
|
# "neo4j>=5.18.1,<7",
|
|
|
|
# ─── 운영 인프라 ───────────────────────────────────────────────────
|
|
# Job Queue
|
|
"arq>=0.26.3",
|
|
"redis>=5.2.0",
|
|
|
|
# Postgres (메타데이터)
|
|
"asyncpg>=0.30.0",
|
|
"sqlalchemy[asyncio]>=2.0.36",
|
|
"alembic>=1.14.0",
|
|
|
|
# Object Storage
|
|
"boto3>=1.35.0",
|
|
|
|
# HTTP
|
|
"httpx>=0.27.2",
|
|
"aiohttp>=3.10.10",
|
|
|
|
# 관측
|
|
"structlog>=24.4.0",
|
|
"prometheus-client>=0.21.0",
|
|
"opentelemetry-api>=1.28.0",
|
|
"opentelemetry-sdk>=1.28.0",
|
|
|
|
# 인증
|
|
"authlib>=1.3.2",
|
|
"python-jose[cryptography]>=3.3.0",
|
|
"passlib[bcrypt]>=1.7.4",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
"pytest>=8.3.3",
|
|
"pytest-asyncio>=0.24.0",
|
|
"pytest-cov>=6.0.0",
|
|
"ruff>=0.7.4",
|
|
"mypy>=1.13.0",
|
|
"ipython>=8.29.0",
|
|
"httpx>=0.27.2", # TestClient
|
|
]
|
|
|
|
[project.scripts]
|
|
ontology-platform = "ont_platform.api.main:cli"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["ont_platform"]
|
|
|
|
# ─── Ruff (linter + formatter) ────────────────────────────────────────
|
|
[tool.ruff]
|
|
line-length = 100
|
|
target-version = "py312"
|
|
src = ["ont_platform", "tests"]
|
|
extend-exclude = ["vendored"] # vendored OntoCast 등은 원본 유지
|
|
|
|
[tool.ruff.lint]
|
|
select = ["E", "F", "I", "B", "UP", "RUF"]
|
|
ignore = ["E501"] # line length는 formatter가 처리
|
|
|
|
[tool.ruff.format]
|
|
quote-style = "double"
|
|
indent-style = "space"
|
|
|
|
# ─── Mypy ────────────────────────────────────────────────────────────
|
|
[tool.mypy]
|
|
python_version = "3.12"
|
|
strict = true
|
|
exclude = ["vendored/"]
|
|
|
|
# ─── Pytest ──────────────────────────────────────────────────────────
|
|
[tool.pytest.ini_options]
|
|
asyncio_mode = "auto"
|
|
testpaths = ["tests"]
|
|
filterwarnings = ["ignore::DeprecationWarning"]
|