| 1 | import type * as kendra from "@distilled.cloud/aws/kendra"; |
| 2 | import type * as Duration from "effect/Duration"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | import * as Binding from "../../Binding.ts"; |
| 5 | import type { Index } from "./SearchIndex.ts"; |
| 6 | |
| 7 | /** |
| 8 | * `UpdateQuerySuggestionsConfig` request with `IndexId` injected from the bound index. |
| 9 | */ |
| 10 | export interface UpdateQuerySuggestionsConfigRequest extends Omit< |
| 11 | kendra.UpdateQuerySuggestionsConfigRequest, |
| 12 | "IndexId" | "QueryLogLookBackWindowInDays" |
| 13 | > { |
| 14 | /** |
| 15 | * How far back in the index's query log Kendra looks for popular queries |
| 16 | * when building suggestions. Accepts any duration input (e.g. `"14 days"`); |
| 17 | * converted to whole days on the wire. |
| 18 | */ |
| 19 | queryLogLookBackWindow?: Duration.Input; |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Runtime binding for the `UpdateQuerySuggestionsConfig` operation (IAM action |
| 24 | * `kendra:UpdateQuerySuggestionsConfig`), scoped to one {@link Index}. |
| 25 | * |
| 26 | * Tunes the index's query-suggestions settings — switch between |
| 27 | * `ENABLED` and `LEARN_ONLY`, adjust the query-log look-back window, or |
| 28 | * change minimum query thresholds. |
| 29 | * Provide the implementation with |
| 30 | * `Effect.provide(AWS.Kendra.UpdateQuerySuggestionsConfigHttp)`. |
| 31 | * |
| 32 | * ### Query Suggestions |
| 33 | * **Example:** Tune Suggestions |
| 34 | * ```typescript |
| 35 | * const updateSuggestions = |
| 36 | * yield* AWS.Kendra.UpdateQuerySuggestionsConfig(index); |
| 37 | * |
| 38 | * yield* updateSuggestions({ |
| 39 | * Mode: "LEARN_ONLY", |
| 40 | * queryLogLookBackWindow: "14 days", |
| 41 | * MinimumNumberOfQueryingUsers: 2, |
| 42 | * }); |
| 43 | * ``` |
| 44 | * |
| 45 | * @binding |
| 46 | */ |
| 47 | export interface UpdateQuerySuggestionsConfig extends Binding.Service< |
| 48 | UpdateQuerySuggestionsConfig, |
| 49 | "AWS.Kendra.UpdateQuerySuggestionsConfig", |
| 50 | ( |
| 51 | index: Index, |
| 52 | ) => Effect.Effect< |
| 53 | ( |
| 54 | request?: UpdateQuerySuggestionsConfigRequest, |
| 55 | ) => Effect.Effect< |
| 56 | kendra.UpdateQuerySuggestionsConfigResponse, |
| 57 | kendra.UpdateQuerySuggestionsConfigError |
| 58 | > |
| 59 | > |
| 60 | > {} |
| 61 | export const UpdateQuerySuggestionsConfig = |
| 62 | Binding.Service<UpdateQuerySuggestionsConfig>( |
| 63 | "AWS.Kendra.UpdateQuerySuggestionsConfig", |
| 64 | ); |