-
Notifications
You must be signed in to change notification settings - Fork 5
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
The head ref may contain hidden characters: "feature/61-\uC9C8\uBB38-\uC7AC\uC815\uC758-\uB178\uB4DC-\uAC15\uD654"
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
70a72f8
docs : .gitignore table_info_db 추가
seyoung4503 f347482
feat(graph): add profile‑aware query‑refiner chain
seyoung4503 b423bfc
feat(chains): add QuestionProfile model and profile‑extraction chain
seyoung4503 885e3f5
feat(graph) : PROFILE_EXTRACTION 노드 추가 사용자의 질문 특징을 정의된 유형에 따라 추출
seyoung4503 5e5accd
feat(graph) : CONTEXT_ENRICHMENT 노드 추가 refined된 질문에서 테이블 정보를 정렬하는 노드
seyoung4503 ffd9dc8
feat(graph): query_refiner_with_profile_node 추가 \
seyoung4503 7837996
feat(enriched_graph) : 프로파일 추출, 컨텍스트 보강 노드를 추가한 새로운 그래프 파일을 추가
seyoung4503 9e0318d
feat(streamlit) : 사이드 바에 프로파일 추출 & 컨텍스트 보강 워크플로우 사용 체크박스 추가, 그래프 연결
seyoung4503 4b41c96
refactor : context_enrichment_node, query_refiner_with_profile_node, …
seyoung4503 0a510e6
refactor : query_enrichment_chain 만들고 context_enrichment_node에 연결
seyoung4503 1707d46
refactor : profile_extraction_prompt, query_enrichment_prompt 마크다운으로 분리
seyoung4503 5e97671
Merge branch 'master' into feature/61-질문-재정의-노드-강화
ehddnr301 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ test_lhm/ | |
.cursorignore | ||
.vscode | ||
table_info_db | ||
ko_reranker_local | ||
ko_reranker_local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import json | ||
|
||
from langgraph.graph import StateGraph, END | ||
from llm_utils.graph import ( | ||
QueryMakerState, | ||
GET_TABLE_INFO, | ||
PROFILE_EXTRACTION, | ||
QUERY_REFINER, | ||
CONTEXT_ENRICHMENT, | ||
QUERY_MAKER, | ||
get_table_info_node, | ||
profile_extraction_node, | ||
query_refiner_with_profile_node, | ||
context_enrichment_node, | ||
query_maker_node, | ||
) | ||
|
||
""" | ||
기본 워크플로우에 '프로파일 추출(PROFILE_EXTRACTION)'과 '컨텍스트 보강(CONTEXT_ENRICHMENT)'를 | ||
추가한 확장된 그래프입니다. | ||
""" | ||
|
||
# StateGraph 생성 및 구성 | ||
builder = StateGraph(QueryMakerState) | ||
builder.set_entry_point(GET_TABLE_INFO) | ||
|
||
# 노드 추가 | ||
builder.add_node(GET_TABLE_INFO, get_table_info_node) | ||
builder.add_node(QUERY_REFINER, query_refiner_with_profile_node) | ||
builder.add_node(PROFILE_EXTRACTION, profile_extraction_node) | ||
builder.add_node(CONTEXT_ENRICHMENT, context_enrichment_node) | ||
builder.add_node(QUERY_MAKER, query_maker_node) | ||
|
||
# 기본 엣지 설정 | ||
builder.add_edge(GET_TABLE_INFO, PROFILE_EXTRACTION) | ||
builder.add_edge(PROFILE_EXTRACTION, QUERY_REFINER) | ||
builder.add_edge(QUERY_REFINER, CONTEXT_ENRICHMENT) | ||
builder.add_edge(CONTEXT_ENRICHMENT, QUERY_MAKER) | ||
|
||
# QUERY_MAKER 노드 후 종료 | ||
builder.add_edge(QUERY_MAKER, END) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
def profile_to_text(profile_obj) -> str: | ||
mapping = { | ||
"is_timeseries": "• 시계열 분석 필요", | ||
"is_aggregation": "• 집계 함수 필요", | ||
"has_filter": "• WHERE 조건 필요", | ||
"is_grouped": "• GROUP BY 필요", | ||
"has_ranking": "• 정렬/순위 필요", | ||
"has_temporal_comparison": "• 기간 비교 필요", | ||
} | ||
bullets = [ | ||
text for field, text in mapping.items() if getattr(profile_obj, field, False) | ||
] | ||
intent = getattr(profile_obj, "intent_type", None) | ||
if intent: | ||
bullets.append(f"• 의도 유형 → {intent}") | ||
|
||
return "\n".join(bullets) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Role | ||
|
||
You are an assistant that analyzes a user question and extracts the following profiles as JSON: | ||
- is_timeseries (boolean) | ||
- is_aggregation (boolean) | ||
- has_filter (boolean) | ||
- is_grouped (boolean) | ||
- has_ranking (boolean) | ||
- has_temporal_comparison (boolean) | ||
- intent_type (one of: trend, lookup, comparison, distribution) | ||
|
||
# Input | ||
|
||
Question: | ||
{question} | ||
|
||
# Output Example | ||
|
||
The output must be a valid JSON matching the QuestionProfile schema. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 분리 등을 잘 고려해서 만들면 더 확장성 있는 형태를 만들 수 있을것 같은데 지금상태로도 너무 좋습니다 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
의견 감사합니다!
제안주신대로 추후에 확장하면 더욱 좋을것 같아요 🤩