sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ QBusiness/ ChatSync.ts

import type * as qbusiness from "@distilled.cloud/aws/qbusiness";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { Application } from "./Application.ts";

/**
 * `ChatSync` request with `applicationId` injected from the bound application.
 */
export interface ChatSyncRequest extends Omit<qbusiness.ChatSyncInput, "applicationId"> {}

/**
 * Runtime binding for the `ChatSync` operation (IAM action
 * `qbusiness:ChatSync`), scoped to one {@link Application}.
 *
 * Sends a user message to the application and returns the full
 * AI-generated answer in one response, including source attributions
 * and any suggested plugin actions.
 * Provide the implementation with
 * `Effect.provide(AWS.QBusiness.ChatSyncHttp)`.
 *
 * ### Chat
 * **Example:** Ask a Question
 * ```typescript
 * const chat = yield* AWS.QBusiness.ChatSync(app);
 *
 * const reply = yield* chat({ userMessage: "What is our travel policy?" });
 * console.log(reply.systemMessage);
 * ```
 *
 * @binding
 */
export interface ChatSync extends Binding.Service<
  ChatSync,
  "AWS.QBusiness.ChatSync",
  (
    application: Application,
  ) => Effect.Effect<
    (request?: ChatSyncRequest) => Effect.Effect<qbusiness.ChatSyncOutput, qbusiness.ChatSyncError>
  >
> {}
export const ChatSync = Binding.Service<ChatSync>("AWS.QBusiness.ChatSync");