Chat session: add `session.reset()` for stateless single-turn requests

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

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

@barhanc がすでに取り組んでいます。

2026年11月27日 から。

評価

この issue はまだ評価されていません。

説明

feature request
Problem description

There is no way to clear a chat session. resetOnTurn: true sounds like it, but (as documented) it only forces full re-encoding: the session keeps the history and re-prefills all of it on every turn. Sending the same prompt four times gave 19, 45, 71 and 97 prefilled tokens. For independent single-turn requests (extraction, classification, benchmarks) the only way to get a clean context is to dispose and recreate the session.

Proposed solution

A session.reset() method that clears the history and KV cache back to initialMessages without reloading the model (react-native-litert-lm has resetConversation() for this), or an option that drops each turn from history after it completes. It would also help to state in the docs that resetOnTurn keeps and re-prefills the full history.

Alternative solutions

No response

Benefits to React Native ExecuTorch

Stateless requests are a common use of small on-device models, and recreating the session costs a model reload.

Additional context

No response

主要言語
TypeScript
スター
1.8k
フォーク
102
平均マージ
2日 6時間
マージ済み PR(30日)
46

環境構築

はじめの一歩

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

software-mansion/react-native-executorch のほかの issue

software-mansion/react-native-executorch の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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