Skip to content

LLM 토큰 사용량 집계를 위한 TokenUtils 유틸리티 모듈 분리 #116

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

Closed
ParkGyeongTae opened this issue May 24, 2025 · 1 comment
Assignees

Comments

@ParkGyeongTae
Copy link
Contributor

Lang2SQL 애플리케이션에서 LLM 응답 메시지들의 토큰 사용량을 집계하는 기능을 별도의 유틸리티 모듈로 분리합니다.

주요 변경 사항

  • TokenUtils 유틸리티 클래스를 llm_utils/token_utils.py에 정의
  • input_tokens, output_tokens, total_tokens를 각각 합산하여 반환하는 get_token_usage_summary 정적 메서드 구현
  • 모듈 및 클래스 수준 docstring 추가 (역할, 사용 예시, 반환 포맷 설명 포함)

작업 목적

  • 코드 재사용성 향상
  • LLM 응답 처리 책임 분리
  • 토큰 사용량 기반 비용 추적 및 로깅 기능 확장을 위한 기반 마련

향후 고려 사항

  • 토큰 사용량 기반 비용 계산 기능 (TokenCostCalculator) 추가 가능성
  • 메시지 포맷 종류(OpenAI, Anthropic 등)에 따른 처리 분기 로직 확장 고려
@ehddnr301
Copy link
Collaborator

#117

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

No branches or pull requests

2 participants