agents

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DeepseekBaseURL       = "https://api.deepseek.com/v1"
	OpenAIBaseURL         = "https://api.openai.com/v1"
	AliBailianIntlBaseURL = "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
	AliBailianCnBaseURL   = "https://dashscope.aliyuncs.com/compatible-mode/v1"
)

Functions

func CompileGraph

func CompileGraph[T, V any](rail flow.Rail, o *GenericOps, g *compose.Graph[T, V], opts ...compose.GraphCompileOption) (compose.Runnable[T, V], error)

func NewExecutiveSummaryWriterOps

func NewExecutiveSummaryWriterOps(g *GenericOps) *executiveSummaryWriterOps

func NewOpenAIChatModel

func NewOpenAIChatModel(model, apiKey string, ops ...func(o *openAiModelConfig)) (model.ToolCallingChatModel, error)

func WithMaxToken

func WithMaxToken(n int) func(o *openAiModelConfig)

func WithRetry

func WithRetry(n int) func(o *openAiModelConfig)

func WithTemperature

func WithTemperature(n float32) func(o *openAiModelConfig)

func WithTraceCallback

func WithTraceCallback(name string, logInputs bool) compose.Option

Types

type DeepResearchClarifier added in v0.0.4

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

func NewDeepResearchClarifier added in v0.0.4

func NewDeepResearchClarifier(rail flow.Rail, chatModel model.ToolCallingChatModel, ops *DeepResearchClarifierOps) (*DeepResearchClarifier, error)

func (*DeepResearchClarifier) Execute added in v0.0.4

type DeepResearchClarifierInput added in v0.0.4

type DeepResearchClarifierInput struct {
	Now          string `json:"now"`
	Conversation string `json:"conversation"`
	Memory       string `json:"memory"`
}

type DeepResearchClarifierOps added in v0.0.4

type DeepResearchClarifierOps struct {

	// Injected variables: ${language}
	SystemMessagePrompt string

	// Injected variables: ${now} ${conversation}, ${memory}
	UserMessagePrompt string
	// contains filtered or unexported fields
}

func NewDeepResearchClarifierOps added in v0.0.4

func NewDeepResearchClarifierOps(g *GenericOps) *DeepResearchClarifierOps

type DeepResearchClarifierOutput added in v0.0.4

type DeepResearchClarifierOutput struct {
	Title       string `json:"title"`
	Description string `json:"description"`
}

type ExecutiveSummaryWriter

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

func NewExecutiveSummaryWriter

func NewExecutiveSummaryWriter(rail flow.Rail, chatModel model.ToolCallingChatModel, ops *executiveSummaryWriterOps) (*ExecutiveSummaryWriter, error)

func (*ExecutiveSummaryWriter) Execute

type ExecutiveSummaryWriterInput

type ExecutiveSummaryWriterInput struct {
	Report  string `json:"report"`
	Context string `json:"context"`
}

type ExecutiveSummaryWriterOutput

type ExecutiveSummaryWriterOutput struct {
	Summary string `json:"summary"`
}

type ExtractFieldSpec added in v0.0.6

type ExtractFieldSpec struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Example     string `json:"example"`
}

type ExtractFieldSpecs added in v0.0.6

type ExtractFieldSpecs []ExtractFieldSpec

type GenericOps added in v0.0.4

type GenericOps struct {
	MaxRunSteps  int
	RepeatPrompt bool // Propmt Repeation: https://arxiv.org/html/2512.14982v1
	Now          string
	Language     string
	VisualizeDir string
	LogOnStart   bool
	LogInputs    bool
}

func NewGenericOps

func NewGenericOps() *GenericOps

type Material added in v0.0.6

type Material struct {
	Content string `json:"content"`
	Source  string `json:"source"`
}

type MaterialExtract added in v0.0.6

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

func NewMaterialExtract added in v0.0.6

func NewMaterialExtract(rail flow.Rail, chatModel model.ToolCallingChatModel, ops *MaterialExtractOps) (*MaterialExtract, error)

func (*MaterialExtract) Execute added in v0.0.6

Execute.

If there are lots of fields, use MaterialExtract.ParallelExecute instead.

func (*MaterialExtract) ParallelExecute added in v0.0.9

func (b *MaterialExtract) ParallelExecute(rail flow.Rail, input MaterialExtractInput, batchSize int, pool async.AsyncPool) (MaterialExtractOutput, error)

type MaterialExtractInput added in v0.0.6

type MaterialExtractInput struct {
	Context   string             `json:"context"`
	Materials []Material         `json:"materials"`
	Fields    []ExtractFieldSpec `json:"fields"`
	// contains filtered or unexported fields
}

type MaterialExtractOps added in v0.0.6

type MaterialExtractOps struct {

	// Injected variables: ${context}, ${language}, ${now}
	SystemMessagePrompt string

	// Injected variables: ${materials}, ${fields}, ${extractedInfo}
	UserMessagePrompt string

	TimeZoneHourOffset float64
	// contains filtered or unexported fields
}

func NewMaterialExtractOps added in v0.0.6

func NewMaterialExtractOps(g *GenericOps) *MaterialExtractOps

type MaterialExtractOutput added in v0.0.6

type MaterialExtractOutput struct {
	ExtractedInfo map[string]string `json:"extractedInfo"`
}

type MemorySummarizer added in v0.0.5

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

func NewMemorySummarizer added in v0.0.5

func NewMemorySummarizer(rail flow.Rail, chatModel model.ToolCallingChatModel, ops *MemorySummarizerOps) (*MemorySummarizer, error)

func (*MemorySummarizer) Execute added in v0.0.5

type MemorySummarizerInput added in v0.0.5

type MemorySummarizerInput struct {
	LongTermMemory     string `json:"longTermMemory"`
	RecentConversation string `json:"recentConversation"`
}

type MemorySummarizerOps added in v0.0.5

type MemorySummarizerOps struct {

	// Injected variables: ${language}
	SystemMessagePrompt string

	// Injected variables: ${context}, ${report}
	UserMessagePrompt string
	// contains filtered or unexported fields
}

func NewMemorySummarizerOps added in v0.0.5

func NewMemorySummarizerOps(g *GenericOps) *MemorySummarizerOps

type MemorySummarizerOutput added in v0.0.5

type MemorySummarizerOutput struct {
	Summary string `json:"summary"`
}

type MermaidGenerator

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

Credit: 2026-01-14, Copied from https://github.com/cloudwego/eino-examples/blob/main/devops/visualize/mermaid.go with modification.

MermaidGenerator renders a Mermaid diagram from a compiled Eino graph (Graph/Chain/Workflow).

Core concepts and mapping: - Nodes: labeled with their key and component type. Lambda nodes use rounded shapes. - Special nodes: START/END are rendered with safe IDs (start_node/end_node) to avoid Mermaid keyword conflicts. - SubGraphs: nested Graph/Chain/Workflow are rendered as Mermaid sub-graphs with their component type in the title. - Edges:

  • In general graphs/chains: a single solid arrow (-->), representing standard control+data execution.
  • In workflows (workflowStyle=true): edges are distinguished by semantics:
  • control+data: normal arrow with label "control+data" ("-- control+data -->")
  • control-only: bold arrow with label "control-only" ("== control-only ==>")
  • data-only: dotted arrow with label "data-only" ("-. data-only .->") Branch decision diamonds and their incoming/outgoing edges are treated as control-only in workflows.

Usage:

buf := &bytes.Buffer{}
gen := visualize.NewMermaidGenerator(buf)                // for Graph/Chain
// or
gen := visualize.NewMermaidGeneratorWorkflow(buf)        // for Workflow with labeled edges
_, _ = g.Compile(ctx, compose.WithGraphCompileCallbacks(gen), compose.WithGraphName("MyGraph"))
// Write to a Markdown file:
md := "```mermaid\n" + buf.String() + "\n```\n"
_ = os.WriteFile("my_graph.md", []byte(md), 0644)

func NewMermaidGenerator

func NewMermaidGenerator(dir string) *MermaidGenerator

NewMermaidGenerator creates a generator that auto-writes Markdown and attempts PNG/SVG generation. If dir is empty, current working directory is used. File name is derived from graph name or defaults to "topology".

func (*MermaidGenerator) OnFinish

func (m *MermaidGenerator) OnFinish(c context.Context, info *compose.GraphInfo)

OnFinish is the compile callback entrypoint invoked by Eino after graph compilation. It reads the compile-time GraphInfo and writes a complete Mermaid diagram to the writer.

type Rule added in v0.0.6

type Rule struct {
	Name    string `json:"name"`
	Content string `json:"content"`
}

type RuleMatcher added in v0.0.6

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

func NewRuleMatcher added in v0.0.6

func NewRuleMatcher(rail flow.Rail, chatModel model.ToolCallingChatModel, ops *RuleMatcherOps) (*RuleMatcher, error)

func (*RuleMatcher) Execute added in v0.0.6

func (b *RuleMatcher) Execute(rail flow.Rail, input RuleMatcherInput) (RuleMatcherOutput, error)

Execute.

If there are lots of rules, use RuleMatcher.ParallelExecute instead.

func (*RuleMatcher) ParallelExecute added in v0.0.9

func (b *RuleMatcher) ParallelExecute(rail flow.Rail, input RuleMatcherInput, batchSize int, pool async.AsyncPool) (RuleMatcherOutput, error)

type RuleMatcherInput added in v0.0.6

type RuleMatcherInput struct {
	// Additional instruction about the task
	//
	// How should LLM make decision on whether the target matches the given rule or not.
	TaskInstruction string `json:"taskInstruction"`

	// context about the target
	//
	// e.g., if we are running a background check for a company, the context will be the information about the company.
	Context string `json:"context"`

	// Rules
	Rules []Rule `json:"Rules"`
	// contains filtered or unexported fields
}

type RuleMatcherOps added in v0.0.6

type RuleMatcherOps struct {

	// Injected variables: ${taskInstruction}, ${language}, ${now}
	SystemMessagePrompt string

	// Injected variables: ${rule}, ${context}
	UserMessagePrompt string

	TimeZoneHourOffset float64
	// contains filtered or unexported fields
}

func NewRuleMatcherOps added in v0.0.6

func NewRuleMatcherOps(g *GenericOps) *RuleMatcherOps

type RuleMatcherOutput added in v0.0.6

type RuleMatcherOutput struct {
	Rules []RuleResult `json:"rules"`
}

type RuleResult added in v0.0.6

type RuleResult struct {
	Matched bool   `json:"matched"`
	Name    string `json:"name"`
	Reason  string `json:"reason"`
}

Jump to

Keyboard shortcuts

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