eino

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
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

func AppendUserMessage(existing []adk.Message, userInput string) []adk.Message

AppendUserMessage appends a user message to existing Eino ADK messages.

func BuildMessages

func BuildMessages(messages []Message) []adk.Message

BuildMessages converts role/content snapshots into Eino ADK messages.

func NewChatModel

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) Generate

func (f *Flow) Generate(ctx context.Context, userInput string) (*einoschema.Message, error)

Generate runs a non-streaming 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 Message

type Message struct {
	Role    string
	Content string
}

Message is a provider-neutral role/content message snapshot.

type Property

type Property struct {
	Type        string
	Description string
	Enum        []string
	Items       *Property
}

Property describes a single field inside a tool schema.

type Schema

type Schema struct {
	Type       string
	Required   []string
	Properties map[string]*Property
}

Schema describes tool input or output in a provider-agnostic shape.

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.

type ToolSpec

type ToolSpec struct {
	Name        string
	Description string
	InputSchema Schema
}

ToolSpec contains LLM-facing tool metadata.

type Usage

type Usage struct {
	InputTokens  int
	OutputTokens int
	TotalTokens  int
}

Usage describes model token usage.

Jump to

Keyboard shortcuts

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