parseEndJudgement (voice-end-judge/index.ts)

airi · packages/agents/src/voice-end-judge/index.ts · typescript · MIT
voice

Parses model replies to judge if a spoken message is complete, and builds requests.

// Source: https://github.com/moeru-ai/airi | License: MIT | Copyright 2024-PRESENT Neko Ayaka
// Provided via justclaw.it.com; keep this notice with the code.
import type { Conversation, ConversationContext } from '@proj-airi/core-agent'

import type { GenerateText } from '../generate-text'

import { boolean, object, parse } from 'valibot'

import { readJsonReply } from '../json-reply'

/** Whether the speaker finished the message, as a chat model reads the transcript. */
export type EndJudgement = 'complete' | 'incomplete'

export const VOICE_END_JUDGE_INSTRUCTIONS = [
  'You decide if a speaker finished a spoken message, from the speech recognition text of it so far.',
  'The speaker paused. Reply complete when the message is a full request, question, or statement.',
  'Reply incomplete

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key