@absolutejs/voice 0.0.22-beta.7 → 0.0.22-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +11 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7152,10 +7152,15 @@ var OUTPUT_SCHEMA = {
7152
7152
  },
7153
7153
  type: "object"
7154
7154
  };
7155
- var ROUTE_RESULT_INSTRUCTION = "Return a JSON object with assistantText, complete, transfer, escalate, voicemail, noAnswer, and result when you are not calling tools.";
7155
+ var ROUTE_RESULT_INSTRUCTION = "Return only a JSON object with assistantText, complete, transfer, escalate, voicemail, noAnswer, and result when you are not calling tools. Only set transfer, escalate, voicemail, or noAnswer when the user explicitly asks for that lifecycle outcome or a tool result says that exact outcome. Do not infer voicemail from generic words like voice, voice app, or voice integration.";
7156
+ var stripJSONCodeFence = (value) => {
7157
+ const trimmed = value.trim();
7158
+ const match = trimmed.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i);
7159
+ return match?.[1]?.trim() ?? value;
7160
+ };
7156
7161
  var parseJSON = (value) => {
7157
7162
  try {
7158
- const parsed = JSON.parse(value);
7163
+ const parsed = JSON.parse(stripJSONCodeFence(value));
7159
7164
  return parsed && typeof parsed === "object" ? parsed : {};
7160
7165
  } catch {
7161
7166
  return {
@@ -7600,8 +7605,10 @@ var createGeminiVoiceAssistantModel = (options) => {
7600
7605
  contents: input.messages.map(messageToGeminiContent).filter(Boolean),
7601
7606
  generationConfig: {
7602
7607
  maxOutputTokens: options.maxOutputTokens,
7603
- responseMimeType: "application/json",
7604
- responseSchema: toGeminiSchema(OUTPUT_SCHEMA),
7608
+ ...input.tools.length ? {} : {
7609
+ responseMimeType: "application/json",
7610
+ responseSchema: toGeminiSchema(OUTPUT_SCHEMA)
7611
+ },
7605
7612
  temperature: options.temperature
7606
7613
  },
7607
7614
  systemInstruction: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.7",
3
+ "version": "0.0.22-beta.9",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",