@absolutejs/voice 0.0.22-beta.8 → 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.
- package/dist/index.js +10 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7153,9 +7153,14 @@ var OUTPUT_SCHEMA = {
|
|
|
7153
7153
|
type: "object"
|
|
7154
7154
|
};
|
|
7155
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
|
-
|
|
7604
|
-
|
|
7608
|
+
...input.tools.length ? {} : {
|
|
7609
|
+
responseMimeType: "application/json",
|
|
7610
|
+
responseSchema: toGeminiSchema(OUTPUT_SCHEMA)
|
|
7611
|
+
},
|
|
7605
7612
|
temperature: options.temperature
|
|
7606
7613
|
},
|
|
7607
7614
|
systemInstruction: {
|