@volley/recognition-client-sdk
Version:
Recognition Service TypeScript/Node.js Client SDK
91 lines • 4.32 kB
TypeScript
import { z } from "zod";
/**
* VGF-style state schema for game-side recognition state/results management.
*
* This schema provides a standardized way for game developers to manage
* voice recognition state and results in their applications. It supports:
*
* STEP 1: Basic transcription flow
* STEP 2: Mic auto-stop upon correct answer (using partial transcripts)
* STEP 3: Semantic/function-call outcomes for game actions
*
* Ideally this should be part of a more centralized shared type library to free
* game developers and provide helper functions (VGF? Platform SDK?).
*/
export declare const RecognitionVGFStateSchema: z.ZodObject<{
audioUtteranceId: z.ZodString;
startRecordingStatus: z.ZodOptional<z.ZodString>;
transcriptionStatus: z.ZodOptional<z.ZodString>;
finalTranscript: z.ZodOptional<z.ZodString>;
finalConfidence: z.ZodOptional<z.ZodNumber>;
asrConfig: z.ZodOptional<z.ZodString>;
startRecordingTimestamp: z.ZodOptional<z.ZodString>;
finalRecordingTimestamp: z.ZodOptional<z.ZodString>;
finalTranscriptionTimestamp: z.ZodOptional<z.ZodString>;
pendingTranscript: z.ZodDefault<z.ZodOptional<z.ZodString>>;
pendingConfidence: z.ZodOptional<z.ZodNumber>;
functionCallMetadata: z.ZodOptional<z.ZodString>;
functionCallConfidence: z.ZodOptional<z.ZodNumber>;
finalFunctionCallTimestamp: z.ZodOptional<z.ZodString>;
promptSlotMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
recognitionActionProcessingState: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
audioUtteranceId: string;
pendingTranscript: string;
startRecordingStatus?: string | undefined;
transcriptionStatus?: string | undefined;
finalTranscript?: string | undefined;
finalConfidence?: number | undefined;
asrConfig?: string | undefined;
startRecordingTimestamp?: string | undefined;
finalRecordingTimestamp?: string | undefined;
finalTranscriptionTimestamp?: string | undefined;
pendingConfidence?: number | undefined;
functionCallMetadata?: string | undefined;
functionCallConfidence?: number | undefined;
finalFunctionCallTimestamp?: string | undefined;
promptSlotMap?: Record<string, string[]> | undefined;
recognitionActionProcessingState?: string | undefined;
}, {
audioUtteranceId: string;
startRecordingStatus?: string | undefined;
transcriptionStatus?: string | undefined;
finalTranscript?: string | undefined;
finalConfidence?: number | undefined;
asrConfig?: string | undefined;
startRecordingTimestamp?: string | undefined;
finalRecordingTimestamp?: string | undefined;
finalTranscriptionTimestamp?: string | undefined;
pendingTranscript?: string | undefined;
pendingConfidence?: number | undefined;
functionCallMetadata?: string | undefined;
functionCallConfidence?: number | undefined;
finalFunctionCallTimestamp?: string | undefined;
promptSlotMap?: Record<string, string[]> | undefined;
recognitionActionProcessingState?: string | undefined;
}>;
export type RecognitionState = z.infer<typeof RecognitionVGFStateSchema>;
export declare const RecordingStatus: {
readonly NOT_READY: "NOT_READY";
readonly READY: "READY";
readonly RECORDING: "RECORDING";
readonly FINISHED: "FINISHED";
};
export type RecordingStatusType = typeof RecordingStatus[keyof typeof RecordingStatus];
export declare const TranscriptionStatus: {
readonly NOT_STARTED: "NOT_STARTED";
readonly IN_PROGRESS: "IN_PROGRESS";
readonly FINALIZED: "FINALIZED";
readonly ABORTED: "ABORTED";
readonly ERROR: "ERROR";
};
export type TranscriptionStatusType = typeof TranscriptionStatus[keyof typeof TranscriptionStatus];
export declare const RecognitionActionProcessingState: {
readonly NOT_STARTED: "NOT_STARTED";
readonly IN_PROGRESS: "IN_PROGRESS";
readonly COMPLETED: "COMPLETED";
};
export type RecognitionActionProcessingStateType = typeof RecognitionActionProcessingState[keyof typeof RecognitionActionProcessingState];
export declare function createInitialRecognitionState(audioUtteranceId: string): RecognitionState;
export declare function isValidRecordingStatusTransition(from: string | undefined, to: string): boolean;
//# sourceMappingURL=vgf-recognition-state.d.ts.map