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.
logCitationClick
Logs a custom event indicating a cited source link was clicked.
Parameters
-
id:
string
The ID of the clicked citation.
logCitationHover
Logs a custom event indicating a cited source link was hovered.
Parameters
-
citationId:
string
The ID of the clicked citation.
-
citationHoverTimeMs:
number
The number of milliseconds spent hovering over the citation.
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:
GeneratedResponseFormat
The formatting options to apply to generated answers.
sendDetailedFeedback
Sends detailed feedback about why the generated answer was not relevant.
Parameters
-
details:
string
Details 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.
subscribe
Adds a callback that’s invoked on state change.
Parameters
-
listener:
() => void
A 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:
boolean
Determines if the generated answer is disliked, or downvoted by the end user.
-
expanded:
boolean
Whether the answer is expanded.
-
feedbackModalOpen:
boolean
Determines if the feedback modal is currently opened.
-
feedbackSubmitted:
boolean
Determines 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:
boolean
Determines if the answer is generated.
-
isLoading:
boolean
Determines if the generated answer is loading.
-
isStreaming:
boolean
Determines if the generated answer is streaming.
-
isVisible:
boolean
Determines if the generated answer is visible.
-
liked:
boolean
Determines if the generated answer is liked, or upvoted by the end user.
-
responseFormat:
GeneratedResponseFormat
The desired format options for the generated answer.
-
answer?:
string
The generated answer.
-
answerConfigurationId?:
string
The 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:
SearchEngine
The headless engine.
-
props:
GeneratedAnswerProps
The configurable
GeneratedAnswer
properties.
Returns GeneratedAnswer
GeneratedAnswerProps
The configurable GeneratedAnswer
properties.
Properties
-
answerConfigurationId?:
string
The 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/plain
is used. Formats: -text/plain
: The answer can be streamed as plain text. -text/markdown
: The answer can be streamed as a Markdown document.