sidequestion

package
v0.0.360 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HistoryLimit = 20

	SystemPolicy = `` /* 683-byte string literal not displayed */

	ToolAttemptResponse = "Side questions cannot use tools. Ask using only the supplied conversation context."
)

Variables

This section is empty.

Functions

func BuildMessages

func BuildMessages(snapshot []llm.Message, history []Entry, question, providerName, model string, runtimeInputLimit int) ([]llm.Message, error)

BuildMessages constructs a bounded provider request. It preserves the exact main-session prefix whenever possible for prompt-cache reuse, then drops old side history before trimming main history at complete user-turn boundaries.

func CloneMessages

func CloneMessages(messages []llm.Message) []llm.Message

CloneMessages returns a point-in-time deep copy without changing provider protocol metadata. Request construction performs sanitization once after all context fragments have been assembled.

func PrepareContextSnapshot

func PrepareContextSnapshot(messages []llm.Message) []llm.Message

PrepareContextSnapshot returns a provider-safe point-in-time deep copy. It preserves cache anchors while removing incomplete tool protocol fragments.

Types

type Entry

type Entry struct {
	Question  string    `json:"question"`
	Response  string    `json:"response"`
	CreatedAt time.Time `json:"created_at"`
	Usage     llm.Usage `json:"usage"`
}

func AppendHistory

func AppendHistory(history []Entry, entry Entry) []Entry

type Result

type Result struct {
	Response  string    `json:"response"`
	Usage     llm.Usage `json:"usage"`
	Synthetic bool      `json:"synthetic"`
}

func Run

func Run(ctx context.Context, provider llm.Provider, req llm.Request, emit func(llm.Event)) (Result, error)

Run performs exactly one provider request. It bypasses the agent engine so no local, MCP, approval, delegation, or provider-native search capability exists.

Jump to

Keyboard shortcuts

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