deliberation

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package deliberation 提供多种审议与协商推理模式。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decision

type Decision struct {
	Action     string         `json:"action"`
	Tool       string         `json:"tool,omitempty"`
	Parameters map[string]any `json:"parameters,omitempty"`
	Reasoning  string         `json:"reasoning"`
	Confidence float64        `json:"confidence"`
}

决定是审议后的最后决定。

type DeliberationConfig

type DeliberationConfig struct {
	Mode               DeliberationMode `json:"mode"`
	MaxThinkingTime    time.Duration    `json:"max_thinking_time"`
	MinConfidence      float64          `json:"min_confidence"`
	EnableSelfCritique bool             `json:"enable_self_critique"`
	MaxIterations      int              `json:"max_iterations"`
}

Deconfig 配置审议引擎 。

func DefaultDeliberationConfig

func DefaultDeliberationConfig() DeliberationConfig

默认De ReleaseConfig 返回默认配置 。

type DeliberationMode

type DeliberationMode string

审议 模式控制代理在行动前的理性.

const (
	ModeImmediate  DeliberationMode = "immediate"  // Direct tool execution
	ModeDeliberate DeliberationMode = "deliberate" // Full reasoning cycle
	ModeAdaptive   DeliberationMode = "adaptive"   // Context-dependent
)

type DeliberationResult

type DeliberationResult struct {
	TaskID          string           `json:"task_id"`
	Thoughts        []ThoughtProcess `json:"thoughts"`
	Decision        *Decision        `json:"decision"`
	TotalTime       time.Duration    `json:"total_time"`
	Iterations      int              `json:"iterations"`
	FinalConfidence float64          `json:"final_confidence"`
}

审议结果载有审议结果。

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

发动机提供考虑能力.

func NewEngine

func NewEngine(config DeliberationConfig, reasoner Reasoner, logger *zap.Logger) *Engine

NewEngine创造了一个新的审议引擎.

func (*Engine) Deliberate

func (e *Engine) Deliberate(ctx context.Context, task Task) (*DeliberationResult, error)

故意在行动前进行推理。

func (*Engine) GetMode

func (e *Engine) GetMode() DeliberationMode

GetMode 返回当前审议模式 。

func (*Engine) SetMode

func (e *Engine) SetMode(mode DeliberationMode)

设置模式在运行时更改审议模式 。

type Reasoner

type Reasoner interface {
	Think(ctx context.Context, prompt string) (string, float64, error)
}

基于LLM的推理的理性界面.

type Task

type Task struct {
	ID             string         `json:"id"`
	Description    string         `json:"description"`
	Goal           string         `json:"goal"`
	Context        map[string]any `json:"context,omitempty"`
	AvailableTools []string       `json:"available_tools,omitempty"`
	SuggestedTool  string         `json:"suggested_tool,omitempty"`
	Parameters     map[string]any `json:"parameters,omitempty"`
}

任务是一项需要审议的任务。

type ThoughtProcess

type ThoughtProcess struct {
	ID         string    `json:"id"`
	Step       int       `json:"step"`
	Type       string    `json:"type"` // understand, evaluate, plan, critique
	Content    string    `json:"content"`
	Confidence float64   `json:"confidence"`
	Timestamp  time.Time `json:"timestamp"`
}

ThoughtProcess代表了单一的推理步骤.

Jump to

Keyboard shortcuts

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