Skip to content

질문 재정의 노드 강화 #61

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

Open
seyoung4503 opened this issue Apr 24, 2025 · 2 comments
Open

질문 재정의 노드 강화 #61

seyoung4503 opened this issue Apr 24, 2025 · 2 comments
Assignees
Labels
agent The core processing component that interprets user input, manages workflows, and orchestrates the SQ enhancement New feature or request retrieval The mechanism responsible for fetching relevant table and column information to enhance SQL generati

Comments

@seyoung4503
Copy link
Contributor

seyoung4503 commented Apr 24, 2025

Why ❓

현재 상황 및 문제점:

#30 과 연관되는 이슈입니다.
질문 재정의 노드를 DB에 더 적합한 형태로 재정의 하기 위해 아래의 방법을 제안합니다.
아이디어는 snowflake의 문서를 참고했습니다.

How 🤔

해결 방안 ✅:

start테이블 정보를 바탕으로 질문 재정의feature extractioncontext enrichmenthuman feedback

1. 테이블 정보를 바탕으로 질문 재정의

유저가 질문하면, 테이블 정보를 바탕으로 구체화된 질문을 생성합니다.
#40 에서 언급주셨던 것 처럼 "Case1) 질문을 처음부터 테이블 정보를 보고 재정의할 것인가?" 를 사용하면
더욱 적절한 테이블을 참고할 수 있지 않을까라고 생각됩니다.

테이블 정보는 테이블 이름과 desc 정도만 참고하면 좋을 것 같습니다.

2. feature extraction

이후, 구체화된 질문으로부터 특징을 추출합니다.
질문 특징의 경우, 시계열 질문인지, 기간별 질문인지, 특정 조건을 포함했는지 등등 있습니다.

이 질문특징은 json parser를 사용해 어떤 조건이 필요할지 추출하면 좋을 것 같아요!

{
  "is_timeseries": true,              # 시계열 분석이 필요한 질문인지 여부 (예: 최근 30일, 월별 등)
  "is_aggregation": true,             # 집계 함수(SUM, AVG 등)가 필요한 질문인지 여부
  "has_filter": true,                 # WHERE 또는 조건 필터가 필요한 질문인지 여부
  "is_grouped": true,                 # 그룹화(GROUP BY)가 필요한 질문인지 여부 (예: 등급별, 카테고리별 등)
  "has_ranking": true,                # 정렬 또는 순위가 필요한 질문인지 여부 (예: TOP 5, 가장 많은 등)
  "has_temporal_comparison": false,   # 기간 간 비교가 포함된 질문인지 여부 (예: 전월 대비, 작년과 비교 등)
  "intent_type": "trend"              # 질문의 주요 의도 유형 (예: trend, lookup, comparison, distribution 등)
}

3. context enrichment

이후 이 조건을 바탕으로 필요한 테이블을 조회하여 구체화된 질문을 생성합니다.

  1. 과거에 생성되었던 유사한 질문을 참고하거나
  2. 조회한 테이블의 메타 데이터 정보를 바탕으로 컬럼 이름을 제대로 들고 옵니다.

예를 들어, '미국'으로 컬럼이름을 잘못 조회하는 경우를 방지하기 위해 테이블 컬럼을 참조해 해당 단어를 'USA'로 변경합니다.

4. human feedback

생성된 구체화된 질문을 사용자가 확인하고, 이대로 생성할 지, 질문을 수정할 지 판단합니다.
질문을 수정한다면 다시 **2. feature extraction** 단계로 돌아가 로직을 처리합니다.

전체 기능은 옵션으로 제공해서 사용자가 선택할 수 있게 할 예정입니다.

What 🛠️

  • 테이블 정보를 바탕으로 질문 재정의 기능
  • feature extraction
  • context enrichment
  • human feedback
  • streamlit 옵션 제공
@seyoung4503 seyoung4503 self-assigned this Apr 24, 2025
@seyoung4503 seyoung4503 added enhancement New feature or request agent The core processing component that interprets user input, manages workflows, and orchestrates the SQ retrieval The mechanism responsible for fetching relevant table and column information to enhance SQL generati labels Apr 24, 2025
@ehddnr301
Copy link
Collaborator

👍 @seyoung4503 님 너무 좋습니다. #52 에서도 제가 요거 관련해서 살짝 변경을 해서 테스트 했었는데요!

사용자 질문 -> get_table_info 로 바로 가는게 체감상 테이블이 더 잘 찾아졌습니다!
스터디 시간에서도 말한것 처럼 재정의된 질문으로 테이블을 찾으니 유저수~ 이런 단어가 포함되면서,
유저관련 테이블이 의도치 않게 찾아진다던지 하는것 같습니다.

감사합니다!!

@seyoung4503
Copy link
Contributor Author

조언 감사합니다 ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent The core processing component that interprets user input, manages workflows, and orchestrates the SQ enhancement New feature or request retrieval The mechanism responsible for fetching relevant table and column information to enhance SQL generati
Projects
None yet
Development

No branches or pull requests

2 participants