Skip to content

feat : prompt 개선 및 로직 수정#25

Merged
SoTaeHo merged 3 commits intomainfrom
feat/modify-prompt
Dec 21, 2025
Merged

feat : prompt 개선 및 로직 수정#25
SoTaeHo merged 3 commits intomainfrom
feat/modify-prompt

Conversation

@SoTaeHo
Copy link
Member

@SoTaeHo SoTaeHo commented Dec 21, 2025

#️⃣ 연관된 이슈

AI 운동 루틴 요청 시 요일과 정확히 매칭되지 않는 이슈 (#23)

📝 작업 내용

  • 프롬프트를 수정하여 중복되는 요일이 있는 운동 프로그램의 경우 해당 요일에도 프로그램을 매핑하도록 변경하였습니다.
  • 추가로 영어로 프롬프트를 작성하여 토큰 수 절감 및 성능 향상을 유도하였습니다.

💬 리뷰 요구사항

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요


@Bumnote Bumnote self-requested a review December 21, 2025 16:56
Copy link
Member

@Bumnote Bumnote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

프롬프트 수정 및 로직 개선하느라 고생많으셨습니다 !

private final Semaphore llmSemaphore = new Semaphore(5);

public WeeklyRecommendResponse createWeeklyPlan(RecommendLLMRequest request) {
StopWatch stopWatch = new StopWatch("LLM_Generation_Task");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AOP 방식도 있을텐데, StopWatch를 사용하는 이유가 있을까요? 메서드 내 작업단위마다 측정하기 위해서 일까요 !?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. AOP는 메서드 단위로 동작하기 때문에, 메서드 내 어느 부분에서 시간이 오래걸리는지는 확인하기 어렵다.
  2. AOP는 public method에서만 동작하기 때문에 private으로 되어있는 convertToRecommendProgramData 내에서 병목지점을 파악하기 힘들다.

와 같은 이유가 있다고 찾았는데, 혹시 잘못된 내용있으면 수정 부탁드립니다!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오호 새로운 사실을 알게 되었습니다 :>

)
.getContent();

log.info("programs size: {}", programs.size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기존에 협의했던 코드 포맷인 구글 형식이 아닌 것 같습니다.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

죄송합니다. IDE 설정이 풀려있었습니다. 재설정하여 올리겠습니다.

List<Program> programEntities = programRepository.findAllById(programIds);
stopWatch.stop();

// Map 변환
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 주석은 필요 없어보입니다.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기초적인 주석은 빼도록 하겠습니다 ;ㅅ;


// 2. 배치 조회 측정
stopWatch.start("Bulk DB Fetch (findAllById)");
List<Program> programEntities = programRepository.findAllById(programIds);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

매번 findById 하지 않고, findAllById로 모두 불러온 다음에 Map 형식으로 O(1) 접근하는 방식이 정말 인상적입니다 :>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

program을 50개씩만 가져오지만, 그래도 N + 1 문제를 해결해보았다는 점에서 많은 공부를 해봤습니다.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저 또한, 공부가 된 것 같습니다 :> 고생하셨습니다 !

@Bumnote Bumnote linked an issue Dec 21, 2025 that may be closed by this pull request
4 tasks
@SoTaeHo SoTaeHo merged commit 49a2376 into main Dec 21, 2025
2 checks passed
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.

[Dev] 2차 QA 진행

2 participants