Documentation
¶
Overview ¶
Package tools contains the beta LiveKit agent tools.
Index ¶
- Constants
- Variables
- func CreateEndCallTool[UserData any](options EndCallToolOptions[UserData]) (*llm.Toolset, error)
- func DTMFEventCode(event DTMFEvent) (uint32, error)
- func MustEndCallTool[UserData any](options EndCallToolOptions[UserData]) *llm.Toolset
- func MustSendDTMFEventsTool(options SendDTMFEventsToolOptions) *llm.FunctionTool[SendDTMFEventsInput, string]
- func NewEndCallTool[UserData any](options EndCallToolOptions[UserData]) (*llm.Toolset, error)
- func NewSendDTMFEventsTool(options SendDTMFEventsToolOptions) (*llm.FunctionTool[SendDTMFEventsInput, string], error)
- func NewSendDtmfEventsTool(options SendDTMFEventsToolOptions) (*llm.FunctionTool[SendDTMFEventsInput, string], error)
- func SendDTMFEvents(ctx context.Context, publisher DTMFPublisher, events []DTMFEvent, ...) string
- func SendDtmfEvents(ctx context.Context, publisher DTMFPublisher, events []DtmfEvent, ...) string
- type DTMFEvent
- type DTMFPublisher
- type DtmfEvent
- type EndCallJob
- type EndCallSession
- type EndCallToolCalledEvent
- type EndCallToolCompletedEvent
- type EndCallToolOptions
- type EndCallToolOutput
- type LocalParticipantDTMFPublisher
- type SendDTMFEventsInput
- type SendDTMFEventsToolOptions
- type SendDTMFOptions
Constants ¶
const DefaultDTMFPublishDelay = 300 * time.Millisecond
const DefaultEndCallReplyTimeout = 5 * time.Second
const END_CALL_DESCRIPTION = EndCallDescription
END_CALL_DESCRIPTION is the deprecated TypeScript-style constant alias.
const EndCallDescription = `` /* 395-byte string literal not displayed */
Variables ¶
Functions ¶
func CreateEndCallTool ¶
func CreateEndCallTool[UserData any](options EndCallToolOptions[UserData]) (*llm.Toolset, error)
func DTMFEventCode ¶
func MustEndCallTool ¶
func MustEndCallTool[UserData any](options EndCallToolOptions[UserData]) *llm.Toolset
func MustSendDTMFEventsTool ¶
func MustSendDTMFEventsTool(options SendDTMFEventsToolOptions) *llm.FunctionTool[SendDTMFEventsInput, string]
func NewEndCallTool ¶
func NewEndCallTool[UserData any](options EndCallToolOptions[UserData]) (*llm.Toolset, error)
NewEndCallTool is the Go constructor alias for CreateEndCallTool.
func NewSendDTMFEventsTool ¶
func NewSendDTMFEventsTool(options SendDTMFEventsToolOptions) (*llm.FunctionTool[SendDTMFEventsInput, string], error)
func NewSendDtmfEventsTool ¶
func NewSendDtmfEventsTool(options SendDTMFEventsToolOptions) (*llm.FunctionTool[SendDTMFEventsInput, string], error)
NewSendDtmfEventsTool is deprecated; prefer NewSendDTMFEventsTool.
func SendDTMFEvents ¶
func SendDTMFEvents(ctx context.Context, publisher DTMFPublisher, events []DTMFEvent, options SendDTMFOptions) string
SendDTMFEvents publishes events sequentially and preserves agents-js's exact human-readable tool output contract. Failures are returned in-band so the LLM can report which digit failed.
func SendDtmfEvents ¶
func SendDtmfEvents(ctx context.Context, publisher DTMFPublisher, events []DtmfEvent, options SendDTMFOptions) string
SendDtmfEvents is deprecated; prefer SendDTMFEvents.
Types ¶
type DTMFEvent ¶
type DTMFEvent string
const ( DTMF0 DTMFEvent = "0" DTMF1 DTMFEvent = "1" DTMF2 DTMFEvent = "2" DTMF3 DTMFEvent = "3" DTMF4 DTMFEvent = "4" DTMF5 DTMFEvent = "5" DTMF6 DTMFEvent = "6" DTMF7 DTMFEvent = "7" DTMF8 DTMFEvent = "8" DTMF9 DTMFEvent = "9" DTMFStar DTMFEvent = "*" DTMFPound DTMFEvent = "#" DTMFA DTMFEvent = "A" DTMFB DTMFEvent = "B" DTMFC DTMFEvent = "C" DTMFD DTMFEvent = "D" )
type DTMFPublisher ¶
func AdaptDTMFJobContext ¶
func AdaptDTMFJobContext[UserData any](job *agents.JobContext[UserData]) DTMFPublisher
func RoomDTMFPublisher ¶
func RoomDTMFPublisher(room *lksdk.Room) DTMFPublisher
type DtmfEvent ¶
type DtmfEvent = DTMFEvent
DtmfEvent is the deprecated initialism alias retained for agents-js beta migrations. Prefer DTMFEvent.
type EndCallJob ¶
type EndCallJob interface {
AddShutdownCallback(func(context.Context, string) error) error
DeleteRoom(context.Context, string) error
Shutdown(string)
}
func AdaptEndCallJobContext ¶
func AdaptEndCallJobContext[UserData any](job *agents.JobContext[UserData]) EndCallJob
type EndCallSession ¶
type EndCallSession interface {
Subscribe(voice.EventSubscriptionOptions) (*voice.EventSubscription, error)
AgentState() voice.AgentState
Close(context.Context, ...voice.CloseOptions) error
}
type EndCallToolCalledEvent ¶
type EndCallToolCalledEvent[UserData any] struct { Context *llm.RunContext Arguments struct{} }
type EndCallToolCompletedEvent ¶
type EndCallToolCompletedEvent[UserData any] struct { Context *llm.RunContext Output *EndCallToolOutput }
type EndCallToolOptions ¶
type EndCallToolOptions[UserData any] struct { ExtraDescription string // Nil preserves the agents-js default (true). DeleteRoom *bool // Zero inherits "say goodbye to the user". Disable maps to null. EndInstructions agents.Override[string] IgnoreOnEnter bool OnToolCalled func(context.Context, EndCallToolCalledEvent[UserData]) error OnToolCompleted func(context.Context, EndCallToolCompletedEvent[UserData]) error Job EndCallJob ReplyTimeout time.Duration ShutdownTimeout time.Duration OnError func(error) }
type EndCallToolOutput ¶
type EndCallToolOutput struct{ Type, Value string }
type LocalParticipantDTMFPublisher ¶
type LocalParticipantDTMFPublisher struct{ Participant *lksdk.LocalParticipant }
LocalParticipantDTMFPublisher adapts server-sdk-go's typed SIP DTMF data packet. PublishDataPacket is synchronous but not context-aware; the adapter checks cancellation immediately before the call.
func (LocalParticipantDTMFPublisher) PublishDTMF ¶
type SendDTMFEventsInput ¶
type SendDTMFEventsInput struct {
Events []DTMFEvent `json:"events"`
}
type SendDTMFEventsToolOptions ¶
type SendDTMFEventsToolOptions struct {
Publisher DTMFPublisher
ResolvePublisher func(llm.ToolOptions) (DTMFPublisher, error)
PublishDelay time.Duration
}