[Feature] Return actual prompt token IDs in opt-in Anthropic non-stream responses
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 1/100
調査の方向性
Implementation PR #5232 is linked and already provides the requested behavior. Review that PR and the named regression tests, test_messages_non_stream_with_output_ids_and_routed_experts and test_messages_non_stream_does_not_add_prompt_ids_without_opt_in, to see how the response includes prompt IDs only when requested. Done means the PR is merged or its changes are otherwise present.
索引モデルが issue の本文から書いたものです。
説明
Motivation
Please expose the actual inference prompt token IDs in Anthropic non-streaming /v1/messages responses when the existing LMDeploy extension return_token_ids=true is requested.
The endpoint currently exposes output_ids under this flag, but does not include prompt_token_ids. For agentic RL trajectory recording, we need both the actual prompt IDs and generated IDs to align the recorded actions with the backend sequence. Re-tokenizing rendered messages is not a reliable substitute, especially with tool messages, chat templates, and image expansion.
This is a request for an opt-in LMDeploy extension, not a requirement of the standard Anthropic API.
Reproduction and expected behavior
Against an LMDeploy server with a supported model loaded:
curl http://localhost:23333/v1/messages \
-H 'Content-Type: application/json' \
-H 'anthropic-version: 2023-06-01' \
-d '{
"model": "<served-model-name>",
"max_tokens": 16,
"stream": false,
"messages": [{"role": "user", "content": "Hi"}],
"return_token_ids": true
}'
Actual: the response includes output_ids, but omits prompt_token_ids.
Expected: also include prompt_token_ids from chat_runner.prompt_token_ids, preserving the backend's actual prompt sequence. When the flag is omitted or false, keep the current response shape and omit this extra field.
Related resources
Implementation PR: #5232, head b828647add4711a703b2d1a9a9c96dce79e140a3.
The PR reuses IDs already available on the chat runner; it adds a response field and conditional serialization rather than introducing another tokenizer path. Endpoint regression tests cover opt-in prompt IDs and default omission:
test_messages_non_stream_with_output_ids_and_routed_expertstest_messages_non_stream_does_not_add_prompt_ids_without_opt_in
Scope is non-streaming responses. Our current OpenAI-compatible rollout path is unaffected; this request is for the Anthropic trajectory-recording path.
- 主要言語
- Python
- スター
- 8.2k
- フォーク
- 797
- 平均マージ
- 3日 15時間
- マージ済み PR(30日)
- 52
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
InternLM/lmdeploy のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 2 日以内に返信
-
[Bug] apply_rotary_pos_emb: leaves output tails unwritten with partial rotation対応中かも @shotsan が 15 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
[Bug] PyTorch engine ignores use_rslora, so rsLoRA adapters run sqrt(r) times too weak対応中かも @Andreas-Hum が 25 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
[Feature] Expose `max_model_len` (session_len) in `/v1/models` model card対応中かも @FOWEPJF255 が 37 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 2 日以内に返信
InternLM/lmdeploy の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
Techiebutler/freeframe#687 ·
メンテナーはふだん 1 日以内に返信
-
bug verbose GC
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
IBM/javacore-analyser#677 ·
メンテナーはふだん 1 日以内に返信
-
area/config comp/plugins P1 platform/qqbot tool/file type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
NousResearch/hermes-agent#163932 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
plugins/dsh: todayStr() computes UTC but is documented as local — journal entries written 00:00–08:00 local land in the previous day's file対応中かも @Beehtrix が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
zilliztech/memsearch#907 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
external
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
langchain-ai/docs#8386 ·
メンテナーはふだん 1 日以内に返信