agent_types

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package agent_types provides types that can be returned by agents.

These objects serve three purposes: - They behave as they were the type they're meant to be (e.g., string for text, image.Image for images) - They can be stringified: String() method to return a string defining the object - They integrate with Go's type system and can be serialized/deserialized

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleAgentInputTypes

func HandleAgentInputTypes(args []interface{}, kwargs map[string]interface{}) ([]interface{}, map[string]interface{})

HandleAgentInputTypes converts AgentTypes to their raw values in function arguments

func HandleAgentOutputTypes

func HandleAgentOutputTypes(output interface{}, outputType string) interface{}

HandleAgentOutputTypes converts outputs to appropriate AgentType based on output type

Types

type AgentAudio

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

AgentAudio represents audio type returned by the agent

func NewAgentAudio

func NewAgentAudio(value interface{}, sampleRate ...int) (*AgentAudio, error)

NewAgentAudio creates a new AgentAudio instance

func (*AgentAudio) SampleRate

func (aa *AgentAudio) SampleRate() int

SampleRate returns the sample rate of the audio

func (*AgentAudio) String

func (aa *AgentAudio) String() string

String implements Stringer interface

func (*AgentAudio) ToRaw

func (aa *AgentAudio) ToRaw() interface{}

ToRaw implements AgentType

func (*AgentAudio) ToString

func (aa *AgentAudio) ToString() string

ToString implements AgentType

type AgentImage

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

AgentImage represents image type returned by the agent. Behaves as an image.Image.

func NewAgentImage

func NewAgentImage(value interface{}) (*AgentImage, error)

NewAgentImage creates a new AgentImage instance

func (*AgentImage) Save

func (ai *AgentImage) Save(w io.Writer, format string) error

Save saves the image to the specified writer with the given format

func (*AgentImage) String

func (ai *AgentImage) String() string

String implements Stringer interface

func (*AgentImage) ToRaw

func (ai *AgentImage) ToRaw() interface{}

ToRaw implements AgentType

func (*AgentImage) ToString

func (ai *AgentImage) ToString() string

ToString implements AgentType

type AgentText

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

AgentText represents text type returned by the agent. Behaves as a string.

func NewAgentText

func NewAgentText(value string) *AgentText

NewAgentText creates a new AgentText instance

func (*AgentText) String

func (at *AgentText) String() string

String implements Stringer interface

func (*AgentText) ToRaw

func (at *AgentText) ToRaw() interface{}

ToRaw implements AgentType

func (*AgentText) ToString

func (at *AgentText) ToString() string

ToString implements AgentType

func (*AgentText) Value

func (at *AgentText) Value() string

Value returns the underlying string value

type AgentType

type AgentType interface {
	// ToRaw returns the "raw" version of the object
	ToRaw() interface{}

	// ToString returns the stringified version of the object
	ToString() string

	// String implements the Stringer interface
	String() string
}

AgentType is the interface that all agent return types must implement

Jump to

Keyboard shortcuts

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