chat

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 13 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StepPrinterFunc added in v0.4.1

func StepPrinterFunc(name string, w io.Writer) func(msg *message.Message) error

func ToTypedEvent added in v0.4.1

func ToTypedEvent[T any](e Event) (*T, bool)

Types

type AddToHistoryStep added in v0.2.24

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

func (*AddToHistoryStep) AddPublishedTopic added in v0.4.1

func (a *AddToHistoryStep) AddPublishedTopic(publisher message.Publisher, topic string) error

func (*AddToHistoryStep) Start added in v0.2.24

type EchoStep added in v0.2.24

type EchoStep struct {
	TimePerCharacter time.Duration
	// contains filtered or unexported fields
}

func NewEchoStep added in v0.2.24

func NewEchoStep() *EchoStep

func (*EchoStep) AddPublishedTopic added in v0.4.1

func (e *EchoStep) AddPublishedTopic(publisher message.Publisher, topic string) error

func (*EchoStep) Interrupt added in v0.2.24

func (e *EchoStep) Interrupt()

func (*EchoStep) Start added in v0.2.24

type Event added in v0.2.24

type Event struct {
	Type     EventType           `json:"type"`
	Error    error               `json:"error,omitempty"`
	Metadata EventMetadata       `json:"meta,omitempty"`
	Step     *steps.StepMetadata `json:"step,omitempty"`
	// contains filtered or unexported fields
}

func NewEventFromJson added in v0.4.1

func NewEventFromJson(b []byte) (Event, error)

func (Event) ToPartialCompletion added in v0.4.1

func (e Event) ToPartialCompletion() (EventPartialCompletion, bool)

func (Event) ToText added in v0.4.1

func (e Event) ToText() (EventText, bool)

type EventMetadata added in v0.4.1

type EventMetadata struct {
	ID       conversation.NodeID `json:"message_id"`
	ParentID conversation.NodeID `json:"parent_id"`
}

EventMetadata contains all the information that is passed along with watermill message, specific to chat steps.

type EventPartialCompletion added in v0.4.1

type EventPartialCompletion struct {
	Event
	Delta      string `json:"delta"`
	Completion string `json:"completion"`
}

type EventText added in v0.4.1

type EventText struct {
	Event
	Text string `json:"text"`
}

type EventType added in v0.2.24

type EventType string
const (
	EventTypeStart     EventType = "start"
	EventTypeStatus    EventType = "status"
	EventTypePartial   EventType = "partial"
	EventTypeFinal     EventType = "final"
	EventTypeError     EventType = "error"
	EventTypeInterrupt EventType = "interrupt"
)

type RunnableStep added in v0.2.24

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

func (*RunnableStep) AddPublishedTopic added in v0.4.1

func (r *RunnableStep) AddPublishedTopic(publisher message.Publisher, topic string) error

func (*RunnableStep) Start added in v0.2.24

func (r *RunnableStep) Start(ctx context.Context, input interface{}) (steps.StepResult[string], error)

type StepOption added in v0.2.24

type StepOption func(Step) error

func WithSubscription added in v0.2.24

func WithSubscription(publisher message.Publisher, topic string) StepOption

type ToolCall added in v0.4.1

type ToolCall struct {
	Name      string `json:"name"`
	Arguments string `json:"arguments"`
}

Jump to

Keyboard shortcuts

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