A streaming text delta that repeats everything streamed so far is missing from the recorded turn
メンテナーはふだん 1 日以内に返信
@cpsievert がすでに取り組んでいます。
2026年9月14日 から。
評価
調査の方向性
提供された ChatCompletionChunk の再現を使用して、繰り返される delta がどのように蓄積および記録されるかを追跡しながら、OpenAICompletionsProvider.stream_merge_chunks と stream_turn から始めます。["\n", "\n", "Here is the answer."] とその他の例を対象とするリグレッションテストを追加し、記録された turn がストリーミングされた完全なテキストと一致することを確認します。
索引モデルが issue の本文から書いたものです。
説明
If a streamed response contains a text delta identical to everything streamed before it, that delta does not make it onto the assistant turn. The caller watches the right text go by, and the turn that gets stored, and sent back as history on the next request, is short by one delta.
The easy case is a response starting with two identical deltas, which is what a leading "\n\n" often looks like coming off a local model.
No API key needed for this, it drives the completions provider's streaming contract:
from openai.types.chat import ChatCompletionChunk
from chatlas._provider_openai_completions import OpenAICompletionsProvider
provider = OpenAICompletionsProvider(api_key="unused", model="gpt-4o-mini")
def chunk(text, last=False):
return ChatCompletionChunk.model_validate({
"id": "chatcmpl-1",
"object": "chat.completion.chunk",
"created": 1,
"model": "gpt-4o-mini",
"choices": [{
"index": 0,
"delta": {"role": "assistant", "content": text},
"finish_reason": "stop" if last else None,
}],
})
deltas = ["\n", "\n", "Here is the answer."]
completion = None
for i, d in enumerate(deltas):
completion = provider.stream_merge_chunks(completion, chunk(d, last=i == len(deltas) - 1))
turn = provider.stream_turn(completion, has_data_model=False)
print("streamed:", repr("".join(deltas)))
print("turn: ", repr(turn.text))
streamed: '\n\nHere is the answer.'
turn: '\nHere is the answer.'
I expected both to be '\n\nHere is the answer.'.
It is not just the first two deltas. ["ab", "c", "abc"] streams abcabc and records abc, while ["ab", "c", "ab"] comes out fine, so it seems to bite when the new delta equals the whole accumulation so far.
chatlas at 7b3aa569, openai 3.13.0, python 3.12.14. Everything built on OpenAICompletionsProvider shares that call, so ChatOllama(), ChatGroq(), ChatDeepSeek() and ChatOpenRouter() are in the same boat. I found it driving the provider rather than a live model, so I cannot say how often a real stream lands on it.
- 主要言語
- Python
- スター
- 179
- フォーク
- 32
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 10
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
posit-dev/chatlas のほかの issue
-
ai-triage:needs-review documentation
難易度 2/5 1〜2日 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
ai-triage:done Priority: Low
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
ai-triage:done Priority: Medium
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
posit-dev/chatlas#432 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
posit-dev/chatlas の issue をすべて見る
似ている issue
-
bot-triaged module: decompositions module: edge cases module: int overflow module: primTorch oncall: pt2 triage review
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
country:US rating:6 request-theme type:TV SHOW
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
LizardByte/ThemerrDB#10501 · コメント 1 件 ·
-
triage/confirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
agentscope-ai/agentscope#4563 ·
メンテナーはふだん 2 日以内に返信
-
comp/desktop desktop/chat P3 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
NousResearch/hermes-agent#164451 ·
メンテナーはふだん 1 日以内に返信
-
external integration integration-submission
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
langchain-ai/docs#8426 ·
メンテナーはふだん 1 日以内に返信