Feature request: allow seeding a new session with conversation history
还没有人认领这个 Issue。
评估
调研方向
从请求中列出的 SessionConfig、CreateSessionAsync 和 SendAsync 入口开始,然后跟踪会话对话状态的初始化方式。当调用方可以在第一次 SendAsync 之前通过 InitialMessages 提供用户和助手的角色/内容对,并且模型将其视为对话历史时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Problem
The Copilot SDK uses a session-based model where the session owns the conversation state. This works well when the SDK controls the full conversation lifecycle, but doesn't fit applications that manage conversation history externally. An example is applications that allow the user or harness to rewind, edit, condense or restructure prior turns.
In these cases, the only option is to format prior messages into the prompt text with role markers like [User] / [Assistant] and explain the convention in the system message. This works but is far from ideal, because the model may not treat text labeled as its own prior output with the same status as actual assistant-role messages, and creates confusion if the user's text includes what could be interpreted as unbalanced delimiters (such as ``` without a closing fence).
The SDK's session resumption feature (ResumeSessionAsync) doesn't help here because the caller needs to be able to arbitrarily reshape the history on every turn.
Proposed solution
Add an InitialMessages property to SessionConfig - a list of role/content pairs that seed the session's conversation history before the first SendAsync call:
var session = await client.CreateSessionAsync (new SessionConfig
{
InitialMessages = new List<SessionMessage>
{
new ("user", "Explain async/await in C#"),
new ("assistant", "Async/await is a pattern for..."),
},
// ...
});
The messages would be treated as real conversation history by the model - not as text stuffed into a user prompt.
Note that the history seed doesn't necessarily have to support every feature of every kind of message. Simply having the ability to specify the role (user/assistant) and text would be incredibly useful.
- 主要语言
- Java
- 星标
- 10.5k
- 派生
- 1.5k
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 131
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/copilot-sdk 的其他 Issue
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 68/100
github/copilot-sdk#2709 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 78/100
github/copilot-sdk#2673 ·
-
bug testing
难度 2/5 1-3 小时 新手友好度 75/100
github/copilot-sdk#2628 ·
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 68/100
github/copilot-sdk#2627 · 1 条评论 ·
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 74/100
github/copilot-sdk#2493 ·
查看 github/copilot-sdk 的全部 Issue
相似的 Issue
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
apache/flink-agents#1152 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100
jenkinsci/blueocean-plugin#5417 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
objectionary/eo-graphs#75 ·