Skip to Content

Interface FeedbackRating

One rating of one result.

idx is copied exactly from a search response and cannot be constructed by hand. Which one you copy decides the reach: an Insight.idx rates that insight, whereas a Memory.idx rates every insight under it.

relevant and correct are separate questions, and both are required. A result can answer the query and still be wrong, or be true and unhelpful, and collapsing the two is what makes a rating useless.

The batch is gathered by walking memories and then their insights, so a search whose memories are all references yields no ratings at all. An empty batch is refused before anything is sent, so check the length first.

const ratings: FeedbackRating[] = result.memories.flatMap(memory =>
memory.insights.map(insight => ({
idx: insight.idx,
relevant: true,
correct: true
}))
)
if (ratings.length > 0) {
await session.shareFeedback({ feedback: ratings })
}
interface FeedbackRating {
    idx: string;
    relevant: boolean;
    correct: boolean;
    comment?: string;
}
Index
idx: string

The idx of the result being rated, copied from a search response.

relevant: boolean

Whether it was a good match for the query.

correct: boolean

Whether its content was accurate.

comment?: string

An optional note on why.