examples

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

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

Chat shows off the basic chat example, where the user goes back and forth with an AI agent, that keeps track of the conversation in a thread. We will also add the browser tool to the agent, so that it can browse the web.

func NewChat

func NewChat(ctx context.Context, role string) *Chat

NewChat creates a new Chat instance with the specified context and role. It initializes an empty scratchpad for accumulating assistant responses and sets up the basic formatting configuration.

Parameters:

  • ctx: The context for operations
  • role: The role designation for the AI agent

func (*Chat) Run

func (chat *Chat) Run() error

Run starts the chat loop, which allows the user to interact with the agent. It adds the browser tool to the agent, so that it can browse the web.

type Strawberry

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

Strawberry is an example of the infamous strawberry problem, where the user asks the agent to count the number of times the letter "r" appears in the word "strawberry". This is an especially good example, since all LLMs will get this wrong, and it's a good way to test the agent's ability to reason.

func NewStrawberry

func NewStrawberry(ctx context.Context, role string) *Strawberry

NewStrawberry creates a new Strawberry instance with the specified context and role. It initializes an empty scratchpad for accumulating assistant responses and sets up the basic formatting configuration.

Parameters:

  • ctx: The context for operations
  • role: The role designation for the AI agent

func (*Strawberry) Run

func (s *Strawberry) Run() error

Run starts the strawberry loop, which allows the user to interact with the agent. It initializes the agents and creates a worker pool to handle the different steps of the strawberry problem.

Jump to

Keyboard shortcuts

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