Documentation
¶
Index ¶
- Constants
- type ActionExecuted
- type ActionExecutionRejected
- type ActionName
- type ActionReverted
- type ActiveLoop
- type AgentUttered
- type AllSlotsReset
- type BotUttered
- type Button
- type ConversationPaused
- type ConversationResumed
- type Domain
- type DomainConfig
- type Entity
- type EntityName
- type Event
- type EventType
- type Events
- type FollowupAction
- type Intent
- type IntentDescription
- type IntentName
- type JSONMap
- type LoopInterrupted
- type Message
- type ParseResult
- type ReminderCancelled
- type ReminderScheduled
- type Restarted
- type SessionStarted
- type SlotDescription
- type SlotName
- type SlotSet
- type Slots
- type StoryExported
- type TActiveLoop
- type TemplateDescription
- type Time
- type Tracker
- func (t *Tracker) Entity(entity, role, group string) (value interface{})
- func (t *Tracker) EntityValues(entity, role, group string) (values []interface{})
- func (t *Tracker) HasActiveForm() bool
- func (t *Tracker) HasActiveLoop() bool
- func (t *Tracker) HasSlots() bool
- func (t *Tracker) LatestEntityValues(entity, role, group string) (values []interface{})
- func (t *Tracker) Slot(name string) (val interface{}, ok bool)
- func (t *Tracker) SlotAs(name string, dst interface{}) (ok bool)
- func (t *Tracker) SlotsToValidate() (slots Slots)
- type UserFeaturization
- type UserUtteranceReverted
- type UserUttered
Constants ¶
const ( // DefaultServerPort is the default port for the Rasa Action Server. // // This port is used for both the `/webhook` and `/nlg` endpoints. DefaultServerPort = "5055" // DefaultRasaAPIPort is the default port for the Rasa API. // // Used by the webhooks package. DefaultRasaAPIPort = "5005" // DefaultRasaEndpoint is the default endpoint used by webhook clients. DefaultRasaEndpoint = "http://localhost:5005" )
const ( EventTypeActionExecuted = EventType("action") EventTypeActionExecutionRejected = EventType("action_execution_rejected") EventTypeActionReverted = EventType("undo") EventTypeActiveLoop = EventType("active_loop") EventTypeAgentUttered = EventType("agent") EventTypeAllSlotsReset = EventType("reset_slots") EventTypeBotUttered = EventType("bot") EventTypeConversationPaused = EventType("pause") EventTypeConversationResumed = EventType("resume") EventTypeFollowupAction = EventType("followup") EventTypeLoopInterrupted = EventType("loop_interrupted") EventTypeReminderCancelled = EventType("cancel_reminder") EventTypeReminderScheduled = EventType("reminder") EventTypeRestarted = EventType("restart") EventTypeSessionStarted = EventType("session_started") EventTypeSlotSet = EventType("slot") EventTypeStoryExported = EventType("export") EventTypeUserFeaturization = EventType("user_featurization") EventTypeUserUtteranceReverted = EventType("rewind") EventTypeUserUttered = EventType("user") )
TODO
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionExecuted ¶
type ActionExecuted struct { Timestamp Time `json:"timestamp,omitempty"` ActionName string `json:"name"` Policy string `json:"policy,omitempty"` Confidence float32 `json:"confidence,omitempty"` }
ActionExecuted TODO
func (*ActionExecuted) MarshalJSON ¶
func (e *ActionExecuted) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type ActionExecutionRejected ¶
type ActionExecutionRejected struct { Timestamp Time `json:"timestamp,omitempty"` ActionName string `json:"name"` Policy string `json:"policy,omitempty"` Confidence float32 `json:"confidence,omitempty"` }
ActionExecutionRejected TODO
func (*ActionExecutionRejected) MarshalJSON ¶
func (e *ActionExecutionRejected) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (ActionExecutionRejected) Time ¶
func (e ActionExecutionRejected) Time() time.Time
Time implements Event.
func (ActionExecutionRejected) Type ¶
func (ActionExecutionRejected) Type() EventType
Type implements Event.
type ActionReverted ¶
type ActionReverted struct {
Timestamp Time `json:"timestamp,omitempty"`
}
ActionReverted TODO
func (*ActionReverted) MarshalJSON ¶
func (e *ActionReverted) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type ActiveLoop ¶
type ActiveLoop struct { Timestamp Time `json:"timestamp,omitempty"` Name string `json:"name,omitempty"` }
ActiveLoop TODO
func (*ActiveLoop) MarshalJSON ¶
func (e *ActiveLoop) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type AgentUttered ¶
type AgentUttered struct { Timestamp Time `json:"timestamp,omitempty"` Text string `json:"test,omitempty"` Data JSONMap `json:"data,omitempty"` }
AgentUttered TODO
func (*AgentUttered) MarshalJSON ¶
func (e *AgentUttered) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type AllSlotsReset ¶
type AllSlotsReset struct {
Timestamp Time `json:"timestamp,omitempty"`
}
AllSlotsReset TODO
func (*AllSlotsReset) MarshalJSON ¶
func (e *AllSlotsReset) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type BotUttered ¶
type BotUttered struct { Timestamp Time `json:"timestamp,omitempty"` Text string `json:"text,omitempty"` Data JSONMap `json:"data,omitempty"` Metadata JSONMap `json:"metadata,omitempty"` }
BotUttered TODO
func (*BotUttered) MarshalJSON ¶
func (e *BotUttered) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type Button ¶
type Button struct { // Title holds teh text on the button. Title string `json:"title"` // Payload holds the payload being sent if the button is pressed. Payload string `json:"payload"` }
Button defines the structure of a Button response.
A button can be clicked by the user in a conversation.
type ConversationPaused ¶
type ConversationPaused struct {
Timestamp Time `json:"timestamp,omitempty"`
}
ConversationPaused TODO
func (*ConversationPaused) MarshalJSON ¶
func (e *ConversationPaused) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (ConversationPaused) Time ¶
func (e ConversationPaused) Time() time.Time
Time implements Event.
type ConversationResumed ¶
type ConversationResumed struct {
Timestamp Time `json:"timestamp,omitempty"`
}
ConversationResumed TODO
func (*ConversationResumed) MarshalJSON ¶
func (e *ConversationResumed) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (ConversationResumed) Time ¶
func (e ConversationResumed) Time() time.Time
Time implements Event.
func (ConversationResumed) Type ¶
func (ConversationResumed) Type() EventType
Type implements Event.
type Domain ¶
type Domain struct { Config DomainConfig `json:"config"` Intents []IntentDescription `json:"intents"` Entities []string `json:"entities"` Slots map[string]SlotDescription `json:"slots"` Responses map[string][]TemplateDescription `json:"responses"` Actions []string `json:"actions"` }
Domain contains the configuration of the AI's domain as sent to the action server by Rasa's engine.
type DomainConfig ¶
type DomainConfig struct {
StoreEntitiesAsSlots bool `json:"store_entities_as_slots"`
}
DomainConfig contains domain settings.
type Entity ¶
type Entity struct { Start int `json:"start"` End int `json:"end"` Value interface{} `json:"value"` Entity string `json:"entity"` Confidence float64 `json:"confidence"` Group string `json:"group,omitempty"` Role string `json:"role,omitempty"` Extractor string `json:"extractor"` }
Entity describes an entity and its detected location, value, and confidence.
type Event ¶
type Event interface { // Type returns the constant representing the event's type in a marshalled // JSON object. Type() EventType // Timestamp returns the timestamp associated with the event as an instance // of time.Time. Time() time.Time }
Event represents a serializable event object.
type Events ¶
type Events []Event
Events implements JSON Unmarshaling of Rasa's Event types.
func (*Events) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type FollowupAction ¶
type FollowupAction struct { Timestamp Time `json:"timestamp,omitempty"` ActionName string `json:"name"` }
FollowupAction TODO
func (*FollowupAction) MarshalJSON ¶
func (e *FollowupAction) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type Intent ¶
type Intent struct { Confidence float64 `json:"confidence,omitempty"` Name string `json:"name,omitempty"` }
Intent describes an intent and its detected confidence.
type IntentDescription ¶
type IntentDescription struct {
UseEntities bool `json:"use_entities"`
}
IntentDescription contains a domain intent description.
type JSONMap ¶
type JSONMap = map[string]interface{}
JSONMap is a descriptive type alias for a free-form JSON Object.
type LoopInterrupted ¶
type LoopInterrupted struct { Timestamp Time `json:"timestamp,omitempty"` IsInterrupted bool `json:"is_interrupted,omitempty"` }
LoopInterrupted TODO
func (*LoopInterrupted) MarshalJSON ¶
func (e *LoopInterrupted) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type Message ¶
type Message struct { // RecipientID is used by Rasa for messages sent over an output channel. RecipientID string `json:"recipient_id,omitempty"` // Text contains a text payload. Text string `json:"text,omitempty"` // Image contains an image payload in the form of an URL. For direct image // transfer, use a data-url. Image string `json:"image,omitempty"` // JSONMessage allows custom data to be included in the payload. JSONMessage JSONMap `json:"json_message,omitempty"` // Template holds a template name to be used. // // A client should never consult this field. It is used by NLG and // Rasa-internal endpoints to generate responses based on templates when the // template identifiers are returned by a custom action server. Template string `json:"template,omitempty"` // Buttons contains a list of clickable buttons that should be rendered by // the UI. Buttons []Button `json:"buttons,omitempty"` // Attachment. Attachment string `json:"attachment,omitempty"` // Elements. Elements []JSONMap `json:"elements,omitempty"` // Kwargs holds additional fields at the root level of the object that are // not otherwise provided in the default Message struct. // // Kwargs are used internally by the action server. Prefer using the // JSONMessage field if custom payloads are required to avoid conflicts with // the library. Kwargs JSONMap `json:"-"` // FIXME implement custom ser/de }
Message TODO
func (*Message) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Message) WithKwargs ¶
WithKwargs adds the free-form kwargs to the m.Kwargs.
type ParseResult ¶
type ParseResult struct { Intent Intent `json:"intent"` IntentRanking []Intent `json:"intent_ranking,omitempty"` Entities []Entity `json:"entities,omitempty"` Text string `json:"text,omitempty"` }
ParseResult holds a processed (parsed) message description.
type ReminderCancelled ¶
type ReminderCancelled struct { Timestamp Time `json:"timestamp,omitempty"` Name string `json:"name,omitempty"` IntentName string `json:"intent,omitempty"` Entities []JSONMap `json:"entities,omitempty"` }
ReminderCancelled TODO
func (*ReminderCancelled) MarshalJSON ¶
func (e *ReminderCancelled) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type ReminderScheduled ¶
type ReminderScheduled struct { Timestamp Time `json:"timestamp,omitempty"` Name string `json:"name,omitempty"` IntentName string `json:"intent,omitempty"` Entities []JSONMap `json:"entities,omitempty"` DateTime time.Time `json:"date_time"` KillOnUserMessage bool `json:"kill_on_user_msg"` }
ReminderScheduled TODO
func (*ReminderScheduled) MarshalJSON ¶
func (e *ReminderScheduled) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type Restarted ¶
type Restarted struct {
Timestamp Time `json:"timestamp,omitempty"`
}
Restarted TODO
func (*Restarted) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
type SessionStarted ¶
type SessionStarted struct {
Timestamp Time `json:"timestamp,omitempty"`
}
SessionStarted TODO
func (*SessionStarted) MarshalJSON ¶
func (e *SessionStarted) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type SlotDescription ¶
type SlotDescription struct { AutoFill bool `json:"auto_fill"` Type string `json:"type"` InitialValue string `json:"initial_value,omitempty"` Values []string `json:"values,omitempty"` }
SlotDescription contains a domain slot description.
type SlotSet ¶
type SlotSet struct { Timestamp Time `json:"timestamp,omitempty"` Key string `json:"name"` Value interface{} `json:"value,omitempty"` }
SlotSet TODO
func (*SlotSet) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
type Slots ¶
type Slots map[string]interface{}
Slots is a wrapper type around slots.
type StoryExported ¶
type StoryExported struct {
Timestamp Time `json:"timestamp,omitempty"`
}
StoryExported TODO
func (*StoryExported) MarshalJSON ¶
func (e *StoryExported) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type TActiveLoop ¶
type TActiveLoop struct { Name string `json:"name"` Validate *bool `json:"validate,omitempty"` Rejected bool `json:"rejected,omitempty"` TriggerMessage *ParseResult `json:"trigger_message"` }
TActiveLoop holds a ActiveLoop description in the Tracker.
func (*TActiveLoop) Is ¶
func (f *TActiveLoop) Is(name string) bool
Is returns whether f represents a Form with the provided name.
func (*TActiveLoop) IsActive ¶
func (f *TActiveLoop) IsActive() bool
IsActive returns whether f represents an active Form.
func (*TActiveLoop) ShouldValidate ¶
func (f *TActiveLoop) ShouldValidate() bool
ShouldValidate returns whether the form should validate itself. It will return true unless validation has been explicitely disabled.
type TemplateDescription ¶
type TemplateDescription struct { // the template text Text string }
TemplateDescription contains a domain template description.
type Time ¶
Time provides a type alias around time.Time which serializes as an int64 for proper interaction with Rasa.
During both serializing and deserializing, all sub-second precision is dropped.
func (Time) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type Tracker ¶
type Tracker struct { SenderID string `json:"sender_id"` Slots Slots `json:"slots,omitempty"` LatestMessage *ParseResult `json:"latest_message,omitempty"` LatestActionName string `json:"latest_action_name,omitempty"` Events Events `json:"events"` Paused bool `json:"paused"` FollowupAction string `json:"followup_action,omitempty"` ActiveLoop *TActiveLoop `json:"active_loop,omitempty"` }
Tracker contains the state of the Tracker sent to the action server by the Rasa engine.
func (*Tracker) Entity ¶
Entity returns the current value of the requested entity, or nil if the entity has no value.
If the entity has more than one possible value, the first is returned.
func (*Tracker) EntityValues ¶
EntityValues returns the current value of the requested entity as a slice. The slice may be empty, and may contain 0 or more entries.
func (*Tracker) HasActiveForm ¶
HasActiveForm returns whether the Tracker state represents an active Form.
func (*Tracker) HasActiveLoop ¶
HasActiveLoop returns whether the Tracker state represents an active Loop.
func (*Tracker) LatestEntityValues ¶
LatestEntityValues returns the entity values found for the passed entity name in the latest message.
func (*Tracker) Slot ¶
Slot returns the value of the slot as an interface. The `ok` flag indicates whether the slot was present.
func (*Tracker) SlotAs ¶
SlotAs attempts to assign the value of the slot to the `dst` pointer. The `ok` flag indicates whether the slot was present, and successfully assigned to `dst`.
Passing a non-assignable type to `dst` leads to undefined behaviour.
func (*Tracker) SlotsToValidate ¶
SlotsToValidate returns the slots which were recently set.
This can be used to validate form slots after they were extracted.
type UserFeaturization ¶
type UserFeaturization struct { Timestamp Time `json:"timestamp,omitempty"` UseTextForFeaturization bool `json:"use_text_for_featurization"` }
UserFeaturization TODO
func (*UserFeaturization) MarshalJSON ¶
func (e *UserFeaturization) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type UserUtteranceReverted ¶
type UserUtteranceReverted struct {
Timestamp Time `json:"timestamp,omitempty"`
}
UserUtteranceReverted TODO
func (*UserUtteranceReverted) MarshalJSON ¶
func (e *UserUtteranceReverted) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (UserUtteranceReverted) Time ¶
func (e UserUtteranceReverted) Time() time.Time
Time implements Event.
func (UserUtteranceReverted) Type ¶
func (UserUtteranceReverted) Type() EventType
Type implements Event.
type UserUttered ¶
type UserUttered struct { Timestamp Time `json:"timestamp,omitempty"` Text string `json:"text,omitempty"` ParseData *ParseResult `json:"parse_data,omitempty"` InputChannel string `json:"input_channel,omitempty"` Metadata JSONMap `json:"metadata,omitempty"` // experimental }
UserUttered TODO
func (*UserUttered) MarshalJSON ¶
func (e *UserUttered) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
form
Package form implements Form Actions for Rasa.
|
Package form implements Form Actions for Rasa. |
knowledge
Package knowledge implements the Knowledge Base component for Rasa.
|
Package knowledge implements the Knowledge Base component for Rasa. |
rasagen
rasagen CLI contains code generators that deal with the boilerplate of implementing an ActionServer for Rasa in Go.
|
rasagen CLI contains code generators that deal with the boilerplate of implementing an ActionServer for Rasa in Go. |
Package events provides types for consumers of events passed to event brokers.
|
Package events provides types for consumers of events passed to event brokers. |
examples
|
|
helloworld
Package main contains an implementation of a "hello world" example to demo the usage of the Rasa SDK.
|
Package main contains an implementation of a "hello world" example to demo the usage of the Rasa SDK. |
Package nlg implements a framework for Natural Language Generation for Rasa's custom NLG endpoint.
|
Package nlg implements a framework for Natural Language Generation for Rasa's custom NLG endpoint. |