| 1 | import type * as kendra from "@distilled.cloud/aws/kendra"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Index } from "./SearchIndex.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `SubmitFeedback` request with `IndexId` injected from the bound index. |
| 8 | */ |
| 9 | export interface SubmitFeedbackRequest extends Omit< |
| 10 | kendra.SubmitFeedbackRequest, |
| 11 | "IndexId" |
| 12 | > {} |
| 13 | |
| 14 | /** |
| 15 | * Runtime binding for the `SubmitFeedback` operation (IAM action |
| 16 | * `kendra:SubmitFeedback`), scoped to one {@link Index}. |
| 17 | * |
| 18 | * Submits click and relevance feedback for a query's results — Kendra |
| 19 | * uses it to tune the index's relevance over time (incremental learning). |
| 20 | * Provide the implementation with |
| 21 | * `Effect.provide(AWS.Kendra.SubmitFeedbackHttp)`. |
| 22 | * |
| 23 | * ### Querying an Index |
| 24 | * **Example:** Submit Click Feedback |
| 25 | * ```typescript |
| 26 | * const submitFeedback = yield* AWS.Kendra.SubmitFeedback(index); |
| 27 | * |
| 28 | * yield* submitFeedback({ |
| 29 | * QueryId: queryId, |
| 30 | * ClickFeedbackItems: [{ ResultId: resultId, ClickTime: new Date() }], |
| 31 | * }); |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface SubmitFeedback extends Binding.Service< |
| 37 | SubmitFeedback, |
| 38 | "AWS.Kendra.SubmitFeedback", |
| 39 | ( |
| 40 | index: Index, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: SubmitFeedbackRequest, |
| 44 | ) => Effect.Effect< |
| 45 | kendra.SubmitFeedbackResponse, |
| 46 | kendra.SubmitFeedbackError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | export const SubmitFeedback = Binding.Service<SubmitFeedback>( |
| 51 | "AWS.Kendra.SubmitFeedback", |
| 52 | ); |