types

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionMetadata

type ActionMetadata struct {
	ItemIndex int `json:"itemIndex"`
}

ActionMetadata action metadata

type ActionResponse

type ActionResponse struct {
	Action *ToolAction `json:"action"`
	Data   interface{} `json:"data"`
	Error  string      `json:"error,omitempty"`
}

ActionResponse action response

type AgentConfig

type AgentConfig struct {
	MaxIterations      int           `json:"maxIterations"`
	SystemMessage      string        `json:"systemMessage"`
	Temperature        float32       `json:"temperature"`        // 温度参数 (0.0-1.0)
	MaxTokens          int           `json:"maxTokens"`          // 最大token数
	TopP               float32       `json:"topP"`               // Top P采样
	FrequencyPenalty   float32       `json:"frequencyPenalty"`   // 频率惩罚
	PresencePenalty    float32       `json:"presencePenalty"`    // 存在惩罚
	StopSequences      []string      `json:"stopSequences"`      // 停止序列
	Timeout            time.Duration `json:"timeout"`            // 超时时间
	RetryAttempts      int           `json:"retryAttempts"`      // 重试次数
	RetryDelay         time.Duration `json:"retryDelay"`         // 重试延迟
	EnableToolRetry    bool          `json:"enableToolRetry"`    // 启用工具重试
	MaxHistoryMessages int           `json:"maxHistoryMessages"` // 最大历史消息数
}

AgentConfig agent configuration

func NewAgentConfig

func NewAgentConfig() *AgentConfig

NewAgentConfig creates a new agent configuration with reasonable defaults

type EngineRequest

type EngineRequest struct {
	Actions  []ToolAction            `json:"actions"`
	Metadata RequestResponseMetadata `json:"metadata"`
}

EngineRequest engine request

type EngineResponse

type EngineResponse struct {
	ActionResponses []ActionResponse        `json:"actionResponses"`
	Metadata        RequestResponseMetadata `json:"metadata"`
}

EngineResponse engine response

type ImageDataPart

type ImageDataPart struct {
	Data     []byte `json:"data"`
	MIMEType string `json:"mime_type"`
}

ImageDataPart image data part

type ImageURLPart

type ImageURLPart struct {
	URL    string `json:"url"`
	Detail string `json:"detail,omitempty"` // "low", "high", "auto"
}

ImageURLPart image URL part

type LLMProvider

type LLMProvider interface {
	// Basic chat functionality
	Chat(messages []Message) (Message, error)
	ChatStream(messages []Message) (<-chan StreamMessage, error)

	// Tool call support
	ChatWithTools(messages []Message, tools []Tool) (Message, error)
	ChatWithToolsStream(messages []Message, tools []Tool) (<-chan StreamMessage, error)

	// Model information
	GetModelName() string
	GetModelMetadata() ModelMetadata
}

LLMProvider defines LLM provider interface

type LangChainToolWrapper

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

LangChainToolWrapper LangChain tool wrapper

func NewLangChainToolWrapper

func NewLangChainToolWrapper(tool Tool) *LangChainToolWrapper

NewLangChainToolWrapper creates a new LangChain tool wrapper

func (*LangChainToolWrapper) Call

func (w *LangChainToolWrapper) Call(ctx context.Context, input string) (string, error)

Call invokes the tool (LangChain interface)

func (*LangChainToolWrapper) Description

func (w *LangChainToolWrapper) Description() string

Description returns tool description

func (*LangChainToolWrapper) Name

func (w *LangChainToolWrapper) Name() string

Name returns tool name

type MemoryProvider

type MemoryProvider interface {
	// Load memory variables
	LoadMemoryVariables() (map[string]interface{}, error)

	// Save context
	SaveContext(input, output map[string]interface{}) error

	// Clear memory
	Clear() error

	// Get chat history
	GetChatHistory() ([]Message, error)
}

MemoryProvider memory system interface

type Message

type Message struct {
	Role       string        `json:"role"` // "system", "user", "assistant", "tool"
	Content    string        `json:"content"`
	Name       string        `json:"name,omitempty"`
	ToolCalls  []ToolCall    `json:"tool_calls,omitempty"`
	ToolCallID string        `json:"tool_call_id,omitempty"`
	Parts      []MessagePart `json:"parts,omitempty"` // Multi-modal content support
}

Message message structure

type MessagePart

type MessagePart interface {
	// contains filtered or unexported methods
}

MessagePart message part interface

type ModelMetadata

type ModelMetadata struct {
	Name      string                 `json:"name"`
	Version   string                 `json:"version"`
	MaxTokens int                    `json:"maxTokens"`
	Tools     []Tool                 `json:"tools,omitempty"`
	Extra     map[string]interface{} `json:"extra,omitempty"`
}

ModelMetadata model metadata

type OutputParser

type OutputParser interface {
	Parse(output string) (interface{}, error)
	GetFormatInstructions() string
}

OutputParser output parser interface

type RequestResponseMetadata

type RequestResponseMetadata struct {
	ItemIndex        int            `json:"itemIndex,omitempty"`
	PreviousRequests []ToolCallData `json:"previousRequests,omitempty"`
	IterationCount   int            `json:"iterationCount,omitempty"`
}

RequestResponseMetadata request response metadata

type StreamEvent

type StreamEvent struct {
	Type       string      `json:"type"`
	Content    string      `json:"content,omitempty"`
	ToolResult interface{} `json:"toolResult,omitempty"`
	EventName  string      `json:"eventName,omitempty"`
	Data       interface{} `json:"data,omitempty"`
}

StreamEvent stream event

type StreamMessage

type StreamMessage struct {
	Type      string     `json:"type"` // "chunk", "end", "error", "tool_calls"
	Content   string     `json:"content,omitempty"`
	Error     string     `json:"error,omitempty"`
	ToolCalls []ToolCall `json:"tool_calls,omitempty"`
}

StreamMessage streaming message

type TextPart

type TextPart struct {
	Text string `json:"text"`
}

TextPart text content part

type Tool

type Tool interface {
	// Tool basic information
	Name() string
	Description() string
	Schema() map[string]interface{}

	// Tool execution
	Execute(input map[string]interface{}) (interface{}, error)

	// Tool metadata
	Metadata() ToolMetadata
}

Tool defines tool interface

type ToolAction

type ToolAction struct {
	NodeName string                 `json:"nodeName"`
	Input    map[string]interface{} `json:"input"`
	Type     string                 `json:"type"`
	ID       string                 `json:"id"`
	Metadata ActionMetadata         `json:"metadata"`
}

ToolAction tool action

type ToolActionStep

type ToolActionStep struct {
	Tool       string      `json:"tool"`
	ToolInput  interface{} `json:"toolInput"`
	Log        interface{} `json:"log"`
	ToolCallID interface{} `json:"toolCallId"`
	Type       interface{} `json:"type"`
}

ToolActionStep tool action step

type ToolCall

type ToolCall struct {
	ID       string       `json:"id"`
	Type     string       `json:"type"`
	Function ToolFunction `json:"function"`
}

ToolCall tool call

type ToolCallData

type ToolCallData struct {
	Action      ToolActionStep `json:"action"`
	Observation string         `json:"observation"`
}

ToolCallData tool call data

type ToolCallRequest

type ToolCallRequest struct {
	Tool       string                 `json:"tool"`
	ToolInput  map[string]interface{} `json:"toolInput"`
	ToolCallID string                 `json:"toolCallId"`
	Type       string                 `json:"type,omitempty"`
	Log        string                 `json:"log,omitempty"`
	MessageLog []interface{}          `json:"messageLog,omitempty"`
}

ToolCallRequest tool call request

type ToolFunction

type ToolFunction struct {
	Name      string                 `json:"name"`
	Arguments map[string]interface{} `json:"arguments"`
}

ToolFunction tool function

type ToolMetadata

type ToolMetadata struct {
	SourceNodeName string                 `json:"sourceNodeName"`
	IsFromToolkit  bool                   `json:"isFromToolkit"`
	ToolType       string                 `json:"toolType"` // "mcp","http","builtin"
	Extra          map[string]interface{} `json:"extra,omitempty"`
}

ToolMetadata tool metadata

Jump to

Keyboard shortcuts

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