GeneratedAnswer
GeneratedAnswer
|
|
Note
This component was introduced in version |
Methods
closeFeedbackModal
Closes the modal to provide feedback about why the generated answer was not relevant.
collapse
Collapses the generated answer.
dislike
Marks the generated answer as not relevant to the end user.
expand
Expands the generated answer.
hide
Hides the generated answer.
like
Indicates that the generated answer met the user expectations.
logCitationClick
Logs a custom event indicating a cited source link was clicked.
Parameters
-
id:
stringThe ID of the clicked citation.
logCitationHover
Logs a custom event indicating a cited source link was hovered.
Parameters
-
citationId:
stringThe ID of the clicked citation.
-
citationHoverTimeMs:
numberThe number of milliseconds spent hovering over the citation.
logCopyToClipboard
Logs a custom event indicating the generated answer was copied to the clipboard.
openFeedbackModal
Opens the modal to provide feedback about why the generated answer was not relevant.
rephrase
Re-executes the query to generate the answer in the specified format.
Parameters
-
responseFormat:
GeneratedResponseFormatThe formatting options to apply to generated answers.
retry
Re-executes the last query to generate an answer.
sendDetailedFeedback
Sends detailed feedback about why the generated answer was not relevant.
Parameters
-
details:
stringDetails on why the generated answer was not relevant.
sendFeedback
Sends feedback about why the generated answer was not relevant.
Parameters
-
feedback:
'irrelevant' | 'notAccurate' | 'outOfDate' | 'harmful'The feedback that the end user wishes to send.
show
Displays the generated answer.
subscribe
Adds a callback that’s invoked on state change.
Parameters
-
listener:
() => voidA callback that’s invoked on state change.
Returns Unsubscribe: A function to remove the listener.
Attributes
state
The state of the GeneratedAnswer controller.
Properties
-
citations:
GeneratedAnswerCitation[]The document snippets retrieved to generate the answer.
-
disliked:
booleanDetermines if the generated answer is disliked, or downvoted by the end user.
-
expanded:
booleanWhether the answer is expanded.
-
feedbackModalOpen:
booleanDetermines if the feedback modal is currently opened.
-
feedbackSubmitted:
booleanDetermines if the generated answer feedback was submitted.
-
fieldsToIncludeInCitations:
string[]A list of indexed fields to include in the citations returned with the generated answer.
-
id:
string -
isAnswerGenerated:
booleanDetermines if the answer is generated.
-
isLoading:
booleanDetermines if the generated answer is loading.
-
isStreaming:
booleanDetermines if the generated answer is streaming.
-
isVisible:
booleanDetermines if the generated answer is visible.
-
liked:
booleanDetermines if the generated answer is liked, or upvoted by the end user.
-
responseFormat:
GeneratedResponseFormatThe desired format options for the generated answer.
-
answer?:
stringThe generated answer.
-
answerConfigurationId?:
stringThe answer configuration unique identifier.
-
answerContentFormat?:
(typeof generatedContentFormat)[number]The content format of the generated answer. Possible values are: -
text/plain-text/markdown -
error?:
{ message?: string; code?: number; isRetryable?: boolean; }The generated answer error.
Initialize
buildGeneratedAnswer
Creates a GeneratedAnswer controller instance.
Parameters
-
engine:
SearchEngineThe headless engine.
-
props:
GeneratedAnswerPropsThe configurable
GeneratedAnswerproperties.
Returns GeneratedAnswer
GeneratedAnswerProps
The configurable GeneratedAnswer properties.
Properties
-
answerConfigurationId?:
stringThe answer configuration ID used to leverage coveo answer management capabilities.
-
fieldsToIncludeInCitations?:
string[]A list of indexed fields to include in the citations returned with the generated answer.
-
initialState?:
{ isVisible?: boolean; responseFormat?: GeneratedResponseFormat; expanded?: boolean; }
Related types
GeneratedAnswerCitation
Properties
-
id:
string -
permanentid:
string -
title:
string -
uri:
string -
clickUri?:
string -
fields?:
Raw -
text?:
string
GeneratedResponseFormat
Properties
-
answerStyle:
(typeof generatedAnswerStyle)[number]The requested formatting style of the generated answer. Options: -
default: Generates the answer without additional formatting instructions. -bullet: Requests the answer to be generated in bullet-points. -step: Requests the answer to be generated in step-by-step instructions. -concise: Requests the answer to be generated as concisely as possible. -
contentFormat?:
(typeof generatedContentFormat)[number]The content formats that are supported for rendering the answer. If no values are provided,
text/plainis used. Formats: -text/plain: The answer can be streamed as plain text. -text/markdown: The answer can be streamed as a Markdown document.
Raw
Properties
-
[key: string]:
unknownCustom keys that depend on the documents in the index.
Unsubscribe
Call signatures
-
(): void;