MCPcopy Create free account
hub / github.com/rilldata/rill / NewTextCompletionMessage

Function NewTextCompletionMessage

runtime/ai/ai.go:1548–1559  ·  view source on GitHub ↗

NewTextCompletionMessage is a utility function for creating a text completion message.

(role Role, content string)

Source from the content-addressed store, hash-verified

1546
1547// NewTextCompletionMessage is a utility function for creating a text completion message.
1548func NewTextCompletionMessage(role Role, content string) *aiv1.CompletionMessage {
1549 return &aiv1.CompletionMessage{
1550 Role: string(role),
1551 Content: []*aiv1.ContentBlock{
1552 {
1553 BlockType: &aiv1.ContentBlock_Text{
1554 Text: content,
1555 },
1556 },
1557 },
1558 }
1559}
1560
1561// maybeTruncateMessages keeps recent messages and a few early ones for context.
1562// It's a simple placeholder strategy. In the future, we'll enhance this with AI summarization.

Callers 6

HandlerMethod · 0.85
HandlerMethod · 0.85
CompleteMethod · 0.85
HandlerMethod · 0.85
predictAttributionMethod · 0.85
HandlerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected