| 1 | import type * as qbusiness from "@distilled.cloud/aws/qbusiness"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Application } from "./Application.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `ChatSync` request with `applicationId` injected from the bound application. |
| 8 | */ |
| 9 | export interface ChatSyncRequest extends Omit< |
| 10 | qbusiness.ChatSyncInput, |
| 11 | "applicationId" |
| 12 | > {} |
| 13 | |
| 14 | /** |
| 15 | * Runtime binding for the `ChatSync` operation (IAM action |
| 16 | * `qbusiness:ChatSync`), scoped to one {@link Application}. |
| 17 | * |
| 18 | * Sends a user message to the application and returns the full |
| 19 | * AI-generated answer in one response, including source attributions |
| 20 | * and any suggested plugin actions. |
| 21 | * Provide the implementation with |
| 22 | * `Effect.provide(AWS.QBusiness.ChatSyncHttp)`. |
| 23 | * |
| 24 | * ### Chat |
| 25 | * **Example:** Ask a Question |
| 26 | * ```typescript |
| 27 | * const chat = yield* AWS.QBusiness.ChatSync(app); |
| 28 | * |
| 29 | * const reply = yield* chat({ userMessage: "What is our travel policy?" }); |
| 30 | * console.log(reply.systemMessage); |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface ChatSync extends Binding.Service< |
| 36 | ChatSync, |
| 37 | "AWS.QBusiness.ChatSync", |
| 38 | ( |
| 39 | application: Application, |
| 40 | ) => Effect.Effect< |
| 41 | ( |
| 42 | request?: ChatSyncRequest, |
| 43 | ) => Effect.Effect<qbusiness.ChatSyncOutput, qbusiness.ChatSyncError> |
| 44 | > |
| 45 | > {} |
| 46 | export const ChatSync = Binding.Service<ChatSync>("AWS.QBusiness.ChatSync"); |