agent

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Automata

type Automata[A, B any] struct {
	// contains filtered or unexported fields
}

Generic agent automata

func NewAutomata

func NewAutomata[A, B any](
	llm chatter.Chatter,
	memory thinker.Memory,
	encoder thinker.Encoder[A],
	decoder thinker.Decoder[B],
	reasoner thinker.Reasoner[B],
) *Automata[A, B]

func (*Automata[A, B]) Prompt

func (automata *Automata[A, B]) Prompt(ctx context.Context, input A, opt ...chatter.Opt) (B, error)

Prompt agent

func (*Automata[A, B]) PromptOnce added in v0.0.16

func (automata *Automata[A, B]) PromptOnce(ctx context.Context, input A, opt ...chatter.Opt) (B, error)

Forget the agent state and prompt within a new session

func (*Automata[A, B]) Purge added in v0.0.11

func (automata *Automata[A, B]) Purge()

Purge automata's memory

type Jsonify added in v0.0.17

type Jsonify[A any] struct {
	*Automata[A, []string]
	// contains filtered or unexported fields
}

Jsonify implementing request/response to LLMs, forcing the response to be JSON array.

func NewJsonify added in v0.0.17

func NewJsonify[A any](
	llm chatter.Chatter,
	attempts int,
	encoder thinker.Encoder[A],
	validator func([]string) error,
) *Jsonify[A]

type Prompter added in v0.0.11

type Prompter[A any] struct {
	*Automata[A, string]
}

Prompter is memoryless and stateless agent, implementing request/response to LLMs.

func NewPrompter added in v0.0.11

func NewPrompter[A any](llm chatter.Chatter, f func(A) (chatter.Prompt, error)) *Prompter[A]

type Worker added in v0.0.9

type Worker[A any] struct {
	*Automata[A, thinker.CmdOut]
	// contains filtered or unexported fields
}

The agent tailored for executing prompt driven workflow.

func NewWorker added in v0.0.9

func NewWorker[A any](
	llm chatter.Chatter,
	attempts int,
	encoder thinker.Encoder[A],
	registry *command.Registry,
) *Worker[A]

Jump to

Keyboard shortcuts

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