model

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StreamEventTypeContent  = "content"
	StreamEventTypeToolCall = "tool_call"
	StreamEventTypeHandoff  = "handoff"
	StreamEventTypeDone     = "done"
	StreamEventTypeError    = "error"
)

StreamEvent types

View Source
const (
	// HandoffTypeDelegate indicates a delegation handoff to another agent
	HandoffTypeDelegate = "delegate"

	// HandoffTypeReturn indicates a return handoff to a delegator
	HandoffTypeReturn = "return"
)

Handoff types

Variables

This section is empty.

Functions

This section is empty.

Types

type HandoffCall

type HandoffCall struct {
	AgentName      string         `json:"agent_name"`
	Parameters     map[string]any `json:"parameters,omitempty"`
	Type           string         `json:"type,omitempty"`             // Type of handoff (delegate or return)
	ReturnToAgent  string         `json:"return_to_agent,omitempty"`  // Agent to return to after task completion
	TaskID         string         `json:"task_id,omitempty"`          // Unique identifier for the task
	IsTaskComplete bool           `json:"is_task_complete,omitempty"` // Whether the task is complete
}

HandoffCall represents a handoff call from a model

type Model

type Model interface {
	// GetResponse gets a single response from the model
	GetResponse(ctx context.Context, request *Request) (*Response, error)

	// StreamResponse streams a response from the model
	StreamResponse(ctx context.Context, request *Request) (<-chan StreamEvent, error)
}

Model defines the interface for interacting with LLMs

type Provider

type Provider interface {
	// GetModel returns a model by name
	GetModel(modelName string) (Model, error)
}

Provider is responsible for looking up Models by name

type Request

type Request struct {
	SystemInstructions string
	Input              interface{}
	Tools              []interface{}
	OutputSchema       interface{}
	Handoffs           []interface{}
	Settings           *Settings
}

Request represents a request to a model

type Response

type Response struct {
	Content     string
	ToolCalls   []ToolCall
	HandoffCall *HandoffCall
	Usage       *Usage
}

Response represents a response from a model

type Settings

type Settings struct {
	Temperature       *float64
	TopP              *float64
	FrequencyPenalty  *float64
	PresencePenalty   *float64
	ToolChoice        *string
	ParallelToolCalls *bool
	MaxTokens         *int
}

Settings configures model-specific parameters

type StreamEvent

type StreamEvent struct {
	Type        string
	Content     string
	ToolCall    *ToolCall
	HandoffCall *HandoffCall
	Done        bool
	Error       error
	Response    *Response
}

StreamEvent represents an event in a streaming response

type ToolCall

type ToolCall struct {
	ID         string
	Name       string
	Parameters map[string]interface{}
}

ToolCall represents a tool call from a model

type Usage

type Usage struct {
	PromptTokens     int
	CompletionTokens int
	TotalTokens      int
}

Usage represents token usage information

Directories

Path Synopsis
providers

Jump to

Keyboard shortcuts

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