ENHANCEMENT:Reduce unnecessary LLM API calls

Đang mở
#241 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

@vaishcodescape đang làm issue này rồi.

Từ ngày 15/1/2026.

  • #242 của @vaishcodescape — đã đóng, không merge
  • #243 của @vaishcodescape — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
ai, performance

Hướng nghiên cứu

Bắt đầu tại ClassificationRouter.should_process_message và kiểm tra lời gọi llm.ainvoke hiện tại cùng luồng phân loại thông điệp xung quanh. Xác định các bài kiểm thử liên quan hoặc bổ sung kiểm thử cho các thông điệp phổ biến đã được chuẩn hóa, việc phân loại lặp lại, thời điểm hết hạn bộ nhớ đệm và các chỉ số sử dụng; công việc được xem là hoàn tất khi các thông điệp đơn giản hoặc đã được lưu trong bộ nhớ đệm tránh được các lời gọi LLM không cần thiết, còn những thông điệp khác vẫn giữ nguyên hành vi hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Is your feature request related to a problem?
  • Yes, it is related to a problem
Describe the feature you'd like

🌟 Feature Description

Reduce unnecessary LLM API calls in the message classification system by adding smart caching and simple pattern matching.

This feature will:

  • Detect common messages (e.g. greetings, thanks, acknowledgments) without calling the LLM
  • Cache previous LLM classification results using an LRU cache with TTL
  • Normalize messages (lowercase, trim spaces, etc.) to improve cache hits
  • Track basic metrics to measure cache usage and saved LLM calls

🔍 Problem Statement

Currently, the ClassificationRouter makes an LLM API call for every single Discord message, even for very simple or repeated messages.

This leads to:

  • Unnecessary API usage increasing
  • Increased latency
  • Higher operational costs
Current Behavior
async def should_process_message(self, message: str, context: Dict[str, Any] = None):
    response = await self.llm.ainvoke([HumanMessage(content=triage_prompt)])

Every incoming message triggers the LLM, regardless of whether it is:

  • A simple greeting like “hi”
  • A repeated message
  • A non-actionable acknowledgment

🎯 Expected Outcome

After this enhancement:

  • Simple messages are handled using pattern matching
  • Repeated messages reuse results from the cache
  • LLM calls are made only when truly needed
  • Overall performance and efficiency improve significantly

This will reduce API calls, lower costs, and make the system faster and more scalable.

Record
  • I agree to follow this project's Code of Conduct
  • I want to work on implementing this feature
Ngôn ngữ chính
Python
Star
103
Fork
143
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AOSSIE-Org/Devr.AI

Tất cả issue của AOSSIE-Org/Devr.AI

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.