Skip to content

Feature/61 질문 재정의 노드 강화 #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 22, 2025

Conversation

seyoung4503
Copy link
Contributor

#️⃣ Issue Number

📝 요약(Summary)

#61 이슈에서 워크플로우를 살짝 수정했습니다.
기존 흐름:

  • startprofile extractionquery refinementcontext enrichmentquery maker

새로운 흐름:

  • startprofile extraction테이블 정보를 바탕으로 질문 재정의context enrichmenthuman feedback

  • profile extraction: 자연어 쿼리로부터 질문 유형(Profile)을 추출합니다.

  • context enrichment: refined_question, profiles, related_tables 정보를 이용하여 자연어 질문을 보강합니다.

추가 내용:

  • enriched_graph.py 파일에 새로운 워크플로우를 생성했습니다.
  • streamlit 페이지의 왼쪽 상단에 체크 박스를 두어 새로운 워크플로우를 사용할 수 있습니다.

개선할 점:
현재 human feedback은 구현되지 않았습니다. 또한, human feedback 노드와 함께, Streamlit에서 질문을 직접 수정하는 기능도 추가로 구현되어야 합니다.

💬 To Reviewers (선택)

  • startprofile extraction테이블 정보를 바탕으로 질문 재정의context enrichmentquery maker

  • 새로운 워크플로우에 대한 리뷰를 부탁드립니다. 특히, query_refiner_prompt.md를 그대로 사용한 점이 쿼리 결과에 어떤 영향을 미치는지 의견을 부탁드립니다.

    def create_query_refiner_with_profile_chain(llm):
    prompt = get_prompt_template("query_refiner_prompt")
    tool_choice_prompt = ChatPromptTemplate.from_messages(

    이 때문에 생성되는 쿼리가 프롬프트의 예시에 영향을 조금 받는 것 같습니다.
    새로운 프롬프트를 생성하는 것이 더욱 올바른 접근인지 의견부탁드리겠습니다.!!

  • human feedback 노드는 아직 구현되지 않았지만, 해당 노드를 추가할 때의 구조나 문제점에 대한 의견을 부탁드립니다.

  • 코드와 흐름에 개선할 점이 있으면 알려주세요.

PR Checklist

  • 테이블 정보를 바탕으로 질문 재정의 기능
  • feature extraction
  • context enrichment
  • human feedback
  • streamlit 옵션 제공 (질문 수정 기능 제외)

reference) How to Code Review

  • 따봉(👍): 리뷰어가 리뷰이의 코드에서 칭찬의 의견을 남기고 싶을 때 사용합니다.
  • 느낌표(❗): 리뷰어가 리뷰이에게 필수적으로 코드 수정을 요청할 때 사용합니다.
  • 물음표 (❓): 리뷰어가 리뷰이에게 의견을 물어보고 싶을 때 사용합니다.
  • 알약 (💊): 리뷰어가 리뷰이의 코드에서 개선된 방법을 제안하지만 그것의 반영이 필수까지는 아닐 때 사용합니다.

* 신규 함수  추가
  - 사용자 입력·테이블 목록에 질문 프로파일()을 포함하는 프롬프트 조합
  - 구체화 질문 품질 향상 및 LLM 컨텍스트 강화
* Pydantic 모델 `QuestionProfile` 정의
  - 시계열·집계·필터·그룹화·랭킹·기간비교 플래그와 `intent_type` 포함
* `profile_prompt` 템플릿 추가
* `create_profile_extraction_chain()` 함수로 LLM 기반 프로파일 추출 지원
질문 재정의시 특징 정보 활용해 재정의하는 노드 utils.py 안 profile_to_text (질문 특징 정보 프롬프트 추가 함수)
Copy link
Collaborator

@ehddnr301 ehddnr301 left a comment

Choose a reason for hiding this comment

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

👍 Optional 하게 잘 동작합니다.

👍 일자별로 유저수 집계 라는 질문을 남겼을때 아래와 같이 질문의 특성을 잘 뽑아내는것 같습니다 !_!
image

💬 나중에는 복합적이라는 특징을 추가해서 해당 특징을 추출하게되면 다른 Node로 분기시킨다던지 Agent가 참고하게한다던지 해도 재밌을것 같습니다 !_! (divide and conquer 하게되면 문제 해결에 쿼리 생성에 어느정도 좋지않을까... 하는 생각에 적어봤습니다ㅎㅎ)

@@ -65,7 +66,10 @@ def execute_query(
# 세션 상태에서 그래프 가져오기
graph = st.session_state.get("graph")
if graph is None:
graph = builder.compile()
graph_builder = (
enriched_builder if st.session_state.get("use_enriched") else builder
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 이 부분에 대해서는 @seyoung4503 님이 보여주신 enriched_builder 와 @nonegom 님의 state 분리 등을 잘 고려해서 만들면 더 확장성 있는 형태를 만들 수 있을것 같은데 지금상태로도 너무 좋습니다 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

의견 감사합니다!
제안주신대로 추후에 확장하면 더욱 좋을것 같아요 🤩

@ehddnr301 ehddnr301 merged commit 5d41a9a into master May 22, 2025
1 check 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.

2 participants