Files
wehub-resource-sync a06f331eb8
install-script / powershell-syntax (push) Waiting to run
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
install-script / install (macos-14) (push) Waiting to run
install-script / install (ubuntu-latest) (push) Waiting to run
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:33:42 +08:00

55 lines
2.3 KiB
Go

package llm
// AgentAnswer is the structured result of a Service.RunAgent call.
// Lives in pure Go (no build tag) so callers compile against the same
// type regardless of whether the service was built with -tags llama.
type AgentAnswer struct {
Answer string `json:"answer"`
Steps int `json:"steps"`
ElapsedMs int64 `json:"elapsed_ms"`
ChainMode bool `json:"chain_mode"`
Scope Scope `json:"scope"`
Error string `json:"error,omitempty"`
Transcript []TranscriptStep `json:"transcript,omitempty"`
// Model is the model the agent ran on. With llm.routing enabled
// this is the routed pick; otherwise the configured provider model.
Model string `json:"model,omitempty"`
// Complexity is the routed task-complexity class ("simple" /
// "complex"). Set only when llm.routing is enabled.
Complexity string `json:"complexity,omitempty"`
// Usage is the token accounting summed across the agent's steps.
// Zero when the active provider does not report usage.
Usage TokenUsage `json:"usage,omitempty"`
// Cost is the estimated USD cost of the run, derived from Usage and
// the provider's pricing. Zero when no usage or no price is known.
Cost float64 `json:"cost,omitempty"`
}
// TranscriptStep is one entry in the agent's per-call transcript.
// Kind is "call", "result", or "final".
type TranscriptStep struct {
Kind string `json:"kind"`
Raw string `json:"raw"`
Tool string `json:"tool,omitempty"`
}
// RunAgentOptions controls a single Service.RunAgent invocation.
type RunAgentOptions struct {
// Question is the user-facing natural-language query.
Question string
// Scope narrows the agent's tool calls to a subset of repos /
// projects. Empty fields = no filter.
Scope Scope
// Chain enables the cross-system trace toolset (contracts +
// get_dependencies) and prompt. Off by default — simple cross-repo
// lookups don't need it.
Chain bool
// IncludeTranscript adds every CALL/RESULT/FINAL step to the
// returned AgentAnswer. Off by default to keep responses compact.
IncludeTranscript bool
// SystemExtras overrides the default system prompt extras
// (P2-style for simple mode, chain-style for chain mode). Empty
// means use the default for the mode.
SystemExtras string
}