Prepare requests with captured conversation history

This commit is contained in:
2026-11-14 01:16:38 +00:00
parent fcd0485340
commit 26530808e0
10 changed files with 136 additions and 3 deletions

29
exchange.go Normal file
View File

@@ -0,0 +1,29 @@
package promptkit
import "go.maximumdirect.net/promptkit/internal/domain"
const exchangeString = "promptkit.Exchange{opaque}"
// Exchange is an immutable, in-process snapshot of a completed conversation.
type Exchange struct{ internal *domain.Exchange }
// ExchangeDetails contains a detached copy of an exchange's logical history.
type ExchangeDetails struct {
RunID string `json:"run_id"`
ParentRunID string `json:"parent_run_id,omitempty"`
Messages []RenderedMessage `json:"messages"`
}
// Details returns detached history, or zero details for an empty handle.
func (e *Exchange) Details() ExchangeDetails {
if e == nil || e.internal == nil {
return ExchangeDetails{}
}
return ExchangeDetails{RunID: e.internal.RunID(), ParentRunID: e.internal.ParentRunID(), Messages: fromDomainRenderedMessages(e.internal.Messages())}
}
// String returns an opaque representation without conversation content.
func (e Exchange) String() string { return exchangeString }
// GoString returns an opaque representation without conversation content.
func (e Exchange) GoString() string { return exchangeString }