mindmeld.components.client module

class mindmeld.components.client.ConversationClient(url='http://localhost:7150/parse', default_params=None)[source]

Bases: object

The conversation object is a very basic MindMeld http client.

It can be useful for testing out dialogue flows in python.

Example

>>> convo = ConversationClient()
>>> convo.say('Hello')
['Hello. I can help you find store hours. How can I help?']
>>> convo.say('Is the store on elm open?')
['The 23 Elm Street Kwik-E-Mart is open from 7:00 to 19:00.']
history

list -- The sequence of previous turns in the conversation, starting with the most recent message.

context

dict -- The user context of the conversation.

default_params

dict -- The default params to use with each turn. These defaults will be overridden by params passed for each turn.

params

dict -- The params returned by the most recent turn.

process(text, params=None, frame=None, form=None)[source]

Send a message in the conversation. The message will be processed by the app based on the current state of the conversation and returns the response.

Parameters:
  • text (str) -- The text of a message.
  • params (dict) -- The params to use with this message, overriding any defaults which may have been set.
  • frame (dict) -- The frame to be used with this message, overriding any defaults.
  • context (dict) -- The context to be used with this message, overriding any defaults.
  • form (dict) -- A form data dictionary
Returns:

The dictionary response.

Return type:

(dict)

reset()[source]

Reset the history, frame and params of the Conversation object.

say(text, params=None, frame=None, form=None)[source]

Send a message in the conversation. The message will be processed by the app based on the current state of the conversation and returns the extracted messages from the directives.

Parameters:
  • text (str) -- The text of a message.
  • params (dict) -- The params to use with this message, overriding any defaults which may have been set.
  • frame (dict) -- The frame to be used with this message, overriding any defaults.
  • form (dict) -- A form data dictionary
Returns:

A text representation of the dialogue responses.

Return type:

(list)