Documentation
¶
Overview ¶
Package assistantv2 : Operations and models for the AssistantV2 service
Index ¶
- Constants
- type AssistantV2
- func (assistant *AssistantV2) CreateSession(createSessionOptions *CreateSessionOptions) (result *SessionResponse, response *core.DetailedResponse, err error)
- func (assistant *AssistantV2) DeleteSession(deleteSessionOptions *DeleteSessionOptions) (response *core.DetailedResponse, err error)
- func (assistant *AssistantV2) DisableSSLVerification()
- func (assistant *AssistantV2) Message(messageOptions *MessageOptions) (result *MessageResponse, response *core.DetailedResponse, err error)
- func (assistant *AssistantV2) MessageStateless(messageStatelessOptions *MessageStatelessOptions) (result *MessageResponseStateless, response *core.DetailedResponse, err error)
- func (assistant *AssistantV2) NewCaptureGroup(group string) (model *CaptureGroup, err error)
- func (assistant *AssistantV2) NewCreateSessionOptions(assistantID string) *CreateSessionOptions
- func (assistant *AssistantV2) NewDeleteSessionOptions(assistantID string, sessionID string) *DeleteSessionOptions
- func (assistant *AssistantV2) NewMessageOptions(assistantID string, sessionID string) *MessageOptions
- func (assistant *AssistantV2) NewMessageStatelessOptions(assistantID string) *MessageStatelessOptions
- func (assistant *AssistantV2) NewRuntimeEntity(entity string, location []int64, value string) (model *RuntimeEntity, err error)
- func (assistant *AssistantV2) NewRuntimeIntent(intent string, confidence float64) (model *RuntimeIntent, err error)
- func (assistant *AssistantV2) SetServiceURL(url string) error
- type AssistantV2Options
- type CaptureGroup
- type CreateSessionOptions
- type DeleteSessionOptions
- type DialogLogMessage
- type DialogNodeAction
- type DialogNodeOutputOptionsElement
- type DialogNodeOutputOptionsElementValue
- type DialogNodesVisited
- type DialogSuggestion
- type DialogSuggestionValue
- type MessageContext
- type MessageContextGlobal
- type MessageContextGlobalStateless
- type MessageContextGlobalSystem
- type MessageContextSkill
- type MessageContextSkillSystem
- type MessageContextSkills
- type MessageContextStateless
- type MessageInput
- type MessageInputOptions
- type MessageInputOptionsSpelling
- type MessageInputOptionsStateless
- type MessageInputStateless
- type MessageOptions
- func (options *MessageOptions) SetAssistantID(assistantID string) *MessageOptions
- func (options *MessageOptions) SetContext(context *MessageContext) *MessageOptions
- func (options *MessageOptions) SetHeaders(param map[string]string) *MessageOptions
- func (options *MessageOptions) SetInput(input *MessageInput) *MessageOptions
- func (options *MessageOptions) SetSessionID(sessionID string) *MessageOptions
- type MessageOutput
- type MessageOutputDebug
- type MessageOutputSpelling
- type MessageResponse
- type MessageResponseStateless
- type MessageStatelessOptions
- func (options *MessageStatelessOptions) SetAssistantID(assistantID string) *MessageStatelessOptions
- func (options *MessageStatelessOptions) SetContext(context *MessageContextStateless) *MessageStatelessOptions
- func (options *MessageStatelessOptions) SetHeaders(param map[string]string) *MessageStatelessOptions
- func (options *MessageStatelessOptions) SetInput(input *MessageInputStateless) *MessageStatelessOptions
- type RuntimeEntity
- type RuntimeEntityAlternative
- type RuntimeEntityInterpretation
- type RuntimeEntityRole
- type RuntimeIntent
- type RuntimeResponseGeneric
- type SearchResult
- type SearchResultHighlight
- func (this *SearchResultHighlight) GetBody() *[]string
- func (this *SearchResultHighlight) GetProperty(Key string) *[]string
- func (this *SearchResultHighlight) GetTitle() *[]string
- func (this *SearchResultHighlight) GetURL() *[]string
- func (this *SearchResultHighlight) SetBody(Body *[]string)
- func (this *SearchResultHighlight) SetProperty(Key string, Value *[]string)
- func (this *SearchResultHighlight) SetTitle(Title *[]string)
- func (this *SearchResultHighlight) SetURL(URL *[]string)
- type SearchResultMetadata
- type SessionResponse
Constants ¶
const ( DialogLogMessage_Level_Error = "error" DialogLogMessage_Level_Info = "info" DialogLogMessage_Level_Warn = "warn" )
Constants associated with the DialogLogMessage.Level property. The severity of the log message.
const ( DialogNodeAction_Type_Client = "client" DialogNodeAction_Type_CloudFunction = "cloud-function" DialogNodeAction_Type_Server = "server" DialogNodeAction_Type_WebAction = "web-action" )
Constants associated with the DialogNodeAction.Type property. The type of action to invoke.
const ( MessageContextGlobalSystem_Locale_ArAr = "ar-ar" MessageContextGlobalSystem_Locale_CsCz = "cs-cz" MessageContextGlobalSystem_Locale_DeDe = "de-de" MessageContextGlobalSystem_Locale_EnCa = "en-ca" MessageContextGlobalSystem_Locale_EnGb = "en-gb" MessageContextGlobalSystem_Locale_EnUs = "en-us" MessageContextGlobalSystem_Locale_EsEs = "es-es" MessageContextGlobalSystem_Locale_FrFr = "fr-fr" MessageContextGlobalSystem_Locale_ItIt = "it-it" MessageContextGlobalSystem_Locale_JaJp = "ja-jp" MessageContextGlobalSystem_Locale_KoKr = "ko-kr" MessageContextGlobalSystem_Locale_NlNl = "nl-nl" MessageContextGlobalSystem_Locale_PtBr = "pt-br" MessageContextGlobalSystem_Locale_ZhCn = "zh-cn" MessageContextGlobalSystem_Locale_ZhTw = "zh-tw" )
Constants associated with the MessageContextGlobalSystem.Locale property. The language code for localization in the user input. The specified locale overrides the default for the assistant, and is used for interpreting entity values in user input such as date values. For example, `04/03/2018` might be interpreted either as April 3 or March 4, depending on the locale.
This property is included only if the new system entities are enabled for the skill.
const ( MessageOutputDebug_BranchExitedReason_Completed = "completed" MessageOutputDebug_BranchExitedReason_Fallback = "fallback" )
Constants associated with the MessageOutputDebug.BranchExitedReason property. When `branch_exited` is set to `true` by the Assistant, the `branch_exited_reason` specifies whether the dialog completed by itself or got interrupted.
const ( RuntimeEntityInterpretation_Granularity_Day = "day" RuntimeEntityInterpretation_Granularity_Fortnight = "fortnight" RuntimeEntityInterpretation_Granularity_Hour = "hour" RuntimeEntityInterpretation_Granularity_Instant = "instant" RuntimeEntityInterpretation_Granularity_Minute = "minute" RuntimeEntityInterpretation_Granularity_Month = "month" RuntimeEntityInterpretation_Granularity_Quarter = "quarter" RuntimeEntityInterpretation_Granularity_Second = "second" RuntimeEntityInterpretation_Granularity_Week = "week" RuntimeEntityInterpretation_Granularity_Weekend = "weekend" RuntimeEntityInterpretation_Granularity_Year = "year" )
Constants associated with the RuntimeEntityInterpretation.Granularity property. The precision or duration of a time range specified by a recognized `@sys-time` or `@sys-date` entity.
const ( RuntimeEntityRole_Type_DateFrom = "date_from" RuntimeEntityRole_Type_DateTo = "date_to" RuntimeEntityRole_Type_NumberFrom = "number_from" RuntimeEntityRole_Type_NumberTo = "number_to" RuntimeEntityRole_Type_TimeFrom = "time_from" RuntimeEntityRole_Type_TimeTo = "time_to" )
Constants associated with the RuntimeEntityRole.Type property. The relationship of the entity to the range.
const ( RuntimeResponseGeneric_ResponseType_ConnectToAgent = "connect_to_agent" RuntimeResponseGeneric_ResponseType_Image = "image" RuntimeResponseGeneric_ResponseType_Option = "option" RuntimeResponseGeneric_ResponseType_Pause = "pause" RuntimeResponseGeneric_ResponseType_Search = "search" RuntimeResponseGeneric_ResponseType_Suggestion = "suggestion" RuntimeResponseGeneric_ResponseType_Text = "text" )
Constants associated with the RuntimeResponseGeneric.ResponseType property. The type of response returned by the dialog node. The specified response type must be supported by the client application or channel.
**Note:** The **suggestion** response type is part of the disambiguation feature, which is only available for Premium users.
const ( RuntimeResponseGeneric_Preference_Button = "button" RuntimeResponseGeneric_Preference_Dropdown = "dropdown" )
Constants associated with the RuntimeResponseGeneric.Preference property. The preferred type of control to display.
const DefaultServiceName = "conversation"
DefaultServiceName is the default key used to find external configuration information.
const DefaultServiceURL = "https://gateway.watsonplatform.net/assistant/api"
DefaultServiceURL is the default URL to make service requests to.
const (
MessageInputStateless_MessageType_Text = "text"
)
Constants associated with the MessageInputStateless.MessageType property. The type of user input. Currently, only text input is supported.
const (
MessageInput_MessageType_Text = "text"
)
Constants associated with the MessageInput.MessageType property. The type of user input. Currently, only text input is supported.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssistantV2 ¶
type AssistantV2 struct {
Service *core.BaseService
Version string
}
AssistantV2 : The IBM Watson™ Assistant service combines machine learning, natural language understanding, and an integrated dialog editor to create conversation flows between your apps and your users.
The Assistant v2 API provides runtime methods your client application can use to send user input to an assistant and receive a response.
Version: 2.0 See: https://cloud.ibm.com/docs/assistant/
func NewAssistantV2 ¶
func NewAssistantV2(options *AssistantV2Options) (service *AssistantV2, err error)
NewAssistantV2 : constructs an instance of AssistantV2 with passed in options.
func (*AssistantV2) CreateSession ¶
func (assistant *AssistantV2) CreateSession(createSessionOptions *CreateSessionOptions) (result *SessionResponse, response *core.DetailedResponse, err error)
CreateSession : Create a session Create a new session. A session is used to send user input to a skill and receive responses. It also maintains the state of the conversation. A session persists until it is deleted, or until it times out because of inactivity. (For more information, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-settings).
func (*AssistantV2) DeleteSession ¶
func (assistant *AssistantV2) DeleteSession(deleteSessionOptions *DeleteSessionOptions) (response *core.DetailedResponse, err error)
DeleteSession : Delete session Deletes a session explicitly before it times out. (For more information about the session inactivity timeout, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-settings)).
func (*AssistantV2) DisableSSLVerification ¶ added in v1.0.0
func (assistant *AssistantV2) DisableSSLVerification()
DisableSSLVerification bypasses verification of the server's SSL certificate
func (*AssistantV2) Message ¶
func (assistant *AssistantV2) Message(messageOptions *MessageOptions) (result *MessageResponse, response *core.DetailedResponse, err error)
Message : Send user input to assistant (stateful) Send user input to an assistant and receive a response, with conversation state (including context data) stored by Watson Assistant for the duration of the session.
There is no rate limit for this operation.
func (*AssistantV2) MessageStateless ¶ added in v1.6.0
func (assistant *AssistantV2) MessageStateless(messageStatelessOptions *MessageStatelessOptions) (result *MessageResponseStateless, response *core.DetailedResponse, err error)
MessageStateless : Send user input to assistant (stateless) Send user input to an assistant and receive a response, with conversation state (including context data) managed by your application.
There is no rate limit for this operation.
func (*AssistantV2) NewCaptureGroup ¶ added in v1.3.0
func (assistant *AssistantV2) NewCaptureGroup(group string) (model *CaptureGroup, err error)
NewCaptureGroup : Instantiate CaptureGroup (Generic Model Constructor)
func (*AssistantV2) NewCreateSessionOptions ¶
func (assistant *AssistantV2) NewCreateSessionOptions(assistantID string) *CreateSessionOptions
NewCreateSessionOptions : Instantiate CreateSessionOptions
func (*AssistantV2) NewDeleteSessionOptions ¶
func (assistant *AssistantV2) NewDeleteSessionOptions(assistantID string, sessionID string) *DeleteSessionOptions
NewDeleteSessionOptions : Instantiate DeleteSessionOptions
func (*AssistantV2) NewMessageOptions ¶
func (assistant *AssistantV2) NewMessageOptions(assistantID string, sessionID string) *MessageOptions
NewMessageOptions : Instantiate MessageOptions
func (*AssistantV2) NewMessageStatelessOptions ¶ added in v1.6.0
func (assistant *AssistantV2) NewMessageStatelessOptions(assistantID string) *MessageStatelessOptions
NewMessageStatelessOptions : Instantiate MessageStatelessOptions
func (*AssistantV2) NewRuntimeEntity ¶ added in v1.3.0
func (assistant *AssistantV2) NewRuntimeEntity(entity string, location []int64, value string) (model *RuntimeEntity, err error)
NewRuntimeEntity : Instantiate RuntimeEntity (Generic Model Constructor)
func (*AssistantV2) NewRuntimeIntent ¶ added in v1.3.0
func (assistant *AssistantV2) NewRuntimeIntent(intent string, confidence float64) (model *RuntimeIntent, err error)
NewRuntimeIntent : Instantiate RuntimeIntent (Generic Model Constructor)
func (*AssistantV2) SetServiceURL ¶ added in v1.0.0
func (assistant *AssistantV2) SetServiceURL(url string) error
SetServiceURL sets the service URL
type AssistantV2Options ¶
type AssistantV2Options struct {
ServiceName string
URL string
Authenticator core.Authenticator
Version string
}
AssistantV2Options : Service options
type CaptureGroup ¶
type CaptureGroup struct {
// A recognized capture group for the entity.
Group *string `json:"group" validate:"required"`
// Zero-based character offsets that indicate where the entity value begins and ends in the input text.
Location []int64 `json:"location,omitempty"`
}
CaptureGroup : CaptureGroup struct
type CreateSessionOptions ¶
type CreateSessionOptions struct {
// Unique identifier of the assistant. To find the assistant ID in the Watson Assistant user interface, open the
// assistant settings and click **API Details**. For information about creating assistants, see the
// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task).
//
// **Note:** Currently, the v2 API does not support creating assistants.
AssistantID *string `json:"assistant_id" validate:"required"`
// Allows users to set headers to be GDPR compliant
Headers map[string]string
}
CreateSessionOptions : The CreateSession options.
func (*CreateSessionOptions) SetAssistantID ¶
func (options *CreateSessionOptions) SetAssistantID(assistantID string) *CreateSessionOptions
SetAssistantID : Allow user to set AssistantID
func (*CreateSessionOptions) SetHeaders ¶
func (options *CreateSessionOptions) SetHeaders(param map[string]string) *CreateSessionOptions
SetHeaders : Allow user to set Headers
type DeleteSessionOptions ¶
type DeleteSessionOptions struct {
// Unique identifier of the assistant. To find the assistant ID in the Watson Assistant user interface, open the
// assistant settings and click **API Details**. For information about creating assistants, see the
// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task).
//
// **Note:** Currently, the v2 API does not support creating assistants.
AssistantID *string `json:"assistant_id" validate:"required"`
// Unique identifier of the session.
SessionID *string `json:"session_id" validate:"required"`
// Allows users to set headers to be GDPR compliant
Headers map[string]string
}
DeleteSessionOptions : The DeleteSession options.
func (*DeleteSessionOptions) SetAssistantID ¶
func (options *DeleteSessionOptions) SetAssistantID(assistantID string) *DeleteSessionOptions
SetAssistantID : Allow user to set AssistantID
func (*DeleteSessionOptions) SetHeaders ¶
func (options *DeleteSessionOptions) SetHeaders(param map[string]string) *DeleteSessionOptions
SetHeaders : Allow user to set Headers
func (*DeleteSessionOptions) SetSessionID ¶
func (options *DeleteSessionOptions) SetSessionID(sessionID string) *DeleteSessionOptions
SetSessionID : Allow user to set SessionID
type DialogLogMessage ¶
type DialogLogMessage struct {
// The severity of the log message.
Level *string `json:"level" validate:"required"`
// The text of the log message.
Message *string `json:"message" validate:"required"`
}
DialogLogMessage : Dialog log message details.
type DialogNodeAction ¶
type DialogNodeAction struct {
// The name of the action.
Name *string `json:"name" validate:"required"`
// The type of action to invoke.
Type *string `json:"type,omitempty"`
// A map of key/value pairs to be provided to the action.
Parameters map[string]interface{} `json:"parameters,omitempty"`
// The location in the dialog context where the result of the action is stored.
ResultVariable *string `json:"result_variable" validate:"required"`
// The name of the context variable that the client application will use to pass in credentials for the action.
Credentials *string `json:"credentials,omitempty"`
}
DialogNodeAction : DialogNodeAction struct
type DialogNodeOutputOptionsElement ¶
type DialogNodeOutputOptionsElement struct {
// The user-facing label for the option.
Label *string `json:"label" validate:"required"`
// An object defining the message input to be sent to the assistant if the user selects the corresponding option.
Value *DialogNodeOutputOptionsElementValue `json:"value" validate:"required"`
}
DialogNodeOutputOptionsElement : DialogNodeOutputOptionsElement struct
type DialogNodeOutputOptionsElementValue ¶
type DialogNodeOutputOptionsElementValue struct {
// An input object that includes the input text.
Input *MessageInput `json:"input,omitempty"`
}
DialogNodeOutputOptionsElementValue : An object defining the message input to be sent to the assistant if the user selects the corresponding option.
type DialogNodesVisited ¶
type DialogNodesVisited struct {
// A dialog node that was triggered during processing of the input message.
DialogNode *string `json:"dialog_node,omitempty"`
// The title of the dialog node.
Title *string `json:"title,omitempty"`
// The conditions that trigger the dialog node.
Conditions *string `json:"conditions,omitempty"`
}
DialogNodesVisited : DialogNodesVisited struct
type DialogSuggestion ¶
type DialogSuggestion struct {
// The user-facing label for the disambiguation option. This label is taken from the **title** or **user_label**
// property of the corresponding dialog node, depending on the disambiguation options.
Label *string `json:"label" validate:"required"`
// An object defining the message input to be sent to the assistant if the user selects the corresponding
// disambiguation option.
Value *DialogSuggestionValue `json:"value" validate:"required"`
// The dialog output that will be returned from the Watson Assistant service if the user selects the corresponding
// option.
Output map[string]interface{} `json:"output,omitempty"`
}
DialogSuggestion : DialogSuggestion struct
type DialogSuggestionValue ¶
type DialogSuggestionValue struct {
// An input object that includes the input text.
Input *MessageInput `json:"input,omitempty"`
}
DialogSuggestionValue : An object defining the message input to be sent to the assistant if the user selects the corresponding disambiguation option.
type MessageContext ¶
type MessageContext struct {
// Session context data that is shared by all skills used by the Assistant.
Global *MessageContextGlobal `json:"global,omitempty"`
// Information specific to particular skills used by the assistant.
//
// **Note:** Currently, only a single child property is supported, containing variables that apply to the dialog skill
// used by the assistant.
Skills *MessageContextSkills `json:"skills,omitempty"`
}
MessageContext : MessageContext struct
type MessageContextGlobal ¶
type MessageContextGlobal struct {
// Built-in system properties that apply to all skills used by the assistant.
System *MessageContextGlobalSystem `json:"system,omitempty"`
// The session ID.
SessionID *string `json:"session_id,omitempty"`
}
MessageContextGlobal : Session context data that is shared by all skills used by the Assistant.
type MessageContextGlobalStateless ¶ added in v1.6.0
type MessageContextGlobalStateless struct {
// Built-in system properties that apply to all skills used by the assistant.
System *MessageContextGlobalSystem `json:"system,omitempty"`
// The unique identifier of the session.
SessionID *string `json:"session_id,omitempty"`
}
MessageContextGlobalStateless : Session context data that is shared by all skills used by the Assistant.
type MessageContextGlobalSystem ¶
type MessageContextGlobalSystem struct {
// The user time zone. The assistant uses the time zone to correctly resolve relative time references.
Timezone *string `json:"timezone,omitempty"`
// A string value that identifies the user who is interacting with the assistant. The client must provide a unique
// identifier for each individual end user who accesses the application. For Plus and Premium plans, this user ID is
// used to identify unique users for billing purposes. This string cannot contain carriage return, newline, or tab
// characters.
UserID *string `json:"user_id,omitempty"`
// A counter that is automatically incremented with each turn of the conversation. A value of 1 indicates that this is
// the the first turn of a new conversation, which can affect the behavior of some skills (for example, triggering the
// start node of a dialog).
TurnCount *int64 `json:"turn_count,omitempty"`
// The language code for localization in the user input. The specified locale overrides the default for the assistant,
// and is used for interpreting entity values in user input such as date values. For example, `04/03/2018` might be
// interpreted either as April 3 or March 4, depending on the locale.
//
// This property is included only if the new system entities are enabled for the skill.
Locale *string `json:"locale,omitempty"`
// The base time for interpreting any relative time mentions in the user input. The specified time overrides the
// current server time, and is used to calculate times mentioned in relative terms such as `now` or `tomorrow`. This
// can be useful for simulating past or future times for testing purposes, or when analyzing documents such as news
// articles.
//
// This value must be a UTC time value formatted according to ISO 8601 (for example, `2019-06-26T12:00:00Z` for noon on
// 26 June 2019.
//
// This property is included only if the new system entities are enabled for the skill.
ReferenceTime *string `json:"reference_time,omitempty"`
}
MessageContextGlobalSystem : Built-in system properties that apply to all skills used by the assistant.
type MessageContextSkill ¶ added in v0.2.0
type MessageContextSkill struct {
// Arbitrary variables that can be read and written by a particular skill.
UserDefined map[string]interface{} `json:"user_defined,omitempty"`
// System context data used by the skill.
System *MessageContextSkillSystem `json:"system,omitempty"`
}
MessageContextSkill : Contains information specific to a particular skill used by the Assistant. The property name must be the same as the name of the skill (for example, `main skill`).
type MessageContextSkillSystem ¶ added in v1.6.0
type MessageContextSkillSystem map[string]interface{}
MessageContextSkillSystem : System context data used by the skill.
func (*MessageContextSkillSystem) GetProperty ¶ added in v1.6.0
func (this *MessageContextSkillSystem) GetProperty(Key string) *interface{}
GetProperty : Allow user to get arbitrary property
func (*MessageContextSkillSystem) GetState ¶ added in v1.6.0
func (this *MessageContextSkillSystem) GetState() *string
GetState : Allow user to get State
func (*MessageContextSkillSystem) SetProperty ¶ added in v1.6.0
func (this *MessageContextSkillSystem) SetProperty(Key string, Value *interface{})
SetProperty : Allow user to set arbitrary property
func (*MessageContextSkillSystem) SetState ¶ added in v1.6.0
func (this *MessageContextSkillSystem) SetState(State *string)
SetState : Allow user to set State
type MessageContextSkills ¶
type MessageContextSkills map[string]interface{}
MessageContextSkills : Information specific to particular skills used by the assistant.
**Note:** Currently, only a single child property is supported, containing variables that apply to the dialog skill used by the assistant.
func (*MessageContextSkills) GetProperty ¶ added in v0.9.0
func (this *MessageContextSkills) GetProperty(Key string) *MessageContextSkill
GetProperty : Allow user to get arbitrary property
func (*MessageContextSkills) SetProperty ¶ added in v0.9.0
func (this *MessageContextSkills) SetProperty(Key string, Value *MessageContextSkill)
SetProperty : Allow user to set arbitrary property
type MessageContextStateless ¶ added in v1.6.0
type MessageContextStateless struct {
// Session context data that is shared by all skills used by the Assistant.
Global *MessageContextGlobalStateless `json:"global,omitempty"`
// Information specific to particular skills used by the assistant.
//
// **Note:** Currently, only a single child property is supported, containing variables that apply to the dialog skill
// used by the assistant.
Skills *MessageContextSkills `json:"skills,omitempty"`
}
MessageContextStateless : MessageContextStateless struct
type MessageInput ¶
type MessageInput struct {
// The type of user input. Currently, only text input is supported.
MessageType *string `json:"message_type,omitempty"`
// The text of the user input. This string cannot contain carriage return, newline, or tab characters.
Text *string `json:"text,omitempty"`
// Intents to use when evaluating the user input. Include intents from the previous response to continue using those
// intents rather than trying to recognize intents in the new input.
Intents []RuntimeIntent `json:"intents,omitempty"`
// Entities to use when evaluating the message. Include entities from the previous response to continue using those
// entities rather than detecting entities in the new input.
Entities []RuntimeEntity `json:"entities,omitempty"`
// For internal use only.
SuggestionID *string `json:"suggestion_id,omitempty"`
// Optional properties that control how the assistant responds.
Options *MessageInputOptions `json:"options,omitempty"`
}
MessageInput : An input object that includes the input text.
type MessageInputOptions ¶
type MessageInputOptions struct {
// Whether to restart dialog processing at the root of the dialog, regardless of any previously visited nodes.
// **Note:** This does not affect `turn_count` or any other context variables.
Restart *bool `json:"restart,omitempty"`
// Whether to return more than one intent. Set to `true` to return all matching intents.
AlternateIntents *bool `json:"alternate_intents,omitempty"`
// Spelling correction options for the message. Any options specified on an individual message override the settings
// configured for the skill.
Spelling *MessageInputOptionsSpelling `json:"spelling,omitempty"`
// Whether to return additional diagnostic information. Set to `true` to return additional information in the
// `output.debug` property. If you also specify **return_context**=`true`, the returned skill context includes the
// `system.state` property.
Debug *bool `json:"debug,omitempty"`
// Whether to return session context with the response. If you specify `true`, the response includes the `context`
// property. If you also specify **debug**=`true`, the returned skill context includes the `system.state` property.
ReturnContext *bool `json:"return_context,omitempty"`
// Whether to return session context, including full conversation state. If you specify `true`, the response includes
// the `context` property, and the skill context includes the `system.state` property.
//
// **Note:** If **export**=`true`, the context is returned regardless of the value of **return_context**.
Export *bool `json:"export,omitempty"`
}
MessageInputOptions : Optional properties that control how the assistant responds.
type MessageInputOptionsSpelling ¶ added in v1.6.0
type MessageInputOptionsSpelling struct {
// Whether to use spelling correction when processing the input. If spelling correction is used and **auto_correct** is
// `true`, any spelling corrections are automatically applied to the user input. If **auto_correct** is `false`, any
// suggested corrections are returned in the **output.spelling** property.
//
// This property overrides the value of the **spelling_suggestions** property in the workspace settings for the skill.
Suggestions *bool `json:"suggestions,omitempty"`
// Whether to use autocorrection when processing the input. If this property is `true`, any corrections are
// automatically applied to the user input, and the original text is returned in the **output.spelling** property of
// the message response. This property overrides the value of the **spelling_auto_correct** property in the workspace
// settings for the skill.
AutoCorrect *bool `json:"auto_correct,omitempty"`
}
MessageInputOptionsSpelling : Spelling correction options for the message. Any options specified on an individual message override the settings configured for the skill.
type MessageInputOptionsStateless ¶ added in v1.6.0
type MessageInputOptionsStateless struct {
// Whether to restart dialog processing at the root of the dialog, regardless of any previously visited nodes.
// **Note:** This does not affect `turn_count` or any other context variables.
Restart *bool `json:"restart,omitempty"`
// Whether to return more than one intent. Set to `true` to return all matching intents.
AlternateIntents *bool `json:"alternate_intents,omitempty"`
// Spelling correction options for the message. Any options specified on an individual message override the settings
// configured for the skill.
Spelling *MessageInputOptionsSpelling `json:"spelling,omitempty"`
// Whether to return additional diagnostic information. Set to `true` to return additional information in the
// `output.debug` property.
Debug *bool `json:"debug,omitempty"`
}
MessageInputOptionsStateless : Optional properties that control how the assistant responds.
type MessageInputStateless ¶ added in v1.6.0
type MessageInputStateless struct {
// The type of user input. Currently, only text input is supported.
MessageType *string `json:"message_type,omitempty"`
// The text of the user input. This string cannot contain carriage return, newline, or tab characters.
Text *string `json:"text,omitempty"`
// Intents to use when evaluating the user input. Include intents from the previous response to continue using those
// intents rather than trying to recognize intents in the new input.
Intents []RuntimeIntent `json:"intents,omitempty"`
// Entities to use when evaluating the message. Include entities from the previous response to continue using those
// entities rather than detecting entities in the new input.
Entities []RuntimeEntity `json:"entities,omitempty"`
// For internal use only.
SuggestionID *string `json:"suggestion_id,omitempty"`
// Optional properties that control how the assistant responds.
Options *MessageInputOptionsStateless `json:"options,omitempty"`
}
MessageInputStateless : An input object that includes the input text.
type MessageOptions ¶
type MessageOptions struct {
// Unique identifier of the assistant. To find the assistant ID in the Watson Assistant user interface, open the
// assistant settings and click **API Details**. For information about creating assistants, see the
// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task).
//
// **Note:** Currently, the v2 API does not support creating assistants.
AssistantID *string `json:"assistant_id" validate:"required"`
// Unique identifier of the session.
SessionID *string `json:"session_id" validate:"required"`
// An input object that includes the input text.
Input *MessageInput `json:"input,omitempty"`
// Context data for the conversation. You can use this property to set or modify context variables, which can also be
// accessed by dialog nodes. The context is stored by the assistant on a per-session basis.
//
// **Note:** The total size of the context data stored for a stateful session cannot exceed 100KB.
Context *MessageContext `json:"context,omitempty"`
// Allows users to set headers to be GDPR compliant
Headers map[string]string
}
MessageOptions : The Message options.
func (*MessageOptions) SetAssistantID ¶
func (options *MessageOptions) SetAssistantID(assistantID string) *MessageOptions
SetAssistantID : Allow user to set AssistantID
func (*MessageOptions) SetContext ¶
func (options *MessageOptions) SetContext(context *MessageContext) *MessageOptions
SetContext : Allow user to set Context
func (*MessageOptions) SetHeaders ¶
func (options *MessageOptions) SetHeaders(param map[string]string) *MessageOptions
SetHeaders : Allow user to set Headers
func (*MessageOptions) SetInput ¶
func (options *MessageOptions) SetInput(input *MessageInput) *MessageOptions
SetInput : Allow user to set Input
func (*MessageOptions) SetSessionID ¶
func (options *MessageOptions) SetSessionID(sessionID string) *MessageOptions
SetSessionID : Allow user to set SessionID
type MessageOutput ¶
type MessageOutput struct {
// Output intended for any channel. It is the responsibility of the client application to implement the supported
// response types.
Generic []RuntimeResponseGeneric `json:"generic,omitempty"`
// An array of intents recognized in the user input, sorted in descending order of confidence.
Intents []RuntimeIntent `json:"intents,omitempty"`
// An array of entities identified in the user input.
Entities []RuntimeEntity `json:"entities,omitempty"`
// An array of objects describing any actions requested by the dialog node.
Actions []DialogNodeAction `json:"actions,omitempty"`
// Additional detailed information about a message response and how it was generated.
Debug *MessageOutputDebug `json:"debug,omitempty"`
// An object containing any custom properties included in the response. This object includes any arbitrary properties
// defined in the dialog JSON editor as part of the dialog node output.
UserDefined map[string]interface{} `json:"user_defined,omitempty"`
// Properties describing any spelling corrections in the user input that was received.
Spelling *MessageOutputSpelling `json:"spelling,omitempty"`
}
MessageOutput : Assistant output to be rendered or processed by the client.
type MessageOutputDebug ¶
type MessageOutputDebug struct {
// An array of objects containing detailed diagnostic information about the nodes that were triggered during processing
// of the input message.
NodesVisited []DialogNodesVisited `json:"nodes_visited,omitempty"`
// An array of up to 50 messages logged with the request.
LogMessages []DialogLogMessage `json:"log_messages,omitempty"`
// Assistant sets this to true when this message response concludes or interrupts a dialog.
BranchExited *bool `json:"branch_exited,omitempty"`
// When `branch_exited` is set to `true` by the Assistant, the `branch_exited_reason` specifies whether the dialog
// completed by itself or got interrupted.
BranchExitedReason *string `json:"branch_exited_reason,omitempty"`
}
MessageOutputDebug : Additional detailed information about a message response and how it was generated.
type MessageOutputSpelling ¶ added in v1.6.0
type MessageOutputSpelling struct {
// The user input text that was used to generate the response. If spelling autocorrection is enabled, this text
// reflects any spelling corrections that were applied.
Text *string `json:"text,omitempty"`
// The original user input text. This property is returned only if autocorrection is enabled and the user input was
// corrected.
OriginalText *string `json:"original_text,omitempty"`
// Any suggested corrections of the input text. This property is returned only if spelling correction is enabled and
// autocorrection is disabled.
SuggestedText *string `json:"suggested_text,omitempty"`
}
MessageOutputSpelling : Properties describing any spelling corrections in the user input that was received.
type MessageResponse ¶
type MessageResponse struct {
// Assistant output to be rendered or processed by the client.
Output *MessageOutput `json:"output" validate:"required"`
// Context data for the conversation. You can use this property to access context variables. The context is stored by
// the assistant on a per-session basis.
//
// **Note:** The context is included in message responses only if **return_context**=`true` in the message request.
Context *MessageContext `json:"context,omitempty"`
}
MessageResponse : A response from the Watson Assistant service.
type MessageResponseStateless ¶ added in v1.6.0
type MessageResponseStateless struct {
// Assistant output to be rendered or processed by the client.
Output *MessageOutput `json:"output" validate:"required"`
// Context data for the conversation. You can use this property to access context variables. The context is not stored
// by the assistant; to maintain session state, include the context from the response in the next message.
Context *MessageContextStateless `json:"context" validate:"required"`
}
MessageResponseStateless : A stateless response from the Watson Assistant service.
type MessageStatelessOptions ¶ added in v1.6.0
type MessageStatelessOptions struct {
// Unique identifier of the assistant. To find the assistant ID in the Watson Assistant user interface, open the
// assistant settings and click **API Details**. For information about creating assistants, see the
// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task).
//
// **Note:** Currently, the v2 API does not support creating assistants.
AssistantID *string `json:"assistant_id" validate:"required"`
// An input object that includes the input text.
Input *MessageInputStateless `json:"input,omitempty"`
// Context data for the conversation. You can use this property to set or modify context variables, which can also be
// accessed by dialog nodes. The context is not stored by the assistant. To maintain session state, include the context
// from the previous response.
//
// **Note:** The total size of the context data for a stateless session cannot exceed 250KB.
Context *MessageContextStateless `json:"context,omitempty"`
// Allows users to set headers to be GDPR compliant
Headers map[string]string
}
MessageStatelessOptions : The MessageStateless options.
func (*MessageStatelessOptions) SetAssistantID ¶ added in v1.6.0
func (options *MessageStatelessOptions) SetAssistantID(assistantID string) *MessageStatelessOptions
SetAssistantID : Allow user to set AssistantID
func (*MessageStatelessOptions) SetContext ¶ added in v1.6.0
func (options *MessageStatelessOptions) SetContext(context *MessageContextStateless) *MessageStatelessOptions
SetContext : Allow user to set Context
func (*MessageStatelessOptions) SetHeaders ¶ added in v1.6.0
func (options *MessageStatelessOptions) SetHeaders(param map[string]string) *MessageStatelessOptions
SetHeaders : Allow user to set Headers
func (*MessageStatelessOptions) SetInput ¶ added in v1.6.0
func (options *MessageStatelessOptions) SetInput(input *MessageInputStateless) *MessageStatelessOptions
SetInput : Allow user to set Input
type RuntimeEntity ¶
type RuntimeEntity struct {
// An entity detected in the input.
Entity *string `json:"entity" validate:"required"`
// An array of zero-based character offsets that indicate where the detected entity values begin and end in the input
// text.
Location []int64 `json:"location" validate:"required"`
// The term in the input text that was recognized as an entity value.
Value *string `json:"value" validate:"required"`
// A decimal percentage that represents Watson's confidence in the recognized entity.
Confidence *float64 `json:"confidence,omitempty"`
// Any metadata for the entity.
Metadata map[string]interface{} `json:"metadata,omitempty"`
// The recognized capture groups for the entity, as defined by the entity pattern.
Groups []CaptureGroup `json:"groups,omitempty"`
// An object containing detailed information about the entity recognized in the user input. This property is included
// only if the new system entities are enabled for the skill.
//
// For more information about how the new system entities are interpreted, see the
// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-beta-system-entities).
Interpretation *RuntimeEntityInterpretation `json:"interpretation,omitempty"`
// An array of possible alternative values that the user might have intended instead of the value returned in the
// **value** property. This property is returned only for `@sys-time` and `@sys-date` entities when the user's input is
// ambiguous.
//
// This property is included only if the new system entities are enabled for the skill.
Alternatives []RuntimeEntityAlternative `json:"alternatives,omitempty"`
// An object describing the role played by a system entity that is specifies the beginning or end of a range recognized
// in the user input. This property is included only if the new system entities are enabled for the skill.
Role *RuntimeEntityRole `json:"role,omitempty"`
}
RuntimeEntity : The entity value that was recognized in the user input.
type RuntimeEntityAlternative ¶ added in v1.4.0
type RuntimeEntityAlternative struct {
// The entity value that was recognized in the user input.
Value *string `json:"value,omitempty"`
// A decimal percentage that represents Watson's confidence in the recognized entity.
Confidence *float64 `json:"confidence,omitempty"`
}
RuntimeEntityAlternative : An alternative value for the recognized entity.
type RuntimeEntityInterpretation ¶ added in v1.4.0
type RuntimeEntityInterpretation struct {
// The calendar used to represent a recognized date (for example, `Gregorian`).
CalendarType *string `json:"calendar_type,omitempty"`
// A unique identifier used to associate a recognized time and date. If the user input contains a date and time that
// are mentioned together (for example, `Today at 5`, the same **datetime_link** value is returned for both the
// `@sys-date` and `@sys-time` entities).
DatetimeLink *string `json:"datetime_link,omitempty"`
// A locale-specific holiday name (such as `thanksgiving` or `christmas`). This property is included when a `@sys-date`
// entity is recognized based on a holiday name in the user input.
Festival *string `json:"festival,omitempty"`
// The precision or duration of a time range specified by a recognized `@sys-time` or `@sys-date` entity.
Granularity *string `json:"granularity,omitempty"`
// A unique identifier used to associate multiple recognized `@sys-date`, `@sys-time`, or `@sys-number` entities that
// are recognized as a range of values in the user's input (for example, `from July 4 until July 14` or `from 20 to
// 25`).
RangeLink *string `json:"range_link,omitempty"`
// The word in the user input that indicates that a `sys-date` or `sys-time` entity is part of an implied range where
// only one date or time is specified (for example, `since` or `until`).
RangeModifier *string `json:"range_modifier,omitempty"`
// A recognized mention of a relative day, represented numerically as an offset from the current date (for example,
// `-1` for `yesterday` or `10` for `in ten days`).
RelativeDay *float64 `json:"relative_day,omitempty"`
// A recognized mention of a relative month, represented numerically as an offset from the current month (for example,
// `1` for `next month` or `-3` for `three months ago`).
RelativeMonth *float64 `json:"relative_month,omitempty"`
// A recognized mention of a relative week, represented numerically as an offset from the current week (for example,
// `2` for `in two weeks` or `-1` for `last week).
RelativeWeek *float64 `json:"relative_week,omitempty"`
// A recognized mention of a relative date range for a weekend, represented numerically as an offset from the current
// weekend (for example, `0` for `this weekend` or `-1` for `last weekend`).
RelativeWeekend *float64 `json:"relative_weekend,omitempty"`
// A recognized mention of a relative year, represented numerically as an offset from the current year (for example,
// `1` for `next year` or `-5` for `five years ago`).
RelativeYear *float64 `json:"relative_year,omitempty"`
// A recognized mention of a specific date, represented numerically as the date within the month (for example, `30` for
// `June 30`.).
SpecificDay *float64 `json:"specific_day,omitempty"`
// A recognized mention of a specific day of the week as a lowercase string (for example, `monday`).
SpecificDayOfWeek *string `json:"specific_day_of_week,omitempty"`
// A recognized mention of a specific month, represented numerically (for example, `7` for `July`).
SpecificMonth *float64 `json:"specific_month,omitempty"`
// A recognized mention of a specific quarter, represented numerically (for example, `3` for `the third quarter`).
SpecificQuarter *float64 `json:"specific_quarter,omitempty"`
// A recognized mention of a specific year (for example, `2016`).
SpecificYear *float64 `json:"specific_year,omitempty"`
// A recognized numeric value, represented as an integer or double.
NumericValue *float64 `json:"numeric_value,omitempty"`
// The type of numeric value recognized in the user input (`integer` or `rational`).
Subtype *string `json:"subtype,omitempty"`
// A recognized term for a time that was mentioned as a part of the day in the user's input (for example, `morning` or
// `afternoon`).
PartOfDay *string `json:"part_of_day,omitempty"`
// A recognized mention of a relative hour, represented numerically as an offset from the current hour (for example,
// `3` for `in three hours` or `-1` for `an hour ago`).
RelativeHour *float64 `json:"relative_hour,omitempty"`
// A recognized mention of a relative time, represented numerically as an offset in minutes from the current time (for
// example, `5` for `in five minutes` or `-15` for `fifteen minutes ago`).
RelativeMinute *float64 `json:"relative_minute,omitempty"`
// A recognized mention of a relative time, represented numerically as an offset in seconds from the current time (for
// example, `10` for `in ten seconds` or `-30` for `thirty seconds ago`).
RelativeSecond *float64 `json:"relative_second,omitempty"`
// A recognized specific hour mentioned as part of a time value (for example, `10` for `10:15 AM`.).
SpecificHour *float64 `json:"specific_hour,omitempty"`
// A recognized specific minute mentioned as part of a time value (for example, `15` for `10:15 AM`.).
SpecificMinute *float64 `json:"specific_minute,omitempty"`
// A recognized specific second mentioned as part of a time value (for example, `30` for `10:15:30 AM`.).
SpecificSecond *float64 `json:"specific_second,omitempty"`
// A recognized time zone mentioned as part of a time value (for example, `EST`).
Timezone *string `json:"timezone,omitempty"`
}
RuntimeEntityInterpretation : RuntimeEntityInterpretation struct
type RuntimeEntityRole ¶ added in v1.4.0
type RuntimeEntityRole struct {
// The relationship of the entity to the range.
Type *string `json:"type,omitempty"`
}
RuntimeEntityRole : An object describing the role played by a system entity that is specifies the beginning or end of a range recognized in the user input. This property is included only if the new system entities are enabled for the skill.
type RuntimeIntent ¶
type RuntimeIntent struct {
// The name of the recognized intent.
Intent *string `json:"intent" validate:"required"`
// A decimal percentage that represents Watson's confidence in the intent.
Confidence *float64 `json:"confidence" validate:"required"`
}
RuntimeIntent : An intent identified in the user input.
type RuntimeResponseGeneric ¶ added in v0.12.0
type RuntimeResponseGeneric struct {
// The type of response returned by the dialog node. The specified response type must be supported by the client
// application or channel.
//
// **Note:** The **suggestion** response type is part of the disambiguation feature, which is only available for
// Premium users.
ResponseType *string `json:"response_type" validate:"required"`
// The text of the response.
Text *string `json:"text,omitempty"`
// How long to pause, in milliseconds.
Time *int64 `json:"time,omitempty"`
// Whether to send a "user is typing" event during the pause.
Typing *bool `json:"typing,omitempty"`
// The URL of the image.
Source *string `json:"source,omitempty"`
// The title or introductory text to show before the response.
Title *string `json:"title,omitempty"`
// The description to show with the the response.
Description *string `json:"description,omitempty"`
// The preferred type of control to display.
Preference *string `json:"preference,omitempty"`
// An array of objects describing the options from which the user can choose.
Options []DialogNodeOutputOptionsElement `json:"options,omitempty"`
// A message to be sent to the human agent who will be taking over the conversation.
MessageToHumanAgent *string `json:"message_to_human_agent,omitempty"`
// A label identifying the topic of the conversation, derived from the **user_label** property of the relevant node.
Topic *string `json:"topic,omitempty"`
// An array of objects describing the possible matching dialog nodes from which the user can choose.
//
// **Note:** The **suggestions** property is part of the disambiguation feature, which is only available for Premium
// users.
Suggestions []DialogSuggestion `json:"suggestions,omitempty"`
// The title or introductory text to show before the response. This text is defined in the search skill configuration.
Header *string `json:"header,omitempty"`
// An array of objects containing search results.
Results []SearchResult `json:"results,omitempty"`
}
RuntimeResponseGeneric : RuntimeResponseGeneric struct
type SearchResult ¶ added in v0.10.0
type SearchResult struct {
// The unique identifier of the document in the Discovery service collection.
//
// This property is included in responses from search skills, which are a beta feature available only to Plus or
// Premium plan users.
ID *string `json:"id" validate:"required"`
// An object containing search result metadata from the Discovery service.
ResultMetadata *SearchResultMetadata `json:"result_metadata" validate:"required"`
// A description of the search result. This is taken from an abstract, summary, or highlight field in the Discovery
// service response, as specified in the search skill configuration.
Body *string `json:"body,omitempty"`
// The title of the search result. This is taken from a title or name field in the Discovery service response, as
// specified in the search skill configuration.
Title *string `json:"title,omitempty"`
// The URL of the original data object in its native data source.
URL *string `json:"url,omitempty"`
// An object containing segments of text from search results with query-matching text highlighted using HTML `<em>`
// tags.
Highlight *SearchResultHighlight `json:"highlight,omitempty"`
}
SearchResult : SearchResult struct
type SearchResultHighlight ¶ added in v0.10.0
type SearchResultHighlight map[string]interface{}
SearchResultHighlight : An object containing segments of text from search results with query-matching text highlighted using HTML `<em>` tags.
func (*SearchResultHighlight) GetBody ¶ added in v0.10.0
func (this *SearchResultHighlight) GetBody() *[]string
GetBody : Allow user to get Body
func (*SearchResultHighlight) GetProperty ¶ added in v0.10.0
func (this *SearchResultHighlight) GetProperty(Key string) *[]string
GetProperty : Allow user to get arbitrary property
func (*SearchResultHighlight) GetTitle ¶ added in v0.10.0
func (this *SearchResultHighlight) GetTitle() *[]string
GetTitle : Allow user to get Title
func (*SearchResultHighlight) GetURL ¶ added in v0.10.0
func (this *SearchResultHighlight) GetURL() *[]string
GetURL : Allow user to get URL
func (*SearchResultHighlight) SetBody ¶ added in v0.10.0
func (this *SearchResultHighlight) SetBody(Body *[]string)
SetBody : Allow user to set Body
func (*SearchResultHighlight) SetProperty ¶ added in v0.10.0
func (this *SearchResultHighlight) SetProperty(Key string, Value *[]string)
SetProperty : Allow user to set arbitrary property
func (*SearchResultHighlight) SetTitle ¶ added in v0.10.0
func (this *SearchResultHighlight) SetTitle(Title *[]string)
SetTitle : Allow user to set Title
func (*SearchResultHighlight) SetURL ¶ added in v0.10.0
func (this *SearchResultHighlight) SetURL(URL *[]string)
SetURL : Allow user to set URL
type SearchResultMetadata ¶ added in v0.10.0
type SearchResultMetadata struct {
// The confidence score for the given result. For more information about how the confidence is calculated, see the
// Discovery service [documentation](../discovery#query-your-collection).
Confidence *float64 `json:"confidence,omitempty"`
// An unbounded measure of the relevance of a particular result, dependent on the query and matching document. A higher
// score indicates a greater match to the query parameters.
Score *float64 `json:"score,omitempty"`
}
SearchResultMetadata : An object containing search result metadata from the Discovery service.
type SessionResponse ¶
type SessionResponse struct {
// The session ID.
SessionID *string `json:"session_id" validate:"required"`
}
SessionResponse : SessionResponse struct