docs: 임베딩 서비스 포트 번호 수정 및 문서 업데이트

- skill-embedding 포트 8015 -> 8515로 수정
- 로빙 컨테이너 경량화 전략 문서 업데이트
- 함수형 프로그래밍 가이드라인 개선
- 트러블슈팅 문서들 오타 및 포맷 수정
This commit is contained in:
happybell80 2025-08-20 16:51:41 +09:00
parent 25212bf473
commit 18ac5845b4
11 changed files with 29 additions and 29 deletions

View File

@ -121,7 +121,7 @@
#### 구현 내용
- **서비스명**: skill-embedding
- **포트**: 8015
- **포트**: 8515
- **모델**: multilingual-MiniLM-L12-v2 (ONNX)
- **API**: FastAPI 기반 REST API
@ -129,7 +129,7 @@
```python
class HTTPEmbeddingFunction(EmbeddingFunction):
def __init__(self):
self.url = f"{os.getenv('SKILL_EMBEDDING_URL', 'http://localhost:8015')}/embed"
self.url = f"{os.getenv('SKILL_EMBEDDING_URL', 'http://localhost:8515')}/embed"
def __call__(self, input: List[str]) -> List[List[float]]:
if not input:

View File

@ -49,7 +49,7 @@
│ rb8001 │ │ rb8001 │ │ skill-embedding │
│ ONNX Model │ → │ (200MB) │──│ (874.4MB) │
│ (416MB) │ └─────────────┘ │ - ONNX Model │
└─────────────┘ │ - Port 8015 │
└─────────────┘ │ - Port 8515 │
▼ └─────────────────┘
┌─────────────┐ ┌─────────────┐
│ rb10408 │ │ rb10408 │
@ -112,7 +112,7 @@ embedder = ONNXEmbedder("/models/onnx/...") # 449MB 모델 로드
class HTTPEmbeddingFunction(EmbeddingFunction):
def __init__(self):
# 임베딩 서비스 URL (환경변수로 설정 가능)
self.url = f"{os.getenv('SKILL_EMBEDDING_URL', 'http://localhost:8015')}/embed"
self.url = f"{os.getenv('SKILL_EMBEDDING_URL', 'http://localhost:8515')}/embed"
def __call__(self, input: List[str]) -> List[List[float]]:
# 텍스트를 서비스로 보내고 벡터 받아오기
@ -139,7 +139,7 @@ self.episodic = self.client.get_or_create_collection(
# 환경변수 추가
environment:
- SKILL_EMBEDDING_URL=http://localhost:8015
- SKILL_EMBEDDING_URL=http://localhost:8515
```
## 성능 분석
@ -175,7 +175,7 @@ rb10408 | 55MB | 30MB | -25MB (45%↓)
- 에러율
# 헬스체크
curl http://localhost:8015/health
curl http://localhost:8515/health
```
## 다음 단계

View File

@ -42,7 +42,7 @@ date: 2025-07-04
| **순수 함수** | ✅ 테스트 가능 | ✅ 테스트 가능 |
| **외부 서비스** | ❌ 접근 불가 | ✅ 모두 연결 |
| **데이터베이스** | ❌ 서버 데이터 | ✅ 실제 데이터 |
| **스킬 서비스** | ❌ 포트 8015 없음 | ✅ skill-embedding 실행 |
| **스킬 서비스** | ❌ 포트 8515 없음 | ✅ skill-embedding 실행 |
### 2.2 함수형 프로그래밍의 장점 활용
@ -63,7 +63,7 @@ emotion = EmotionState(valence=0.5, arousal=0.3)
```python
# ❌ I/O 함수들 - 외부 서비스 필요
- ChromaDB 쿼리 (서버 persistent storage)
- skill-embedding:8015 (79MB ONNX 모델)
- skill-embedding:8515 (79MB ONNX 모델)
- Gemini/Mistral API (API 키 필요)
- Slack 웹훅 (실제 워크스페이스)
```

View File

@ -111,7 +111,7 @@ rb10508_micro
| **이메일 스킬** | ✅ 연동 (포트 8501) | ✅ 연동 (포트 8501) |
| **뉴스 스킬** | ✅ 연동 (포트 8505) | ✅ 연동 (포트 8505) |
| **슬랙 스킬** | ✅ 연동 (포트 8503) | ❌ 미연동 |
| **임베딩 서비스** | ❌ 자체 처리 | ✅ 외부 서비스 (포트 8015) |
| **임베딩 서비스** | ❌ 자체 처리 | ✅ 외부 서비스 (포트 8515) |
| **스킬 라우팅** | Decision Engine 기반 | 미구현 |
| **스킬 실행 전략** | Stats 기반 추천 | 수동 호출 |
@ -203,7 +203,7 @@ class HTTPEmbeddingFunction:
**skill-embedding - 중앙화된 임베딩 서비스**
```python
# 독립 실행 서비스 (포트 8015)
# 독립 실행 서비스 (포트 8515)
# 모든 서비스가 공유
# 928MB 메모리 상시 사용
# 6일간 안정적 운영 중
@ -369,7 +369,7 @@ class HTTPEmbeddingFunction:
| **skill_email** | 8501 | 운영 중 (6일) | 이메일 조회/발송 | rb10408, rb10508 |
| **skill-news** | 8505 | 정상 (2시간) | 뉴스 검색/요약 | rb10408, rb10508 |
| **skill-slack** | 8503 | 정상 (2시간) | Slack 메시지 처리 | rb10408만 |
| **skill-embedding** | 8015 | 정상 (6일) | 텍스트 임베딩 생성 | rb10508만 |
| **skill-embedding** | 8515 | 정상 (6일) | 텍스트 임베딩 생성 | rb10508만 |
### 스킬 통합 개선 방안

View File

@ -93,7 +93,7 @@ rb10508_micro의 AI 응답 단조로움 문제를 해결하기 위한 캐시 기
### 기본 원칙
- 최소한의 코드 수정으로 최대 효과
- skill-embedding 서비스 활용 (포트 8015)
- skill-embedding 서비스 활용 (포트 8515)
- 점진적 구현으로 리스크 최소화
---

View File

@ -87,7 +87,7 @@ embedder = SentenceTransformer(model_name)
# 변경 (skill-embedding 서비스 사용)
from http_embedding_function import HTTPEmbeddingFunction
embedding_function = HTTPEmbeddingFunction("http://localhost:8015")
embedding_function = HTTPEmbeddingFunction("http://localhost:8515")
```
### 3. 모델 마운트

View File

@ -169,7 +169,7 @@ response = await loop.run_in_executor(
```
✅ ChromaDB 권한: 999:999 정상
✅ 디스크 공간: 369G 사용 가능 (충분)
✅ skill-embedding: 8015 포트 정상 작동
✅ skill-embedding: 8515 포트 정상 작동
✅ rb10508_micro: 126.2MiB, healthy
```
@ -340,7 +340,7 @@ if settings.USE_CONVERSATION_CACHE:
2. **skill-embedding URL 오설정**
- httpbin.org로 변경하여 Phase 3 테스트 차단
- 올바른 설정: `SKILL_EMBEDDING_URL=http://172.17.0.1:8015`
- 올바른 설정: `SKILL_EMBEDDING_URL=http://172.17.0.1:8515`
3. **Docker 컨테이너 재생성 오류 반복**
```bash

View File

@ -23,7 +23,7 @@
### 서비스 설계 및 개발
**주요 결정사항**:
1. **포트 번호**: 8600 → 8015 (스킬 서비스 포트 범위)
1. **포트 번호**: 8600 → 8515 (스킬 서비스 포트 범위)
2. **서비스 이름**: embedding_service → skill-embedding
3. **접근 방식**: 내부 전용 (nginx 프록시 불필요)
@ -55,7 +55,7 @@ chown -R 999:999 /home/admin/ivada_project/onnx_models
# 환경변수 설정
cat > .env << EOF
PORT=8015
PORT=8515
SERVICE_NAME=skill-embedding
LOG_LEVEL=INFO
MODEL_PATH=/models/onnx/multilingual-MiniLM-L12-v2
@ -78,17 +78,17 @@ docker system prune -a -f
```bash
# 컨테이너 상태
CONTAINER ID IMAGE STATUS PORTS NAMES
abc123def skill-embedding Up 25 seconds 8015/tcp skill-embedding
abc123def skill-embedding Up 25 seconds 8515/tcp skill-embedding
# 메모리 사용량
skill-embedding: 874.4MB (예상 범위 내)
# API 테스트
curl http://localhost:8015/health
curl http://localhost:8515/health
{"status":"healthy","service":"skill-embedding","model":"multilingual-MiniLM-L12-v2","uptime":25.31}
# 임베딩 테스트
curl -X POST http://localhost:8015/embed \
curl -X POST http://localhost:8515/embed \
-H "Content-Type: application/json" \
-d '{"texts":["테스트"]}'
# 384차원 벡터 정상 반환
@ -101,7 +101,7 @@ curl -X POST http://localhost:8015/embed \
**HTTPEmbeddingFunction 구현**:
```python
class HTTPEmbeddingFunction(EmbeddingFunction):
def __init__(self, embedding_service_url="http://localhost:8015"):
def __init__(self, embedding_service_url="http://localhost:8515"):
self.url = f"{embedding_service_url}/embed"
def __call__(self, texts):
@ -144,7 +144,7 @@ class HTTPEmbeddingFunction(EmbeddingFunction):
## 현재 상태
**skill-embedding 서비스**:
- ✅ 정상 가동 중 (포트 8015)
- ✅ 정상 가동 중 (포트 8515)
- ✅ 메모리 사용량 안정적 (874.4MB)
- ✅ API 응답 정상
- ✅ 384차원 임베딩 생성 확인
@ -165,7 +165,7 @@ class HTTPEmbeddingFunction(EmbeddingFunction):
# memory.py에 간단한 HTTPEmbeddingFunction 추가
class HTTPEmbeddingFunction(EmbeddingFunction):
def __init__(self):
self.url = f"{os.getenv('SKILL_EMBEDDING_URL', 'http://localhost:8015')}/embed"
self.url = f"{os.getenv('SKILL_EMBEDDING_URL', 'http://localhost:8515')}/embed"
def __call__(self, input: List[str]) -> List[List[float]]:
if not input:

View File

@ -50,7 +50,7 @@ app/
### 하드코딩 검출 결과
**높은 우선순위**:
- `localhost:8015` (embedding URL)
- `localhost:8515` (embedding URL)
- `gemini-2.5-flash-lite` (모델명)
- `postgresql://`, `redis://` (DB URL)
- `10508` (포트)
@ -194,7 +194,7 @@ collection.query(
```
**문제 메커니즘**:
1. 저장: HTTPEmbeddingFunction → skill-embedding:8015 → 특정 벡터
1. 저장: HTTPEmbeddingFunction → skill-embedding:8515 → 특정 벡터
2. 검색: 기본 ONNX 모델 → 다른 벡터 → 매칭 실패
3. 첫 실행 시 79.3MB 모델 다운로드 (20초)
@ -258,7 +258,7 @@ results = collection.query(
- 잘못된 설정이 계속 유지됨
3. **ONNX 모델 위치의 중요성**
- 중앙 서비스(8015): 1개 모델 공유
- 중앙 서비스(8515): 1개 모델 공유
- 각 로빙: 개별 모델 다운로드 (79.3MB × N)
4. **성능 문제 디버깅**

View File

@ -51,7 +51,7 @@ ONNX 변환 완료:
skill-embedding 서비스 분석 결과:
- `/app/embedder.py`: ONNXEmbedder 클래스 이미 구현됨
- `/app/http_embedding_function.py`: HTTPEmbeddingFunction 클래스 구현됨
- 포트 8015에서 실행 중
- 포트 8515에서 실행 중
별도 유틸리티 파일 생성 불필요함을 확인.
@ -109,7 +109,7 @@ async def analyze_emotion(request: TextRequest):
async def analyze_basic_emotions(text: str) -> List[float]:
"""skill-embedding 서비스 호출"""
response = await http_client.post(
"http://skill-embedding:8015/emotion",
"http://skill-embedding:8515/emotion",
json={"text": text}
)
return response.json()["emotions"]

View File

@ -105,7 +105,7 @@ app/core/emotion/
# 실제 사양
- 모델: multilingual-MiniLM-L12-v2 (ONNX)
- 차원: 384차원
- 포트: 8015
- 포트: 8515
- 기능: 텍스트 → 벡터 변환만 (감정 분류 X)
```