@juspay/neurolink 9.67.3 → 9.68.1
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 +8 -0
- package/dist/browser/neurolink.min.js +432 -442
- package/dist/lib/providers/azureOpenai.d.ts +55 -18
- package/dist/lib/providers/azureOpenai.js +167 -167
- package/dist/lib/providers/openaiChatCompletionsBase.d.ts +31 -1
- package/dist/lib/providers/openaiChatCompletionsBase.js +62 -21
- package/dist/lib/providers/openaiChatCompletionsClient.d.ts +3 -0
- package/dist/lib/providers/openaiChatCompletionsClient.js +39 -0
- package/dist/lib/types/openaiCompatible.d.ts +0 -1
- package/dist/lib/types/providers.d.ts +1 -0
- package/dist/providers/azureOpenai.d.ts +55 -18
- package/dist/providers/azureOpenai.js +167 -167
- package/dist/providers/openaiChatCompletionsBase.d.ts +31 -1
- package/dist/providers/openaiChatCompletionsBase.js +62 -21
- package/dist/providers/openaiChatCompletionsClient.d.ts +3 -0
- package/dist/providers/openaiChatCompletionsClient.js +39 -0
- package/dist/types/openaiCompatible.d.ts +0 -1
- package/dist/types/providers.d.ts +1 -0
- package/package.json +1 -1
|
@@ -318,6 +318,45 @@ export const mapNeuroLinkToolChoice = (choice) => {
|
|
|
318
318
|
}
|
|
319
319
|
return undefined;
|
|
320
320
|
};
|
|
321
|
+
// OpenAI-compatible endpoints (OpenAI, DeepSeek, …) reject
|
|
322
|
+
// `response_format: { type: "json_object" }` unless the literal word "json"
|
|
323
|
+
// appears somewhere in the messages. The `@ai-sdk/openai-compatible` wrapper
|
|
324
|
+
// this client replaced injected that instruction for us; the native client
|
|
325
|
+
// must do the same or json_object requests 400.
|
|
326
|
+
export const messagesContainJsonWord = (messages) => messages.some((m) => {
|
|
327
|
+
const c = m.content;
|
|
328
|
+
if (typeof c === "string") {
|
|
329
|
+
return /\bjson\b/i.test(c);
|
|
330
|
+
}
|
|
331
|
+
if (Array.isArray(c)) {
|
|
332
|
+
return c.some((part) => typeof part?.text === "string" &&
|
|
333
|
+
/\bjson\b/i.test(part.text));
|
|
334
|
+
}
|
|
335
|
+
return false;
|
|
336
|
+
});
|
|
337
|
+
// Prepends a minimal JSON-instruction system message to the FINAL wire body
|
|
338
|
+
// when json_object mode is requested and its messages don't already mention
|
|
339
|
+
// "json". Operates on the post-`adjustRequestBody` body so the guard reflects
|
|
340
|
+
// whatever a subclass left on the wire (response_format/messages it may have
|
|
341
|
+
// rewritten), not an intermediate state. No-op otherwise.
|
|
342
|
+
export const ensureJsonWordInBody = (body) => body.response_format?.type === "json_object" &&
|
|
343
|
+
!messagesContainJsonWord(body.messages)
|
|
344
|
+
? {
|
|
345
|
+
...body,
|
|
346
|
+
messages: [
|
|
347
|
+
{
|
|
348
|
+
role: "system",
|
|
349
|
+
content: "Respond with valid JSON only — no prose, no markdown fencing.",
|
|
350
|
+
},
|
|
351
|
+
...body.messages,
|
|
352
|
+
],
|
|
353
|
+
}
|
|
354
|
+
: body;
|
|
355
|
+
// Reasoning-class OpenAI models (o-series, gpt-5+) reject `max_tokens` and
|
|
356
|
+
// require `max_completion_tokens`. The OpenAI + Azure providers use this to
|
|
357
|
+
// rename the field on the wire body; third-party OpenAI-compatible endpoints
|
|
358
|
+
// keep `max_tokens`, so it is opt-in per provider, never applied by default.
|
|
359
|
+
export const requiresMaxCompletionTokens = (modelId) => /^(o\d|gpt-5)/i.test(modelId.replace(/^.*\//, ""));
|
|
321
360
|
export const buildBody = (args) => {
|
|
322
361
|
const { modelId, messages, options, tools, toolChoice, streaming, responseFormat, } = args;
|
|
323
362
|
const body = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.68.1",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"description": "Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applications with 21+ providers: OpenAI, Anthropic, Google AI Studio, Google Vertex, AWS Bedrock, Azure OpenAI, Mistral, LiteLLM, SageMaker, Hugging Face, Ollama, OpenAI-compatible, OpenRouter, DeepSeek, NVIDIA NIM, LM Studio, llama.cpp, plus voice (OpenAI TTS, ElevenLabs, Deepgram, Azure Speech).",
|
|
6
6
|
"author": {
|