Skip to content

[ai-assisted] feat(rag): embedding profile 선택 계약 보강#337

Open
donghyuck wants to merge 2 commits into2.xfrom
codex/rag-embedding-profile-contracts
Open

[ai-assisted] feat(rag): embedding profile 선택 계약 보강#337
donghyuck wants to merge 2 commits into2.xfrom
codex/rag-embedding-profile-contracts

Conversation

@donghyuck
Copy link
Copy Markdown
Owner

Why

  • RAG 색인/검색에서 embedding provider/model/profile을 선택할 수 있어야 합니다.
  • textract/chunking 기반 table/image-caption/OCR chunk가 vector metadata에 embedding input type으로 남아야 합니다.
  • Spring AI 실행 설정과 Studio RAG orchestration 설정의 책임을 분리해 중복 설정 혼란을 줄입니다.

What

  • EmbeddingRequest, RagIndexRequest, RagSearchRequest, RagIndexJobSourceRequest에 embedding 선택 필드를 하위 호환 방식으로 추가했습니다.
  • RagEmbeddingProfileResolver와 starter-ai profile 설정을 추가하고, RAG 색인/검색 pipeline에 provider/model/profile 선택을 연결했습니다.
  • VectorRecord metadata에 embeddingProvider, embeddingModel, embeddingDimension, embeddingProfileId, embeddingInputType을 기록하고 pgvector 검색 metadata filter pushdown을 보강했습니다.
  • starter-ai-web 및 content-embedding-pipeline의 RAG, chat RAG, vector search, attachment RAG DTO mapping을 확장했습니다.
  • structured attachment indexing에서 table/image-caption/OCR chunk를 각각 TABLE_TEXT, IMAGE_CAPTION, OCR_TEXT로 기록하고 request-level embedding field 우선순위를 통일했습니다.
  • README와 계약/컨트롤러/adapter 테스트를 추가했습니다.

Related Issues

Validation

  • Command: ./gradlew :studio-platform-ai:test :starter:studio-platform-starter-ai:test :starter:studio-platform-starter-ai-web:test :starter:studio-platform-starter-chunking:test :studio-application-modules:content-embedding-pipeline:test
  • Result: PASS
  • Command: git diff --check
  • Result: PASS

Risk / Rollback

  • Risk: embedding profile을 명시한 검색은 metadata filter가 추가되므로, 기존에 metadata가 없는 오래된 chunk는 선택 검색에서 제외될 수 있습니다. legacy minimal 요청은 기존 기본 EmbeddingPort 경로를 유지합니다.
  • Rollback: 이 PR을 revert하면 기존 RAG embedding 기본 포트 고정 동작으로 돌아갑니다.

AI / Subagent Usage

  • AI-assisted: Yes
  • Subagent used: Yes
  • Delegated scope: 구현 후 코드 리뷰 2회, resolver precedence/search filter/attachment precedence 검토
  • Main author validation: Gradle 테스트와 git diff --check 실행

Checklist

  • commit message follows policy
  • issue template used or exception recorded
  • AI-Assisted value is correct
  • validation recorded
  • subagent usage recorded when used
  • CI / repository verification passed
  • human review completed before merge
  • no unrelated changes included

Issue:
- #336

Why:
- RAG 색인/검색에서 embedding provider/model/profile을 선택하고 구조화 chunk input type metadata를 보존해야 한다.

What:
- core RAG/embedding request 계약에 embedding profile/provider/model/input type 필드를 하위 호환 방식으로 추가했다.
- starter-ai에 RAG embedding profile resolver와 pipeline wiring을 추가하고 VectorRecord metadata 및 pgvector metadata filter pushdown을 보강했다.
- starter-ai-web과 content-embedding-pipeline DTO/controller mapping을 확장하고 attachment structured/fallback 색인 경로의 embedding 선택을 통일했다.
- table/image-caption/OCR chunk input type metadata와 관련 테스트/문서를 추가했다.

Validation:
- ./gradlew :studio-platform-ai:test :starter:studio-platform-starter-ai:test :starter:studio-platform-starter-ai-web:test :starter:studio-platform-starter-chunking:test :studio-application-modules:content-embedding-pipeline:test : PASS
- git diff --check : PASS
- Subagent review: PASS after fixes
Issue:
- #336

Why:
- 서브에이전트 리뷰에서 Spring AI embedding model 선택 검증, raw vector search selection 검증, legacy default profile 검색 호환성, image/OCR input type 테스트 보강 필요가 확인됐다.

What:
- SpringAiEmbeddingAdapter가 request/profile model과 실제 구성 model 불일치를 거부하도록 보강했다.
- /vectors/search precomputed embedding 경로도 explicit embedding selection을 resolver로 검증하고 resolved metadata filter를 적용하도록 보강했다.
- minimal legacy RAG 검색에는 default profile metadata filter를 강제하지 않아 기존 metadata 없는 chunk 조회 호환성을 유지했다.
- IMAGE_CAPTION/OCR_TEXT input type 기록 테스트와 관련 문서를 보강했다.

Validation:
- ./gradlew :starter:studio-platform-starter-ai:test --tests 'studio.one.platform.ai.autoconfigure.adapter.SpringAiEmbeddingAdapterTest' --tests 'studio.one.platform.ai.service.pipeline.RagPipelineServiceTest' :starter:studio-platform-starter-ai-web:test --tests 'studio.one.platform.ai.web.controller.VectorControllerTest' : PASS
- ./gradlew :studio-platform-ai:test :starter:studio-platform-starter-ai:test :starter:studio-platform-starter-ai-web:test :starter:studio-platform-starter-chunking:test :studio-application-modules:content-embedding-pipeline:test : PASS
- git diff --check : PASS
- Subagent review: 보완 완료
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant