Documentation ¶
Index ¶
- func GetState[T any](state WorldState, k WorldStateKey[T]) (def T)
- func SetState[T any](state WorldState, k WorldStateKey[T], v T)
- type Agent
- type AgentBase
- func (a *AgentBase) AttachTo(router Router)
- func (a *AgentBase) EmitMessage(ctx context.Context, msg *thoughtstream.Thought) error
- func (a *AgentBase) ForkSession() (AnalysisSession, error)
- func (a *AgentBase) History() []*thoughtstream.Thought
- func (a *AgentBase) Init(self Agent, profile *Profile, repo thoughtstream.Resolver, ...)
- func (a *AgentBase) Introspect(ctx context.Context, prompt AgentPrompt, options ...StepOption) (reply *thoughtstream.Thought, err error)
- func (a *AgentBase) Log() thoughtstream.Branch
- func (a *AgentBase) Profile() *Profile
- func (a *AgentBase) ReceiveMessage(ctx context.Context, msg *thoughtstream.Thought) error
- func (a *AgentBase) Repo() thoughtstream.Resolver
- func (a *AgentBase) RunPostCycleHooks(ctx context.Context) error
- func (a *AgentBase) Step(ctx context.Context, options ...StepOption) error
- func (a *AgentBase) WorldState() WorldState
- type AgentContext
- type AgentContextBase
- type AgentPrompt
- type AgentPromptFunc
- func AgentMessage(name, text string) AgentPromptFunc
- func ComposePrompt(prompts ...AgentPrompt) AgentPromptFunc
- func LogHistory() AgentPromptFunc
- func MapToPrompt[T any](items []T, fn func(T) AgentPrompt) AgentPromptFunc
- func MessageToPrompt(msg chat.Message) AgentPromptFunc
- func SystemMessage(msg string) AgentPromptFunc
- func ThoughtHistory(iterator thoughtstream.Iterable) AgentPromptFunc
- func Tml(rootBuilder func(ctx AgentContext) promptml.Parent) AgentPromptFunc
- func TmlContainer(children ...promptml.Node) AgentPromptFunc
- type AnalysisSession
- type BroadcastRouter
- func (r *BroadcastRouter) OutgoingMessages() []*thoughtstream.Thought
- func (r *BroadcastRouter) ReceiveIncomingMessage(ctx context.Context, msg *thoughtstream.Thought)
- func (r *BroadcastRouter) RegisterAgent(agent Agent)
- func (r *BroadcastRouter) ResetOutbox()
- func (r *BroadcastRouter) RouteIncomingMessages(ctx context.Context) error
- func (r *BroadcastRouter) RouteMessage(ctx context.Context, msg *thoughtstream.Thought) error
- type Colab
- func (c *Colab) AttachTo(r Router)
- func (c *Colab) ForkSession() (AnalysisSession, error)
- func (c *Colab) History() []*thoughtstream.Thought
- func (c *Colab) Introspect(ctx context.Context, prompt AgentPrompt, options ...StepOption) (*thoughtstream.Thought, error)
- func (c *Colab) IntrospectWith(ctx context.Context, profileName string, prompt AgentPrompt, ...) (*thoughtstream.Thought, error)
- func (c *Colab) Log() thoughtstream.Branch
- func (c *Colab) Members() []Agent
- func (c *Colab) Profile() *Profile
- func (c *Colab) ReceiveMessage(ctx context.Context, msg *thoughtstream.Thought) error
- func (c *Colab) Router() Router
- func (c *Colab) Step(ctx context.Context, options ...StepOption) error
- func (c *Colab) StepWith(ctx context.Context, profileName string, options ...StepOption) error
- func (c *Colab) WorldState() WorldState
- type PostStepHook
- type Profile
- type RoundRobinScheduler
- type Router
- type Scheduler
- type StepOption
- type StepOptions
- type WorldState
- type WorldStateKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetState ¶
func GetState[T any](state WorldState, k WorldStateKey[T]) (def T)
func SetState ¶
func SetState[T any](state WorldState, k WorldStateKey[T], v T)
Types ¶
type Agent ¶
type Agent interface { AnalysisSession Profile() *Profile Log() thoughtstream.Branch History() []*thoughtstream.Thought WorldState() WorldState AttachTo(r Router) ForkSession() (AnalysisSession, error) Step(ctx context.Context, options ...StepOption) error }
type AgentBase ¶
func (*AgentBase) EmitMessage ¶
func (*AgentBase) ForkSession ¶
func (a *AgentBase) ForkSession() (AnalysisSession, error)
func (*AgentBase) History ¶
func (a *AgentBase) History() []*thoughtstream.Thought
func (*AgentBase) Init ¶
func (a *AgentBase) Init( self Agent, profile *Profile, repo thoughtstream.Resolver, log thoughtstream.Branch, worldState WorldState, )
func (*AgentBase) Introspect ¶
func (a *AgentBase) Introspect(ctx context.Context, prompt AgentPrompt, options ...StepOption) (reply *thoughtstream.Thought, err error)
func (*AgentBase) Log ¶
func (a *AgentBase) Log() thoughtstream.Branch
func (*AgentBase) ReceiveMessage ¶
func (*AgentBase) Repo ¶
func (a *AgentBase) Repo() thoughtstream.Resolver
func (*AgentBase) RunPostCycleHooks ¶
func (*AgentBase) WorldState ¶
func (a *AgentBase) WorldState() WorldState
type AgentContext ¶
type AgentContext interface { Context() context.Context Profile() *Profile Agent() Agent Branch() thoughtstream.Branch Stream() thoughtstream.Stream WorldState() WorldState }
type AgentContextBase ¶
type AgentContextBase struct {
// contains filtered or unexported fields
}
func (AgentContextBase) Agent ¶
func (c AgentContextBase) Agent() Agent
func (AgentContextBase) Branch ¶
func (c AgentContextBase) Branch() thoughtstream.Branch
func (AgentContextBase) Context ¶
func (c AgentContextBase) Context() context.Context
func (AgentContextBase) Profile ¶
func (c AgentContextBase) Profile() *Profile
func (AgentContextBase) Stream ¶
func (c AgentContextBase) Stream() thoughtstream.Stream
func (AgentContextBase) WorldState ¶
func (c AgentContextBase) WorldState() WorldState
type AgentPrompt ¶
type AgentPrompt interface {
Render(ctx AgentContext) (chat.Message, error)
}
type AgentPromptFunc ¶
type AgentPromptFunc func(ctx AgentContext) (chat.Message, error)
func AgentMessage ¶
func AgentMessage(name, text string) AgentPromptFunc
func ComposePrompt ¶
func ComposePrompt(prompts ...AgentPrompt) AgentPromptFunc
func LogHistory ¶
func LogHistory() AgentPromptFunc
func MapToPrompt ¶
func MapToPrompt[T any](items []T, fn func(T) AgentPrompt) AgentPromptFunc
func MessageToPrompt ¶
func MessageToPrompt(msg chat.Message) AgentPromptFunc
func SystemMessage ¶
func SystemMessage(msg string) AgentPromptFunc
func ThoughtHistory ¶
func ThoughtHistory(iterator thoughtstream.Iterable) AgentPromptFunc
func Tml ¶
func Tml(rootBuilder func(ctx AgentContext) promptml.Parent) AgentPromptFunc
func TmlContainer ¶
func TmlContainer(children ...promptml.Node) AgentPromptFunc
func (AgentPromptFunc) Render ¶
func (a AgentPromptFunc) Render(ctx AgentContext) (chat.Message, error)
type AnalysisSession ¶
type AnalysisSession interface { psi.Node Introspect(ctx context.Context, prompt AgentPrompt, options ...StepOption) (*thoughtstream.Thought, error) ReceiveMessage(ctx context.Context, msg *thoughtstream.Thought) error }
type BroadcastRouter ¶
type BroadcastRouter struct {
// contains filtered or unexported fields
}
func NewRouter ¶
func NewRouter(log thoughtstream.Branch) *BroadcastRouter
func (*BroadcastRouter) OutgoingMessages ¶
func (r *BroadcastRouter) OutgoingMessages() []*thoughtstream.Thought
func (*BroadcastRouter) ReceiveIncomingMessage ¶
func (r *BroadcastRouter) ReceiveIncomingMessage(ctx context.Context, msg *thoughtstream.Thought)
func (*BroadcastRouter) RegisterAgent ¶
func (r *BroadcastRouter) RegisterAgent(agent Agent)
func (*BroadcastRouter) ResetOutbox ¶
func (r *BroadcastRouter) ResetOutbox()
func (*BroadcastRouter) RouteIncomingMessages ¶
func (r *BroadcastRouter) RouteIncomingMessages(ctx context.Context) error
func (*BroadcastRouter) RouteMessage ¶
func (r *BroadcastRouter) RouteMessage(ctx context.Context, msg *thoughtstream.Thought) error
type Colab ¶
func NewColab ¶
func NewColab(state WorldState, log thoughtstream.Branch, scheduler Scheduler, leader Agent, members ...Agent) (*Colab, error)
func (*Colab) ForkSession ¶
func (c *Colab) ForkSession() (AnalysisSession, error)
func (*Colab) History ¶
func (c *Colab) History() []*thoughtstream.Thought
func (*Colab) Introspect ¶
func (c *Colab) Introspect(ctx context.Context, prompt AgentPrompt, options ...StepOption) (*thoughtstream.Thought, error)
func (*Colab) IntrospectWith ¶
func (c *Colab) IntrospectWith(ctx context.Context, profileName string, prompt AgentPrompt, options ...StepOption) (*thoughtstream.Thought, error)
func (*Colab) Log ¶
func (c *Colab) Log() thoughtstream.Branch
func (*Colab) ReceiveMessage ¶
func (*Colab) WorldState ¶
func (c *Colab) WorldState() WorldState
type PostStepHook ¶
type PostStepHook func(ctx AgentContext, thought *thoughtstream.Thought) error
type RoundRobinScheduler ¶
type RoundRobinScheduler struct {
// contains filtered or unexported fields
}
func (*RoundRobinScheduler) NextSpeaker ¶
func (r *RoundRobinScheduler) NextSpeaker(ctx AgentContext, candidates ...Agent) (Agent, error)
type Router ¶
type Router interface { RegisterAgent(agent Agent) ReceiveIncomingMessage(ctx context.Context, msg *thoughtstream.Thought) RouteIncomingMessages(ctx context.Context) error RouteMessage(ctx context.Context, msg *thoughtstream.Thought) error OutgoingMessages() []*thoughtstream.Thought ResetOutbox() }
type Scheduler ¶
type Scheduler interface {
NextSpeaker(ctx AgentContext, candidates ...Agent) (Agent, error)
}
type StepOption ¶
type StepOption func(*StepOptions) error
func WithBranch ¶
func WithBranch(branch thoughtstream.Branch) StepOption
func WithHeadPointer ¶
func WithHeadPointer(head thoughtstream.Pointer) StepOption
func WithStream ¶
func WithStream(stream thoughtstream.Stream) StepOption
type StepOptions ¶
type StepOptions struct { Base thoughtstream.Branch Head thoughtstream.Pointer Stream thoughtstream.Stream }
func NewStepOptions ¶
func NewStepOptions(options ...StepOption) (opts StepOptions, err error)
func (*StepOptions) Apply ¶
func (opts *StepOptions) Apply(options ...StepOption) error
type WorldState ¶
type WorldStateKey ¶
func (WorldStateKey[T]) String ¶
func (k WorldStateKey[T]) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.