Documentation
¶
Index ¶
- func ComputeMessagesContextLength(ctx *lmcli.Context, conv *conversation.Conversation, ...) []int
- func FormatForExternalPrompt(messages []conversation.Message, system bool) string
- func LookupConversation(ctx *lmcli.Context, shortName string) *conversation.Conversation
- func LookupConversationE(ctx *lmcli.Context, shortName string) (*conversation.Conversation, error)
- func RenderConversation(ctx *lmcli.Context, messages []conversation.Message, spaceForResponse bool)
- func RenderMessage(ctx *lmcli.Context, m *conversation.Message)
- func RunCompletionLoop(ctx context.Context, appCtx *lmcli.Context, sess *session.Session, ...) error
- func RunSession(cmd *cobra.Command, ctx *lmcli.Context, sess *session.Session)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeMessagesContextLength ¶ added in v0.7.0
func ComputeMessagesContextLength(ctx *lmcli.Context, conv *conversation.Conversation, messages []conversation.Message) []int
ComputeMessagesContextLength computes token counts for messages in a conversation. For system messages, the conversation's agent tools are included in the count. Returns a slice of token counts aligned with the messages slice.
func FormatForExternalPrompt ¶
func FormatForExternalPrompt(messages []conversation.Message, system bool) string
func LookupConversation ¶
func LookupConversation(ctx *lmcli.Context, shortName string) *conversation.Conversation
LookupConversation either returns the conversation found by the short name or exits the program
func LookupConversationE ¶
func LookupConversationE(ctx *lmcli.Context, shortName string) (*conversation.Conversation, error)
func RenderConversation ¶
func RenderConversation(ctx *lmcli.Context, messages []conversation.Message, spaceForResponse bool)
RenderConversation renders the given messages to TTY, with optional space for a subsequent message. spaceForResponse controls how many '\n' characters are printed immediately after the final message (1 if false, 2 if true). Message blocks are built in parallel for faster rendering.
func RenderMessage ¶
func RenderMessage(ctx *lmcli.Context, m *conversation.Message)
func RunCompletionLoop ¶ added in v0.7.0
func RunCompletionLoop( ctx context.Context, appCtx *lmcli.Context, sess *session.Session, showThinking bool, perm api.PermissionMode, ) error
RunCompletionLoop drives the agent completion + tool-call loop for CLI commands. The session must have its agent set before calling. It starts a completion step, renders chunks to stdout, evaluates tool calls against the permission mode, executes them (with user confirmation when needed), and continues until a response has no tool calls or all tools are rejected. Cancelling ctx stops the loop.
Types ¶
This section is empty.