API¶
Wit object¶
- class wit.Wit(token, connector=<class 'wit.connector.Connector'>, raw_text=False)¶
Wit object exposes methods for communicating with Wit’s HTTP API
- delete_entities(*args, **kwargs)¶
Alias for delete_entity
- delete_entity(entity_id)¶
Permanently remove an entity
Parameters: entity_id – ID of entity Refer to https://wit.ai/docs/api#toc_28
- get_corpus()¶
Return a list of validated expressions in your instance
Refer to https://wit.ai/docs/api#toc_17
- get_entities()¶
Return a list of entities for the instance
Refer to https://wit.ai/docs/api#toc_18
- get_entities_by_id(*args, **kwargs)¶
Alias for get_entity_by_id
- get_entity_by_id(entity_id)¶
Return an entity from an id
Parameters: entity_id – ID of requested entity Refer to https://wit.ai/docs/api#toc_20
- get_intents()¶
Return a list of intents (without their expressions)
Refer to https://wit.ai/docs/api#toc_15
- get_message(query, context=None, meta=None, msg_id=None)¶
Return extracted meaning from a sentence
Parameters: - query – User’s query. Length is > 0 and < 256 chars
- context – (optional) A dict representing user’s context
- meta – (optional) A dict representing any additional info to attach to the request
- msg_id – (optional) A specific message id
Refer to https://wit.ai/docs/api#toc_3
- get_message_by_id(message_id)¶
Return a stored message for an id
Parameters: message_id – message id Refer to https://wit.ai/docs/api#toc_13
- post_entities(*args, **kwargs)¶
Alias for post_entity
- post_entity(entity_id, doc=None, values=None)¶
Create a new entity
Parameters: - entity_id – ID of entity
- doc – (optional) short sentence describing the entity
- values – (optional) possible values for entity
Refer to https://wit.ai/docs/api#toc_22
- post_speech(data=None, content_type='wav', context=None, meta=None, msg_id=None)¶
Return meaning extracted from a posted sound file
Parameters: - data –
A file-like object, bytes array or iterator Anything that can be passed as the data arg to the requests.post method can be passed here
- content_type – A string presenting the file type (eg wav, mpeg3) Assumes wav by default
- context – (optional) user’s context
- meta – (optional) Additional request info
- msg_id – (optional) A specific message id
Refer to https://wit.ai/docs/api#toc_8
- data –
- put_entities(*args, **kwargs)¶
Alias for update_entity
- update_entity(entity_id, doc=None, values=None)¶
Update an entity with attributes
Parameters: - entity_id – ID of entity
- doc – (optional) short sentence describing the entity
- values – (optional) possible values for entity
Refer to https://wit.ai/docs/api#toc_25