msgconv

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildUIMessage

func BuildUIMessage(p UIMessageParams) map[string]any

BuildUIMessage builds the complete com.beeper.ai UIMessage payload.

func BuildUIMessageMetadata

func BuildUIMessageMetadata(p UIMessageMetadataParams) map[string]any

BuildUIMessageMetadata builds the metadata map for a com.beeper.ai UIMessage.

func MapFinishReason

func MapFinishReason(reason string) string

MapFinishReason normalizes provider-specific finish reasons to standard values.

func MergeUIMessageMetadata

func MergeUIMessageMetadata(base, update map[string]any) map[string]any

MergeUIMessageMetadata deep-merges UI message metadata maps so callers can safely layer incremental usage/timing updates onto existing state.

Types

type UIMessageMetadataParams

type UIMessageMetadataParams struct {
	TurnID           string
	AgentID          string
	Model            string
	FinishReason     string
	CompletionID     string
	PromptTokens     int64
	CompletionTokens int64
	ReasoningTokens  int64
	TotalTokens      int64
	StartedAtMs      int64
	FirstTokenAtMs   int64
	CompletedAtMs    int64
	IncludeUsage     bool
}

UIMessageMetadataParams contains parameters for building UI message metadata.

type UIMessageParams

type UIMessageParams struct {
	TurnID     string
	Role       string // "assistant", "user"
	Metadata   map[string]any
	Parts      []map[string]any
	SourceURLs []map[string]any // Optional source-url and source-document parts
	FileParts  []map[string]any // Optional generated file parts
}

UIMessageParams contains parameters for building a full com.beeper.ai UIMessage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL