azure-sdk-for-go: github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v4.0/qnamakerruntime Index | Files | Directories

package qnamakerruntime

import "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v4.0/qnamakerruntime"

Package qnamakerruntime implements the Azure ARM Qnamakerruntime service API version 4.0.

An API for QnAMaker runtime

Index

Package Files

client.go models.go runtime.go version.go

func UserAgent Uses

func UserAgent() string

UserAgent returns the UserAgent string to use when sending http.Requests.

func Version Uses

func Version() string

Version returns the semantic version (see http://semver.org) of the client.

type BaseClient Uses

type BaseClient struct {
    autorest.Client
    RuntimeEndpoint string
}

BaseClient is the base client for Qnamakerruntime.

func New Uses

func New(runtimeEndpoint string) BaseClient

New creates an instance of the BaseClient client.

func NewWithoutDefaults Uses

func NewWithoutDefaults(runtimeEndpoint string) BaseClient

NewWithoutDefaults creates an instance of the BaseClient client.

type ContextDTO Uses

type ContextDTO struct {
    // IsContextOnly - To mark if a prompt is relevant only with a previous question or not.
    // true - Do not include this QnA as search result for queries without context
    // false - ignores context and includes this QnA in search result
    IsContextOnly *bool `json:"isContextOnly,omitempty"`
    // Prompts - List of prompts associated with the answer.
    Prompts *[]PromptDTO `json:"prompts,omitempty"`
}

ContextDTO context associated with Qna.

type Error Uses

type Error struct {
    // Code - One of a server-defined set of error codes. Possible values include: 'BadArgument', 'Forbidden', 'NotFound', 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', 'OperationNotFound', 'ServiceError', 'ValidationFailure', 'ExtractionFailure'
    Code ErrorCodeType `json:"code,omitempty"`
    // Message - A human-readable representation of the error.
    Message *string `json:"message,omitempty"`
    // Target - The target of the error.
    Target *string `json:"target,omitempty"`
    // Details - An array of details about specific errors that led to this reported error.
    Details *[]Error `json:"details,omitempty"`
    // InnerError - An object containing more specific information than the current object about the error.
    InnerError *InnerErrorModel `json:"innerError,omitempty"`
}

Error the error object. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.

type ErrorCodeType Uses

type ErrorCodeType string

ErrorCodeType enumerates the values for error code type.

const (
    // BadArgument ...
    BadArgument ErrorCodeType = "BadArgument"
    // EndpointKeysError ...
    EndpointKeysError ErrorCodeType = "EndpointKeysError"
    // ExtractionFailure ...
    ExtractionFailure ErrorCodeType = "ExtractionFailure"
    // Forbidden ...
    Forbidden ErrorCodeType = "Forbidden"
    // KbNotFound ...
    KbNotFound ErrorCodeType = "KbNotFound"
    // NotFound ...
    NotFound ErrorCodeType = "NotFound"
    // OperationNotFound ...
    OperationNotFound ErrorCodeType = "OperationNotFound"
    // QnaRuntimeError ...
    QnaRuntimeError ErrorCodeType = "QnaRuntimeError"
    // QuotaExceeded ...
    QuotaExceeded ErrorCodeType = "QuotaExceeded"
    // ServiceError ...
    ServiceError ErrorCodeType = "ServiceError"
    // SKULimitExceeded ...
    SKULimitExceeded ErrorCodeType = "SKULimitExceeded"
    // Unauthorized ...
    Unauthorized ErrorCodeType = "Unauthorized"
    // Unspecified ...
    Unspecified ErrorCodeType = "Unspecified"
    // ValidationFailure ...
    ValidationFailure ErrorCodeType = "ValidationFailure"
)

func PossibleErrorCodeTypeValues Uses

func PossibleErrorCodeTypeValues() []ErrorCodeType

PossibleErrorCodeTypeValues returns an array of possible values for the ErrorCodeType const type.

type ErrorResponse Uses

type ErrorResponse struct {
    // Error - The error object.
    Error *ErrorResponseError `json:"error,omitempty"`
}

ErrorResponse error response. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.

type ErrorResponseError Uses

type ErrorResponseError struct {
    // Code - One of a server-defined set of error codes. Possible values include: 'BadArgument', 'Forbidden', 'NotFound', 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', 'OperationNotFound', 'ServiceError', 'ValidationFailure', 'ExtractionFailure'
    Code ErrorCodeType `json:"code,omitempty"`
    // Message - A human-readable representation of the error.
    Message *string `json:"message,omitempty"`
    // Target - The target of the error.
    Target *string `json:"target,omitempty"`
    // Details - An array of details about specific errors that led to this reported error.
    Details *[]Error `json:"details,omitempty"`
    // InnerError - An object containing more specific information than the current object about the error.
    InnerError *InnerErrorModel `json:"innerError,omitempty"`
}

ErrorResponseError the error object.

type FeedbackRecordDTO Uses

type FeedbackRecordDTO struct {
    // UserID - Unique identifier for the user.
    UserID *string `json:"userId,omitempty"`
    // UserQuestion - The suggested question being provided as feedback.
    UserQuestion *string `json:"userQuestion,omitempty"`
    // QnaID - The qnaId for which the suggested question is provided as feedback.
    QnaID *int32 `json:"qnaId,omitempty"`
}

FeedbackRecordDTO active learning feedback record.

type FeedbackRecordsDTO Uses

type FeedbackRecordsDTO struct {
    // FeedbackRecords - List of feedback records.
    FeedbackRecords *[]FeedbackRecordDTO `json:"feedbackRecords,omitempty"`
}

FeedbackRecordsDTO active learning feedback records.

type InnerErrorModel Uses

type InnerErrorModel struct {
    // Code - A more specific error code than was provided by the containing error.
    Code *string `json:"code,omitempty"`
    // InnerError - An object containing more specific information than the current object about the error.
    InnerError *InnerErrorModel `json:"innerError,omitempty"`
}

InnerErrorModel an object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.

type MetadataDTO Uses

type MetadataDTO struct {
    // Name - Metadata name.
    Name *string `json:"name,omitempty"`
    // Value - Metadata value.
    Value *string `json:"value,omitempty"`
}

MetadataDTO name - value pair of metadata.

type PromptDTO Uses

type PromptDTO struct {
    // DisplayOrder - Index of the prompt - used in ordering of the prompts
    DisplayOrder *int32 `json:"displayOrder,omitempty"`
    // QnaID - Qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored.
    QnaID *int32 `json:"qnaId,omitempty"`
    // Qna - QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object
    Qna *PromptDTOQna `json:"qna,omitempty"`
    // DisplayText - Text displayed to represent a follow up question prompt
    DisplayText *string `json:"displayText,omitempty"`
}

PromptDTO prompt for an answer.

type PromptDTOQna Uses

type PromptDTOQna struct {
    // ID - Unique id for the Q-A.
    ID  *int32 `json:"id,omitempty"`
    // Answer - Answer text
    Answer *string `json:"answer,omitempty"`
    // Source - Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs
    Source *string `json:"source,omitempty"`
    // Questions - List of questions associated with the answer.
    Questions *[]string `json:"questions,omitempty"`
    // Metadata - List of metadata associated with the answer.
    Metadata *[]MetadataDTO `json:"metadata,omitempty"`
    // Context - Context of a QnA
    Context *QnADTOContext `json:"context,omitempty"`
}

PromptDTOQna qnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object

type QnADTO Uses

type QnADTO struct {
    // ID - Unique id for the Q-A.
    ID  *int32 `json:"id,omitempty"`
    // Answer - Answer text
    Answer *string `json:"answer,omitempty"`
    // Source - Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs
    Source *string `json:"source,omitempty"`
    // Questions - List of questions associated with the answer.
    Questions *[]string `json:"questions,omitempty"`
    // Metadata - List of metadata associated with the answer.
    Metadata *[]MetadataDTO `json:"metadata,omitempty"`
    // Context - Context of a QnA
    Context *QnADTOContext `json:"context,omitempty"`
}

QnADTO q-A object.

type QnADTOContext Uses

type QnADTOContext struct {
    // IsContextOnly - To mark if a prompt is relevant only with a previous question or not.
    // true - Do not include this QnA as search result for queries without context
    // false - ignores context and includes this QnA in search result
    IsContextOnly *bool `json:"isContextOnly,omitempty"`
    // Prompts - List of prompts associated with the answer.
    Prompts *[]PromptDTO `json:"prompts,omitempty"`
}

QnADTOContext context of a QnA

type QnASearchResult Uses

type QnASearchResult struct {
    // Questions - List of questions.
    Questions *[]string `json:"questions,omitempty"`
    // Answer - Answer.
    Answer *string `json:"answer,omitempty"`
    // Score - Search result score.
    Score *float64 `json:"score,omitempty"`
    // ID - Id of the QnA result.
    ID  *int32 `json:"id,omitempty"`
    // Source - Source of QnA result.
    Source *string `json:"source,omitempty"`
    // Metadata - List of metadata.
    Metadata *[]MetadataDTO `json:"metadata,omitempty"`
    // Context - Context object of the QnA
    Context *QnASearchResultContext `json:"context,omitempty"`
}

QnASearchResult represents Search Result.

type QnASearchResultContext Uses

type QnASearchResultContext struct {
    // IsContextOnly - To mark if a prompt is relevant only with a previous question or not.
    // true - Do not include this QnA as search result for queries without context
    // false - ignores context and includes this QnA in search result
    IsContextOnly *bool `json:"isContextOnly,omitempty"`
    // Prompts - List of prompts associated with the answer.
    Prompts *[]PromptDTO `json:"prompts,omitempty"`
}

QnASearchResultContext context object of the QnA

type QnASearchResultList Uses

type QnASearchResultList struct {
    autorest.Response `json:"-"`
    // Answers - Represents Search Result list.
    Answers *[]QnASearchResult `json:"answers,omitempty"`
}

QnASearchResultList represents List of Question Answers.

type QueryContextDTO Uses

type QueryContextDTO struct {
    // PreviousQnaID - Previous QnA Id - qnaId of the top result.
    PreviousQnaID *string `json:"previousQnaId,omitempty"`
    // PreviousUserQuery - Previous user query.
    PreviousUserQuery *string `json:"previousUserQuery,omitempty"`
}

QueryContextDTO context object with previous QnA's information.

type QueryDTO Uses

type QueryDTO struct {
    // QnaID - Exact qnaId to fetch from the knowledgebase, this field takes priority over question.
    QnaID *string `json:"qnaId,omitempty"`
    // Question - User question to query against the knowledge base.
    Question *string `json:"question,omitempty"`
    // Top - Max number of answers to be returned for the question.
    Top *int32 `json:"top,omitempty"`
    // UserID - Unique identifier for the user.
    UserID *string `json:"userId,omitempty"`
    // IsTest - Query against the test index.
    IsTest *bool `json:"isTest,omitempty"`
    // ScoreThreshold - Threshold for answers returned based on score.
    ScoreThreshold *float64 `json:"scoreThreshold,omitempty"`
    // Context - Context object with previous QnA's information.
    Context *QueryDTOContext `json:"context,omitempty"`
    // RankerType - Optional field. Set to 'QuestionOnly' for using a question only Ranker.
    RankerType *string `json:"rankerType,omitempty"`
    // StrictFilters - Find only answers that contain these metadata.
    StrictFilters *[]MetadataDTO `json:"strictFilters,omitempty"`
}

QueryDTO POST body schema to query the knowledgebase.

type QueryDTOContext Uses

type QueryDTOContext struct {
    // PreviousQnaID - Previous QnA Id - qnaId of the top result.
    PreviousQnaID *string `json:"previousQnaId,omitempty"`
    // PreviousUserQuery - Previous user query.
    PreviousUserQuery *string `json:"previousUserQuery,omitempty"`
}

QueryDTOContext context object with previous QnA's information.

type RuntimeClient Uses

type RuntimeClient struct {
    BaseClient
}

RuntimeClient is the an API for QnAMaker runtime

func NewRuntimeClient Uses

func NewRuntimeClient(runtimeEndpoint string) RuntimeClient

NewRuntimeClient creates an instance of the RuntimeClient client.

func (RuntimeClient) GenerateAnswer Uses

func (client RuntimeClient) GenerateAnswer(ctx context.Context, kbID string, generateAnswerPayload QueryDTO) (result QnASearchResultList, err error)

GenerateAnswer sends the generate answer request. Parameters: kbID - knowledgebase id. generateAnswerPayload - post body of the request.

func (RuntimeClient) GenerateAnswerPreparer Uses

func (client RuntimeClient) GenerateAnswerPreparer(ctx context.Context, kbID string, generateAnswerPayload QueryDTO) (*http.Request, error)

GenerateAnswerPreparer prepares the GenerateAnswer request.

func (RuntimeClient) GenerateAnswerResponder Uses

func (client RuntimeClient) GenerateAnswerResponder(resp *http.Response) (result QnASearchResultList, err error)

GenerateAnswerResponder handles the response to the GenerateAnswer request. The method always closes the http.Response Body.

func (RuntimeClient) GenerateAnswerSender Uses

func (client RuntimeClient) GenerateAnswerSender(req *http.Request) (*http.Response, error)

GenerateAnswerSender sends the GenerateAnswer request. The method will close the http.Response Body if it receives an error.

func (RuntimeClient) Train Uses

func (client RuntimeClient) Train(ctx context.Context, kbID string, trainPayload FeedbackRecordsDTO) (result autorest.Response, err error)

Train sends the train request. Parameters: kbID - knowledgebase id. trainPayload - post body of the request.

func (RuntimeClient) TrainPreparer Uses

func (client RuntimeClient) TrainPreparer(ctx context.Context, kbID string, trainPayload FeedbackRecordsDTO) (*http.Request, error)

TrainPreparer prepares the Train request.

func (RuntimeClient) TrainResponder Uses

func (client RuntimeClient) TrainResponder(resp *http.Response) (result autorest.Response, err error)

TrainResponder handles the response to the Train request. The method always closes the http.Response Body.

func (RuntimeClient) TrainSender Uses

func (client RuntimeClient) TrainSender(req *http.Request) (*http.Response, error)

TrainSender sends the Train request. The method will close the http.Response Body if it receives an error.

Directories

PathSynopsis
qnamakerruntimeapi

Package qnamakerruntime imports 6 packages (graph) and is imported by 3 packages. Updated 2019-10-30. Refresh now. Tools for package owners.