wit

package
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(httpClient *http.Client, httpRetries *httpx.RetryConfig, classifier *flows.Classifier, accessToken string) flows.ClassificationService

NewService creates a new classification service

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a basic Wit.ai client

func NewClient

func NewClient(httpClient *http.Client, httpRetries *httpx.RetryConfig, accessToken string) *Client

NewClient creates a new client

func (*Client) Message

func (c *Client) Message(q string) (*MessageResponse, *httpx.Trace, error)

Message gets the meaning of a message

type EntityMatch

type EntityMatch struct {
	ID         string          `json:"id"`
	Name       string          `json:"name"`
	Role       string          `json:"role"`
	Value      string          `json:"value"`
	Confidence decimal.Decimal `json:"confidence"`
}

EntityMatch is possible entity match

type IntentMatch

type IntentMatch struct {
	ID         string          `json:"id"`
	Name       string          `json:"name"`
	Confidence decimal.Decimal `json:"confidence"`
}

IntentMatch is possible intent match

type MessageResponse

type MessageResponse struct {
	Text     string                   `json:"text"`
	Intents  []IntentMatch            `json:"intents" validate:"required"`
	Entities map[string][]EntityMatch `json:"entities"`
	Traits   map[string][]TraitMatch  `json:"traits"`
}

MessageResponse is the response from a /message request

type TraitMatch

type TraitMatch struct {
	ID         string          `json:"id"`
	Value      string          `json:"value"`
	Confidence decimal.Decimal `json:"confidence"`
}

TraitMatch is possible trait match

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL