Documentation
¶
Index ¶
- Constants
- func AppendUserMessage(existing []adk.Message, userInput string) []adk.Message
- func BuildMessages(messages []Message) []adk.Message
- func NewChatModel(ctx context.Context, cfg *ChatModelConfig) (einomodel.ToolCallingChatModel, error)
- func NewTool(spec ToolSpec, invoker ToolInvoker) einotool.BaseTool
- func ToToolInfo(spec ToolSpec) *einoschema.ToolInfo
- type ChatModelConfig
- type Flow
- func (f *Flow) Generate(ctx context.Context, userInput string) (*einoschema.Message, error)
- func (f *Flow) GenerateWithUsage(ctx context.Context, userInput string) (*einoschema.Message, *Usage, error)
- func (f *Flow) Stream(ctx context.Context, userInput string, sink StreamSink) (*einoschema.Message, error)
- func (f *Flow) StreamWithUsage(ctx context.Context, userInput string, sink StreamSink) (*einoschema.Message, *Usage, error)
- type FlowConfig
- type Message
- type Property
- type Schema
- type StreamSink
- type ToolInvoker
- type ToolSpec
- type Usage
Constants ¶
const ( // ProviderOpenAI identifies the OpenAI provider. ProviderOpenAI = "openai" // ProviderCustom identifies an OpenAI-compatible custom provider. ProviderCustom = "custom" // ProviderDeepSeek identifies the DeepSeek provider. ProviderDeepSeek = "deepseek" // ProviderQwen identifies the Qwen provider. ProviderQwen = "qwen" // ProviderGemini identifies the Gemini provider. ProviderGemini = "gemini" // ProviderArk identifies the Volcano Ark provider. ProviderArk = "ark" // ProviderOpenRouter identifies the OpenRouter provider. ProviderOpenRouter = "openrouter" // ProviderAnthropic identifies the Anthropic provider. ProviderAnthropic = "anthropic" )
Variables ¶
This section is empty.
Functions ¶
func AppendUserMessage ¶
AppendUserMessage appends a user message to existing Eino ADK messages.
func BuildMessages ¶
BuildMessages converts role/content snapshots into Eino ADK messages.
func NewChatModel ¶
func NewChatModel(ctx context.Context, cfg *ChatModelConfig) (einomodel.ToolCallingChatModel, error)
NewChatModel creates an Eino tool-calling chat model for a supported provider.
func NewTool ¶
func NewTool(spec ToolSpec, invoker ToolInvoker) einotool.BaseTool
NewTool wraps a tool specification and invoker as an Eino invokable tool.
func ToToolInfo ¶
func ToToolInfo(spec ToolSpec) *einoschema.ToolInfo
ToToolInfo converts provider-neutral tool metadata to Eino tool metadata.
Types ¶
type ChatModelConfig ¶
type ChatModelConfig struct {
Provider string
APIKey string
Model string
BaseURL string
MaxTokens int
ResponseFormat *einoopenai.ChatCompletionResponseFormat
Temperature *float32
ReasoningEffort einoopenai.ReasoningEffortLevel
}
ChatModelConfig contains provider-neutral chat model settings.
type Flow ¶
type Flow struct {
// contains filtered or unexported fields
}
Flow runs a tool-calling Eino agent loop.
func NewFlow ¶
func NewFlow(ctx context.Context, cfg *FlowConfig) (*Flow, error)
NewFlow creates a reusable Eino agent flow.
func (*Flow) GenerateWithUsage ¶
func (f *Flow) GenerateWithUsage(ctx context.Context, userInput string) (*einoschema.Message, *Usage, error)
GenerateWithUsage returns the final message and aggregated model token usage.
func (*Flow) Stream ¶
func (f *Flow) Stream(ctx context.Context, userInput string, sink StreamSink) (*einoschema.Message, error)
Stream runs a streaming agent flow.
func (*Flow) StreamWithUsage ¶
func (f *Flow) StreamWithUsage(ctx context.Context, userInput string, sink StreamSink) (*einoschema.Message, *Usage, error)
StreamWithUsage emits deltas and returns the final message plus aggregated usage.
type FlowConfig ¶
type FlowConfig struct {
Model einomodel.ToolCallingChatModel
Tools []einotool.BaseTool
SystemPrompt string
MaxStep int
Messages []adk.Message
}
FlowConfig contains Eino Flow dependencies and execution options.
type StreamSink ¶
type StreamSink interface {
EmitMessageDelta(ctx context.Context, messageID string, content string) error
EmitReasoningDelta(ctx context.Context, messageID string, content string) error
}
StreamSink receives text deltas emitted during streaming.
type ToolInvoker ¶
type ToolInvoker interface {
InvokeTool(ctx context.Context, name string, argumentsInJSON string) (string, error)
}
ToolInvoker executes a tool with raw JSON arguments.