diff options
Diffstat (limited to 'libpanto-go/panto.go')
| -rw-r--r-- | libpanto-go/panto.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libpanto-go/panto.go b/libpanto-go/panto.go index 95e0cbd..5bfc5d8 100644 --- a/libpanto-go/panto.go +++ b/libpanto-go/panto.go @@ -621,6 +621,25 @@ func (b *MessageBuilder) AddSystem(text string, mode SystemMode) error { return nil } +// SetIdentity attaches the wire identity (provider style/baseURL/model + +// reasoning) that produced this message. This is the per-message source of +// truth for replaying thinking signatures and is preserved through compaction, +// so a kept-verbatim turn is not re-stamped with the compaction model. Prefer +// this over per-block origins on AddThinking when rebuilding a conversation for +// resumption: set it from PersistentMessage's APIStyle/BaseURL/Model and the +// thinking signatures replay correctly without copying the identity onto every +// thinking block. +func (b *MessageBuilder) SetIdentity(style APIStyle, baseURL, model string, reasoning ReasoningEffort) error { + cb := C.CString(baseURL) + defer C.free(unsafe.Pointer(cb)) + cm := C.CString(model) + defer C.free(unsafe.Pointer(cm)) + if C.panto_message_builder_set_identity(b.ptr, C.PantoAPIStyle(style), cb, cm, C.PantoReasoningEffort(reasoning)) != C.PANTO_OK { + return lastError() + } + return nil +} + // Destroy frees an uncommitted builder. Safe to call after AddMessage (no-op). func (b *MessageBuilder) Destroy() { if b != nil && b.ptr != nil { |
