Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

feat(review): pluggable per-model tokenizer for exact token counts

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

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
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
Ít trao đổi
Công nghệ
java
Lĩnh vực
ai, backend-api-design

Hướng nghiên cứu

Start by reading the implementation of the TokenCounter interface and the per-model configuration introduced by issues #53 and #50. Then inspect langchain4j's built-in estimators for OpenAI, Anthropic, and Gemini and how the budgeter uses them. Done means matching models use their provider estimator, unmatched models fall back to jtokkit, and self-calibration from API token usage continues.

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

Mô tả

enhancement java

Problem

The large-diff token budgeting (#53) ships with a single jtokkit (OpenAI BPE) encoding as the estimate for all providers, self-calibrated from the usage.prompt_tokens the API echoes back. That's exact for OpenAI models but approximate for others (e.g. DeepSeek/Gemini/Anthropic use different vocabularies). For closer budgeting on non-OpenAI models, make the estimator pluggable.

Proposed (enhancement — jtokkit stays the default)

  • Keep the TokenCounter interface introduced by #53; the default stays jtokkit (OpenAI BPE) for any model without a better estimator.
  • Reuse langchain4j's built-in per-provider token estimators rather than rolling our own — langchain4j already ships estimators for OpenAI, Anthropic, and Gemini. Wire the matching one behind TokenCounter, keyed by the configured model/provider, for better estimates on those specific models.
  • Fall back to jtokkit when no provider estimator matches; the budgeter keeps self-calibrating from usage.prompt_tokens regardless, so estimates only improve.

No conflict with #53

This plugs in behind the same TokenCounter interface #53 introduces — #53 ships jtokkit-default; #239 swaps in the langchain4j per-provider estimator per model. Nothing in #53 changes.

Depends on

#53 — introduces TokenCounter + the jtokkit default + the per-model config surface (#50). Post-v0.3.0 enhancement.

Ngôn ngữ chính
Java
Star
35
Fork
7
Merge trung bình
9 giờ 37 phút
Pull request đã merge (30 ngày)
148

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

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 devops-thiago/ThrillhouseBot

Tất cả issue của devops-thiago/ThrillhouseBot

Issue tương tự

Thêm issue về Java

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.