ENHANCEMENT:Reduce unnecessary LLM API calls
@vaishcodescape 已经在做这个了。
开始于 2026年1月15日。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- ai, performance
调研方向
从 ClassificationRouter.should_process_message 入手,检查当前的 llm.ainvoke 调用及其周围的消息分类流程。找出相关测试,或为规范化的常见消息、重复分类、缓存过期和使用指标添加测试覆盖;完成标准是简单消息或缓存命中的消息避免不必要的 LLM 调用,同时其他消息保持现有行为。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Python
- 星标
- 103
- 派生
- 143
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AOSSIE-Org/Devr.AI 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 95/100
AOSSIE-Org/Devr.AI#315 · 1 条评论 ·
-
Bump Weaviate image to 1.39.13 (Go 1.26.10 / CVE-2026-111943)可能已有人在做 @dudanogueira 于 38 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
AOSSIE-Org/Devr.AI#309 · 1 条评论 ·
-
DOCS UPDATE: Incorrect Flask command path in backend installation guide可能已有人在做 @Ashwin-Pillai-22 于 321 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 68/100
AOSSIE-Org/Devr.AI#229 · 3 条评论 ·
-
BUG:Devr.AI Agent loses user_profile for returning users and fails to persist conversation summaries & cumulative interaction counts可能已有人在做 @shubhumre777 于 34 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 55/100
AOSSIE-Org/Devr.AI#311 · 2 条评论 ·
-
BUG: Local pytest suite fails to collect due to deprecated imports and mock schemas可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 25/100
AOSSIE-Org/Devr.AI#307 · 1 条评论 ·
查看 AOSSIE-Org/Devr.AI 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
pimutils/vdirsyncer#1242 ·
-
priority:P2
难度 2/5 1-3 小时 新手友好度 75/100
QuantConnect/lean-cli#792 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
open-webui/open-webui#35360 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
-
Suggest link: Destiny Verify (MIT zero-dependency pre-commit security, citation & link hygiene CLI)未关闭
难度 1/5 1 小时以内 新手友好度 68/100