Documentation
¶
Index ¶
- func AppendUIMessageArtifacts(uiMessage map[string]any, sourceParts, fileParts []map[string]any) map[string]any
- func BuildPlainMessageContent(p PlainMessageContentParams) *event.Content
- func BuildUIMessage(p UIMessageParams) map[string]any
- func BuildUIMessageMetadata(p UIMessageMetadataParams) map[string]any
- func ContentParts(textContent, reasoningContent string) []map[string]any
- func ConvertAIResponse(p AIResponseParams) (*bridgev2.ConvertedMessage, error)
- func MapFinishReason(reason string) string
- func MergeUIMessageMetadata(base, update map[string]any) map[string]any
- func RelatesToReplace(initialEventID id.EventID, replyTo id.EventID) map[string]any
- func RelatesToThread(threadRoot id.EventID, replyTo id.EventID) map[string]any
- func ToolCallPart(tc bridgeadapter.ToolCallMetadata, providerToolType string, ...) map[string]any
- func ToolCallParts(toolCalls []bridgeadapter.ToolCallMetadata, ...) []map[string]any
- type AIResponseParams
- type PlainMessageContentParams
- type UIMessageMetadataParams
- type UIMessageParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendUIMessageArtifacts ¶
func AppendUIMessageArtifacts(uiMessage map[string]any, sourceParts, fileParts []map[string]any) map[string]any
AppendUIMessageArtifacts appends source/file parts to an existing UIMessage.
func BuildPlainMessageContent ¶
func BuildPlainMessageContent(p PlainMessageContentParams) *event.Content
BuildPlainMessageContent builds event content for a plain assistant text message.
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 ContentParts ¶
ContentParts builds the standard text + reasoning parts for a UIMessage.
func ConvertAIResponse ¶
func ConvertAIResponse(p AIResponseParams) (*bridgev2.ConvertedMessage, error)
ConvertAIResponse converts AI response parameters into a bridgev2 ConvertedMessage. This is the shared conversion path for non-streaming final messages.
func MapFinishReason ¶
MapFinishReason normalizes provider-specific finish reasons to standard values.
func MergeUIMessageMetadata ¶
MergeUIMessageMetadata deep-merges message-level metadata maps.
func RelatesToReplace ¶
RelatesToReplace builds a m.relates_to payload for an edit (m.replace) event.
func RelatesToThread ¶
RelatesToThread builds a m.relates_to payload for threading with fallback reply.
func ToolCallPart ¶
func ToolCallPart(tc bridgeadapter.ToolCallMetadata, providerToolType string, successStatus, deniedStatus string) map[string]any
ToolCallPart builds a single AI SDK UIMessage dynamic-tool part from tool call metadata.
func ToolCallParts ¶
func ToolCallParts(toolCalls []bridgeadapter.ToolCallMetadata, providerToolType, successStatus, deniedStatus string) []map[string]any
ToolCallParts builds AI SDK UIMessage dynamic-tool parts from a list of tool call metadata.
Types ¶
type AIResponseParams ¶
type AIResponseParams struct {
Content string
FormattedContent string
ReplyToEventID id.EventID
Metadata UIMessageMetadataParams
ThinkingContent string
ToolCalls []bridgeadapter.ToolCallMetadata
PortalModel string // Fallback model from portal metadata
// Tool type constants from the connector package
ProviderToolType string
SuccessStatus string
DeniedStatus string
// DB metadata to attach
DBMetadata any
}
AIResponseParams contains parameters for converting an AI response to a ConvertedMessage. Used by both OpenAIRemoteMessage.ConvertMessage and new AIRemoteMessage types.
type PlainMessageContentParams ¶
type PlainMessageContentParams struct {
Text string
RelatesTo map[string]any
UIMessage map[string]any
LinkPreviews []map[string]any
}
PlainMessageContentParams contains parameters for building a plain text message.
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.