processor

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DSLConfig

type DSLConfig struct {
	Steps         []Step
	ParallelSteps map[string][]Step // Steps that can be executed in parallel
}

DSLConfig represents the structure of the DSL configuration

type NormalizeOptions

type NormalizeOptions struct {
	AllowEmpty bool // Whether to allow empty strings in the result
}

NormalizeOptions represents options for string slice normalization

type OllamaModelTag added in v0.0.25

type OllamaModelTag struct {
	Name string `json:"name"`
}

OllamaModelTag represents the details of a single model tag from /api/tags

type OllamaTagsResponse added in v0.0.25

type OllamaTagsResponse struct {
	Models []OllamaModelTag `json:"models"`
}

OllamaTagsResponse represents the top-level structure of Ollama's /api/tags response

type PerformanceMetrics added in v0.0.20

type PerformanceMetrics struct {
	InputProcessingTime  int64 // Time in milliseconds to process inputs
	ModelProcessingTime  int64 // Time in milliseconds for model processing
	ActionProcessingTime int64 // Time in milliseconds for action processing
	OutputProcessingTime int64 // Time in milliseconds for output processing
	TotalProcessingTime  int64 // Total time in milliseconds for the step
}

PerformanceMetrics tracks timing information for processing steps

type Processor

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

Processor handles the DSL processing pipeline

func NewProcessor

func NewProcessor(config *DSLConfig, envConfig *config.EnvConfig, serverConfig *config.ServerConfig, verbose bool, runtimeDir ...string) *Processor

NewProcessor creates a new DSL processor

func (*Processor) GetModelProvider

func (p *Processor) GetModelProvider(modelName string) models.Provider

GetModelProvider returns the provider for the specified model

func (*Processor) GetProcessedInputs

func (p *Processor) GetProcessedInputs() []*input.Input

GetProcessedInputs returns all processed input contents

func (*Processor) LastOutput

func (p *Processor) LastOutput() string

LastOutput returns the last output value

func (*Processor) NormalizeStringSlice

func (p *Processor) NormalizeStringSlice(val interface{}) []string

NormalizeStringSlice converts interface{} to []string

func (*Processor) Process

func (p *Processor) Process() error

Process executes the DSL processing pipeline

func (*Processor) SetLastOutput

func (p *Processor) SetLastOutput(output string)

SetLastOutput sets the last output value, useful for initializing with STDIN data

func (*Processor) SetProgressWriter added in v0.0.14

func (p *Processor) SetProgressWriter(w ProgressWriter)

SetProgressWriter sets the progress writer for streaming updates

type ProgressType added in v0.0.14

type ProgressType int

ProgressType represents different types of progress updates

const (
	ProgressSpinner ProgressType = iota
	ProgressStep
	ProgressComplete
	ProgressError
	ProgressOutput       // New type for output events
	ProgressParallelStep // New type for parallel step updates
)

type ProgressUpdate added in v0.0.14

type ProgressUpdate struct {
	Type               ProgressType
	Message            string
	Error              error
	Step               *StepInfo           // Optional step information
	Stdout             string              // Content from STDOUT when Type is ProgressOutput
	IsParallel         bool                // Whether this update is from a parallel step
	ParallelID         string              // Identifier for the parallel step group
	PerformanceMetrics *PerformanceMetrics // Performance metrics for the step
}

ProgressUpdate represents a progress update from the processor

type ProgressWriter added in v0.0.14

type ProgressWriter interface {
	WriteProgress(update ProgressUpdate) error
}

ProgressWriter is an interface for handling progress updates

func NewChannelProgressWriter added in v0.0.14

func NewChannelProgressWriter(ch chan<- ProgressUpdate) ProgressWriter

type Spinner

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

func NewSpinner

func NewSpinner() *Spinner

func (*Spinner) Disable

func (s *Spinner) Disable()

Disable prevents the spinner from showing any output

func (*Spinner) SetProgressWriter added in v0.0.14

func (s *Spinner) SetProgressWriter(w ProgressWriter)

func (*Spinner) Start

func (s *Spinner) Start(message string)

func (*Spinner) Stop

func (s *Spinner) Stop()

type Step

type Step struct {
	Name   string
	Config StepConfig
}

Step represents a named step in the DSL

type StepConfig

type StepConfig struct {
	Type       string      `yaml:"type"`        // Step type (default is standard LLM step)
	Input      interface{} `yaml:"input"`       // Can be string or map[string]interface{}
	Model      interface{} `yaml:"model"`       // Can be string or []string
	Action     interface{} `yaml:"action"`      // Can be string or []string
	Output     interface{} `yaml:"output"`      // Can be string or []string
	NextAction interface{} `yaml:"next-action"` // Can be string or []string
	BatchMode  string      `yaml:"batch_mode"`  // How to process multiple files: "combined" (default) or "individual"
	SkipErrors bool        `yaml:"skip_errors"` // Whether to continue processing if some files fail

	// OpenAI Responses API specific fields
	Instructions       string                   `yaml:"instructions"`         // System message
	Tools              []map[string]interface{} `yaml:"tools"`                // Tools configuration
	PreviousResponseID string                   `yaml:"previous_response_id"` // For conversation state
	MaxOutputTokens    int                      `yaml:"max_output_tokens"`    // Token limit
	Temperature        float64                  `yaml:"temperature"`          // Temperature setting
	TopP               float64                  `yaml:"top_p"`                // Top-p sampling
	Stream             bool                     `yaml:"stream"`               // Whether to stream the response
	ResponseFormat     map[string]interface{}   `yaml:"response_format"`      // Format specification (e.g., JSON)
}

StepConfig represents the configuration for a single step

type StepDependency added in v0.0.20

type StepDependency struct {
	Name      string
	DependsOn []string
}

StepDependency represents a dependency between steps

type StepInfo added in v0.0.14

type StepInfo struct {
	Name   string
	Model  string
	Action string
}

StepInfo contains detailed information about a processing step

Jump to

Keyboard shortcuts

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