@juspay/neurolink 11.18.4 → 11.18.5
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/CHANGELOG.md +6 -1
- package/dist/browser/neurolink.min.js +239 -239
- package/dist/proxy/geminiFormat.js +25 -4
- package/package.json +1 -1
|
@@ -20,6 +20,14 @@
|
|
|
20
20
|
*/
|
|
21
21
|
/** Google's role for assistant turns. */
|
|
22
22
|
const MODEL_ROLE = "model";
|
|
23
|
+
/**
|
|
24
|
+
* Sent as `input.text` when a request's final turn is a model turn.
|
|
25
|
+
*
|
|
26
|
+
* Google lets a client continue generation from the assistant's own last turn;
|
|
27
|
+
* the chat-completions wire format the engine targets has no way to say that,
|
|
28
|
+
* and an empty prompt is rejected before any provider is reached.
|
|
29
|
+
*/
|
|
30
|
+
const CONTINUATION_PROMPT = "Continue.";
|
|
23
31
|
function partsToText(parts) {
|
|
24
32
|
if (!Array.isArray(parts)) {
|
|
25
33
|
return "";
|
|
@@ -91,11 +99,24 @@ export function parseGeminiRequest(model, body, stream) {
|
|
|
91
99
|
// it, which is the same lost-turn bug one case further along.
|
|
92
100
|
//
|
|
93
101
|
// A terminal placeholder restores the invariant: the slice removes this
|
|
94
|
-
// instead of the model turn.
|
|
95
|
-
//
|
|
96
|
-
//
|
|
102
|
+
// instead of the model turn.
|
|
103
|
+
//
|
|
104
|
+
// The prompt needs its own answer, and leaving it "" was a 500. A
|
|
105
|
+
// model-final request carries no user turn to send as `input.text`, and
|
|
106
|
+
// NeuroLink's stream() rejects an empty one outright — "Stream options must
|
|
107
|
+
// include either input.text, input.audio, or stt.audio" — so every continue
|
|
108
|
+
// from a model turn failed at the door rather than reaching a provider. The
|
|
109
|
+
// placeholder above fixed the history slice but never exercised this path,
|
|
110
|
+
// because nothing had sent the request.
|
|
111
|
+
//
|
|
112
|
+
// Google's semantics for a model-final `contents` are "keep going", and the
|
|
113
|
+
// chat-completions shape the engine translates into has no assistant-prefill
|
|
114
|
+
// to express that. An explicit continuation instruction is the closest
|
|
115
|
+
// faithful equivalent: the full conversation still arrives as history, and
|
|
116
|
+
// the model is told to continue it rather than being handed an empty turn.
|
|
97
117
|
if (turns.length > 0 && turns[turns.length - 1].role !== "user") {
|
|
98
|
-
conversationMessages.push({ role: "user", content:
|
|
118
|
+
conversationMessages.push({ role: "user", content: CONTINUATION_PROMPT });
|
|
119
|
+
prompt = CONTINUATION_PROMPT;
|
|
99
120
|
}
|
|
100
121
|
const numeric = (v) => typeof v === "number" && Number.isFinite(v) ? v : undefined;
|
|
101
122
|
const stops = generationConfig.stopSequences;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "11.18.
|
|
3
|
+
"version": "11.18.5",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"description": "TypeScript AI SDK with 24+ LLM providers behind one consistent API. MCP-native (connect any MCP server), voice TTS/STT/realtime, RAG, agents, memory, context compaction. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · DeepSeek · NVIDIA NIM and more.",
|
|
6
6
|
"author": {
|