Documentation ¶
Index ¶
- Constants
- func StepPrinterFunc(name string, w io.Writer) func(msg *message.Message) error
- func ToTypedEvent[T any](e Event) (*T, bool)
- type AddToHistoryStep
- type EchoStep
- type Event
- type EventError
- type EventFinal
- type EventImpl
- func (e *EventImpl) Error() error
- func (e *EventImpl) MarshalZerologObject(ev *zerolog.Event)
- func (e *EventImpl) Metadata() EventMetadata
- func (e *EventImpl) Payload() []byte
- func (e *EventImpl) StepMetadata() *steps.StepMetadata
- func (e *EventImpl) ToPartialCompletion() (EventPartialCompletion, bool)
- func (e *EventImpl) ToText() (EventText, bool)
- func (e *EventImpl) ToToolCall() (EventToolCall, bool)
- func (e *EventImpl) Type() EventType
- type EventInterrupt
- type EventMetadata
- type EventPartialCompletion
- type EventPartialCompletionStart
- type EventText
- type EventToolCall
- type EventToolResult
- type EventType
- type RunnableStep
- type Step
- type StepOption
- type ToolCall
- type ToolResult
Constants ¶
View Source
const MetadataToolCallsSlug = "tool-calls"
MetadataToolCallsSlug is the slug used to store ToolCall metadata as returned by the openai API TODO(manuel, 2024-07-04) This needs to deleted once we have a good way to do tool calling
Variables ¶
This section is empty.
Functions ¶
func StepPrinterFunc ¶ added in v0.4.1
func ToTypedEvent ¶ added in v0.4.1
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
func (a *AddToHistoryStep) Start(ctx context.Context, input string) (steps.StepResult[string], error)
type EchoStep ¶ added in v0.2.24
func NewEchoStep ¶ added in v0.2.24
func NewEchoStep() *EchoStep
func (*EchoStep) AddPublishedTopic ¶ added in v0.4.1
func (*EchoStep) Start ¶ added in v0.2.24
func (e *EchoStep) Start(ctx context.Context, input conversation.Conversation) (steps.StepResult[string], error)
type Event ¶ added in v0.2.24
type Event interface { Type() EventType Metadata() EventMetadata StepMetadata() *steps.StepMetadata Payload() []byte }
func NewEventFromJson ¶ added in v0.4.1
type EventError ¶ added in v0.4.13
func NewErrorEvent ¶ added in v0.4.13
func NewErrorEvent(metadata EventMetadata, stepMetadata *steps.StepMetadata, err string) *EventError
func (EventError) MarshalZerologObject ¶ added in v0.4.13
func (e EventError) MarshalZerologObject(ev *zerolog.Event)
type EventFinal ¶ added in v0.4.13
func NewFinalEvent ¶ added in v0.4.13
func NewFinalEvent(metadata EventMetadata, stepMetadata *steps.StepMetadata, text string) *EventFinal
func (EventFinal) MarshalZerologObject ¶ added in v0.4.13
func (e EventFinal) MarshalZerologObject(ev *zerolog.Event)
type EventImpl ¶ added in v0.4.13
type EventImpl 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 (*EventImpl) MarshalZerologObject ¶ added in v0.4.13
func (*EventImpl) Metadata ¶ added in v0.4.13
func (e *EventImpl) Metadata() EventMetadata
func (*EventImpl) StepMetadata ¶ added in v0.4.13
func (e *EventImpl) StepMetadata() *steps.StepMetadata
func (*EventImpl) ToPartialCompletion ¶ added in v0.4.13
func (e *EventImpl) ToPartialCompletion() (EventPartialCompletion, bool)
func (*EventImpl) ToToolCall ¶ added in v0.4.13
func (e *EventImpl) ToToolCall() (EventToolCall, bool)
type EventInterrupt ¶ added in v0.4.13
func NewInterruptEvent ¶ added in v0.4.13
func NewInterruptEvent(metadata EventMetadata, stepMetadata *steps.StepMetadata, text string) *EventInterrupt
func (EventInterrupt) MarshalZerologObject ¶ added in v0.4.13
func (e EventInterrupt) MarshalZerologObject(ev *zerolog.Event)
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.
func (EventMetadata) MarshalZerologObject ¶ added in v0.4.13
func (em EventMetadata) MarshalZerologObject(e *zerolog.Event)
type EventPartialCompletion ¶ added in v0.4.1
type EventPartialCompletion struct { EventImpl Delta string `json:"delta"` // This is the complete completion string so far (when using openai, this is currently also the toolcall json) Completion string `json:"completion"` }
EventPartialCompletion is the event type for textual partial completion. We don't support partial tool completion.
func NewPartialCompletionEvent ¶ added in v0.4.13
func NewPartialCompletionEvent(metadata EventMetadata, stepMetadata *steps.StepMetadata, delta string, completion string) *EventPartialCompletion
func (EventPartialCompletion) MarshalZerologObject ¶ added in v0.4.13
func (e EventPartialCompletion) MarshalZerologObject(ev *zerolog.Event)
type EventPartialCompletionStart ¶ added in v0.4.13
type EventPartialCompletionStart struct {
EventImpl
}
func NewStartEvent ¶ added in v0.4.13
func NewStartEvent(metadata EventMetadata, stepMetadata *steps.StepMetadata) *EventPartialCompletionStart
func (EventPartialCompletionStart) MarshalZerologObject ¶ added in v0.4.13
func (e EventPartialCompletionStart) MarshalZerologObject(ev *zerolog.Event)
type EventText ¶ added in v0.4.1
TODO(manuel, 2024-07-05) This might be possible to delete
func NewTextEvent ¶ added in v0.4.13
func NewTextEvent(metadata EventMetadata, stepMetadata *steps.StepMetadata, text string) *EventText
func (EventText) MarshalZerologObject ¶ added in v0.4.13
type EventToolCall ¶ added in v0.4.13
TODO(manuel, 2024-07-04) Handle multiple tool calls
func NewToolCallEvent ¶ added in v0.4.13
func NewToolCallEvent(metadata EventMetadata, stepMetadata *steps.StepMetadata, toolCall ToolCall) *EventToolCall
func (EventToolCall) MarshalZerologObject ¶ added in v0.4.13
func (e EventToolCall) MarshalZerologObject(ev *zerolog.Event)
type EventToolResult ¶ added in v0.4.13
type EventToolResult struct { EventImpl ToolResult ToolResult `json:"tool_result"` }
func NewToolResultEvent ¶ added in v0.4.13
func NewToolResultEvent(metadata EventMetadata, stepMetadata *steps.StepMetadata, toolResult ToolResult) *EventToolResult
func (EventToolResult) MarshalZerologObject ¶ added in v0.4.13
func (e EventToolResult) MarshalZerologObject(ev *zerolog.Event)
type EventType ¶ added in v0.2.24
type EventType string
const ( // EventTypeStart to EventTypeFinal are for text completion, actually EventTypeStart EventType = "start" EventTypeFinal EventType = "final" EventTypePartialCompletion EventType = "partial" // TODO(manuel, 2024-07-04) I'm not sure if this is needed EventTypeStatus EventType = "status" // TODO(manuel, 2024-07-04) Should potentially have a EventTypeText for a block stop here EventTypeToolCall EventType = "tool-call" EventTypeToolResult EventType = "tool-result" 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 Step ¶
type Step steps.Step[conversation.Conversation, string]
type StepOption ¶ added in v0.2.24
func WithPublishedTopic ¶ added in v0.4.5
func WithPublishedTopic(publisher message.Publisher, topic string) StepOption
type ToolCall ¶ added in v0.4.1
type ToolCall struct { ID string `json:"id"` Name string `json:"name"` Input string `json:"input"` }
func (ToolCall) MarshalZerologObject ¶ added in v0.4.13
type ToolResult ¶ added in v0.4.13
func (ToolResult) MarshalZerologObject ¶ added in v0.4.13
func (tr ToolResult) MarshalZerologObject(ev *zerolog.Event)
Click to show internal directories.
Click to hide internal directories.