@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 55 lines 1.85 KB
Raw
1 import type * as lexr from "@distilled.cloud/aws/lex-runtime-v2";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { BotAlias } from "./BotAlias.ts";
5
6 /**
7 * The `RecognizeUtterance` request with the binding-injected `botId` and
8 * `botAliasId` removed. `requestContentType` selects the input media type
9 * (`text/plain; charset=utf-8` or an audio format) and `inputStream`
10 * carries the user input. `sessionState`/`requestAttributes` must be
11 * gzip-compressed and base64-encoded per the Lex V2 API contract.
12 */
13 export interface RecognizeUtteranceRequest extends Omit<
14 lexr.RecognizeUtteranceRequest,
15 "botId" | "botAliasId"
16 > {}
17
18 /**
19 * Runtime binding for `lex:RecognizeUtterance` — send user text or audio to
20 * an Amazon Lex V2 bot alias. Unlike `RecognizeText`, the response's
21 * `messages`/`sessionState`/`interpretations` come back gzip-compressed and
22 * base64-encoded, and an `audioStream` reply is available for voice bots.
23 *
24 * ### Conversing with a Bot
25 * **Example:** Send a Text Utterance
26 * ```typescript
27 * // init
28 * const recognizeUtterance = yield* AWS.LexV2.RecognizeUtterance(alias);
29 *
30 * // runtime — response fields are gzip+base64; decode before use
31 * const reply = yield* recognizeUtterance({
32 * localeId: "en_US",
33 * sessionId: "user-123",
34 * requestContentType: "text/plain; charset=utf-8",
35 * inputStream: new TextEncoder().encode("hello"),
36 * });
37 * ```
38 *
39 * @binding
40 */
41 export interface RecognizeUtterance extends Binding.Service<
42 RecognizeUtterance,
43 "AWS.LexV2.RecognizeUtterance",
44 (
45 alias: BotAlias,
46 ) => Effect.Effect<
47 (
48 request: RecognizeUtteranceRequest,
49 ) => Effect.Effect<lexr.RecognizeUtteranceResponse, lexr.RecognizeUtteranceError>
50 >
51 > {}
52
53 export const RecognizeUtterance = Binding.Service<RecognizeUtterance>(
54 "AWS.LexV2.RecognizeUtterance",
55 );