feat: expose logical conversation rounds over flat turn history

オープン
#394 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python

調査の方向性

chatlas/_chat.py の get_turns()、get_last_turn()、および partial-turn ヘルパーから始め、次に chatlas/_turn.py の turn 型と partial_reason を調べます。比較対象として Ellmer のコミット 59bbe9d4 を確認し、ツールループと system または partial turn の公開名とセマンティクスを確定して、フラットストレージや provider のシリアライゼーションを変更せずに、一覧にある交換および履歴のケースをカバレッジに追加します。

索引モデルが issue の本文から書いたものです。

説明

ai-triage:done Priority: Low

Why this matters

Chatlas stores a flat sequence of SystemTurn, UserTurn, and AssistantTurn objects. A single user request that invokes tools can span several user/assistant turns, making transcript review, UIs, and tracing consumers reconstruct the logical exchange themselves.

Ellmer added a read-only Round abstraction in tidyverse/ellmer#1056 (59bbe9d4): each round starts with input turn(s) and includes the assistant/tool-result turns that follow. Storage remains flat.

Scope

  • Design and add a public, read-only Python API that groups current history into logical conversation rounds without changing how turns are stored or submitted to providers.
  • Include a clear definition for tool loops, system turns, and partial assistant turns.
  • Provide an ergonomic way to retrieve all rounds and the final round.
  • Ensure returned round objects preserve the original turns rather than duplicating provider state.
  • Add tests for ordinary exchanges, multiple tool-result cycles, system-prompt inclusion, manually supplied history where supported, and interrupted/partial responses.

Starting points

  • chatlas/_chat.py: get_turns(), get_last_turn(), and partial-turn helpers.
  • chatlas/_turn.py: SystemTurn, UserTurn, AssistantTurn, and partial_reason.
  • Chat.get_turns(tool_result_role="assistant") already offers display-oriented collapsing, but it is not a round API.
  • Ellmer reference: git -C ../ellmer show 59bbe9d4.

Non-goals

  • Do not replace the flat internal history or alter provider serialization.
  • Do not add mutation APIs such as set_rounds() without a separate design decision.

Design note

This is a public API addition. Settle names, object shape, and system-turn semantics before implementation; the ellmer behavior is a useful reference, not a requirement to mirror verbatim.

主要言語
Python
スター
179
フォーク
32
平均マージ
1日 3時間
マージ済み PR(30日)
10

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

posit-dev/chatlas のほかの issue

posit-dev/chatlas の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。