@juspay/neurolink 12.50.0 → 12.51.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 +3 -3
- package/dist/browser/neurolink.min.js +666 -666
- package/dist/cli/commands/setup.d.ts +7 -5
- package/dist/cli/commands/setup.js +10 -8
- package/dist/constants/enums.d.ts +7 -15
- package/dist/constants/enums.js +8 -16
- package/dist/constants/timeouts.d.ts +6 -0
- package/dist/constants/timeouts.js +6 -0
- package/dist/factories/providerDescriptors.d.ts +17 -3
- package/dist/factories/providerDescriptors.js +81 -56
- package/dist/factories/providerRegistry.d.ts +9 -1
- package/dist/factories/providerRegistry.js +19 -9
- package/dist/models/manifestRegistry.js +40 -3
- package/dist/providers/catalog/index.generated.d.ts +3 -1
- package/dist/providers/catalog/index.generated.js +11 -0
- package/dist/providers/catalog/laya.json +107 -0
- package/dist/providers/catalog/loader.d.ts +7 -4
- package/dist/providers/catalog/loader.js +10 -3
- package/dist/providers/catalog/provider-catalog.schema.json +218 -11
- package/dist/providers/catalog/schema.d.ts +11 -9
- package/dist/providers/catalog/schema.js +333 -59
- package/dist/providers/configuredDecision.d.ts +23 -0
- package/dist/providers/configuredDecision.js +111 -0
- package/dist/providers/decide/baseUrl.d.ts +2 -0
- package/dist/providers/decide/baseUrl.js +14 -0
- package/dist/providers/decide/errors.d.ts +8 -0
- package/dist/providers/decide/errors.js +57 -0
- package/dist/providers/decide/formatters.d.ts +2 -0
- package/dist/providers/decide/formatters.js +4 -0
- package/dist/providers/decide/paths.d.ts +1 -0
- package/dist/providers/decide/paths.js +21 -0
- package/dist/providers/decide/template.d.ts +3 -0
- package/dist/providers/decide/template.js +13 -0
- package/dist/types/providerCatalog.d.ts +74 -1
- package/dist/types/providerCatalog.generated.d.ts +2 -2
- package/dist/types/providers.d.ts +12 -9
- package/dist/utils/errorHandling.d.ts +11 -1
- package/dist/utils/errorHandling.js +17 -2
- package/dist/utils/modelChoices.js +11 -25
- package/dist/utils/providerConfig.d.ts +0 -5
- package/dist/utils/providerConfig.js +0 -17
- package/dist/workflow/core/ensembleExecutor.js +29 -16
- package/docs-site/static/search-index.json +7 -7
- package/package.json +7 -2
- package/dist/models/manifests/laya.d.ts +0 -12
- package/dist/models/manifests/laya.js +0 -54
- package/dist/providers/laya.d.ts +0 -40
- package/dist/providers/laya.js +0 -152
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.51.1",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"description": "The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002/call) for routing, tool selection and context budgeting. MCP-native (4 transports), voice TTS/STT/realtime, RAG, agents, memory, compaction, 9 observability exporters. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · TypeSafe Jev and more.",
|
|
6
6
|
"author": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"preview": "vite preview",
|
|
42
42
|
"prepare": "git rev-parse --git-dir > /dev/null 2>&1 && husky install || echo 'Skipping husky in non-git environment'",
|
|
43
43
|
"prepack": "svelte-kit sync && svelte-package && pnpm run build:react-hooks && pnpm run build:cli && pnpm run build:browser && publint",
|
|
44
|
-
"build:react-hooks": "pnpm exec tsc --jsx react-jsx --module nodenext --moduleResolution nodenext --target esnext --esModuleInterop --skipLibCheck --outDir dist --declaration false src/lib/client/reactHooks.tsx",
|
|
44
|
+
"build:react-hooks": "pnpm exec tsc --jsx react-jsx --module nodenext --moduleResolution nodenext --target esnext --esModuleInterop --skipLibCheck --strict --outDir dist --declaration false src/lib/client/reactHooks.tsx",
|
|
45
45
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json && tsc --noEmit --strict",
|
|
46
46
|
"check:models": "tsx tools/check-model-liveness.ts",
|
|
47
47
|
"check:ci-scripts": "svelte-kit sync && tsc -p tsconfig.ci-scripts.json",
|
|
@@ -145,13 +145,16 @@
|
|
|
145
145
|
"test:stream-structured-output": "pnpm exec tsx test/continuous-test-suite-stream-structured-output.ts",
|
|
146
146
|
"test:browser-bundle": "pnpm exec tsx test/continuous-test-suite-browser-bundle.ts",
|
|
147
147
|
"test:providers-mocked": "pnpm exec tsx test/continuous-test-suite-providers-mocked.ts",
|
|
148
|
+
"test:decide-contract": "pnpm exec tsx test/continuous-test-suite-decide-provider-contract.ts",
|
|
148
149
|
"test:acceptance-gate": "pnpm exec tsx test/continuous-test-suite-acceptance-gate.ts",
|
|
149
150
|
"test:cli-fallback": "pnpm exec tsx test/continuous-test-suite-cli-fallback.ts",
|
|
150
151
|
"scaffold:provider": "pnpm exec tsx tools/scaffold-provider.ts",
|
|
151
152
|
"verify:provider-onboarding": "pnpm exec tsx tools/verify-provider-onboarding.ts",
|
|
152
153
|
"test:openai-compat-catalog": "pnpm exec tsx test/continuous-test-suite-openai-compat-catalog.ts",
|
|
153
154
|
"test:catalog-auth-header-style": "pnpm exec tsx test/continuous-test-suite-catalog-auth-header-style.ts",
|
|
155
|
+
"test:decide-catalog-schema": "pnpm exec tsx test/continuous-test-suite-decide-catalog-schema.ts",
|
|
154
156
|
"test:provider-descriptors": "pnpm exec tsx test/continuous-test-suite-provider-descriptors.ts",
|
|
157
|
+
"test:decide-engine": "pnpm exec tsx test/continuous-test-suite-decide-engine.ts",
|
|
155
158
|
"test:provider-structure": "pnpm exec tsx test/continuous-test-suite-provider-structure.ts",
|
|
156
159
|
"test:model-manifests": "pnpm exec tsx test/continuous-test-suite-model-manifests.ts",
|
|
157
160
|
"test:cli-models-list": "pnpm exec tsx test/continuous-test-suite-cli-models-list.ts",
|
|
@@ -163,6 +166,7 @@
|
|
|
163
166
|
"test:rag": "pnpm exec tsx test/continuous-test-suite-rag.ts",
|
|
164
167
|
"test:skills": "pnpm exec tsx test/continuous-test-suite-skills.ts",
|
|
165
168
|
"test:decide": "pnpm exec tsx test/continuous-test-suite-decide.ts",
|
|
169
|
+
"test:decide-catalog": "pnpm exec tsx test/continuous-test-suite-decide-catalog.ts",
|
|
166
170
|
"test:agent-mode": "pnpm exec tsx test/continuous-test-suite-agent-mode.ts",
|
|
167
171
|
"test:servers": "pnpm exec tsx test/continuous-test-suite-servers.ts",
|
|
168
172
|
"test:websocket-agent-handler": "pnpm exec tsx test/continuous-test-suite-websocket-agent-handler.ts",
|
|
@@ -195,6 +199,7 @@
|
|
|
195
199
|
"test:bugfixes": "pnpm exec tsx test/continuous-test-suite-bugfixes.ts",
|
|
196
200
|
"test:json-e2e": "pnpm exec tsx test/continuous-test-suite-json-e2e.ts",
|
|
197
201
|
"test:workflow": "pnpm exec tsx test/continuous-test-suite-workflow.ts",
|
|
202
|
+
"test:workflow-deadlines": "pnpm exec tsx test/continuous-test-suite-workflow-deadlines.ts",
|
|
198
203
|
"test:hitl": "pnpm exec tsx test/continuous-test-suite-hitl.ts",
|
|
199
204
|
"test:hitl:timeout-exclusions": "pnpm exec tsx test/continuous-test-suite-hitl-timeout-exclusions.ts",
|
|
200
205
|
"test:tasks": "pnpm exec tsx test/continuous-test-suite-tasks.ts",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ProviderModelManifest } from "../../types/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Laya — the `decide` inference type, not text generation.
|
|
4
|
-
*
|
|
5
|
-
* `contextWindow` is each checkpoint's encoder window, the whole budget for
|
|
6
|
-
* the state plus one question's instructions and options. `auto` carries the
|
|
7
|
-
* English figure because Laya's router may pick the English checkpoint.
|
|
8
|
-
*
|
|
9
|
-
* `maxOutputTokens` is required by the manifest type but has no honest value
|
|
10
|
-
* for a model that emits no text, so a small non-zero figure is used.
|
|
11
|
-
*/
|
|
12
|
-
export declare const layaManifest: ProviderModelManifest;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Laya — the `decide` inference type, not text generation.
|
|
3
|
-
*
|
|
4
|
-
* `contextWindow` is each checkpoint's encoder window, the whole budget for
|
|
5
|
-
* the state plus one question's instructions and options. `auto` carries the
|
|
6
|
-
* English figure because Laya's router may pick the English checkpoint.
|
|
7
|
-
*
|
|
8
|
-
* `maxOutputTokens` is required by the manifest type but has no honest value
|
|
9
|
-
* for a model that emits no text, so a small non-zero figure is used.
|
|
10
|
-
*/
|
|
11
|
-
export const layaManifest = {
|
|
12
|
-
defaultContextWindow: 1024,
|
|
13
|
-
models: {
|
|
14
|
-
_default: {
|
|
15
|
-
aliases: [],
|
|
16
|
-
contextWindow: 1024,
|
|
17
|
-
maxOutputTokens: 256,
|
|
18
|
-
vision: false,
|
|
19
|
-
functionCalling: false,
|
|
20
|
-
},
|
|
21
|
-
"typed-decisions": {
|
|
22
|
-
aliases: [],
|
|
23
|
-
displayName: "Laya (typed decisions)",
|
|
24
|
-
contextWindow: 1024,
|
|
25
|
-
maxOutputTokens: 256,
|
|
26
|
-
vision: false,
|
|
27
|
-
functionCalling: false,
|
|
28
|
-
},
|
|
29
|
-
multilingual: {
|
|
30
|
-
aliases: [],
|
|
31
|
-
displayName: "Laya (multilingual)",
|
|
32
|
-
contextWindow: 1024,
|
|
33
|
-
maxOutputTokens: 256,
|
|
34
|
-
vision: false,
|
|
35
|
-
functionCalling: false,
|
|
36
|
-
},
|
|
37
|
-
english: {
|
|
38
|
-
aliases: [],
|
|
39
|
-
displayName: "Laya (English)",
|
|
40
|
-
contextWindow: 512,
|
|
41
|
-
maxOutputTokens: 256,
|
|
42
|
-
vision: false,
|
|
43
|
-
functionCalling: false,
|
|
44
|
-
},
|
|
45
|
-
auto: {
|
|
46
|
-
aliases: [],
|
|
47
|
-
displayName: "Laya (routed by language)",
|
|
48
|
-
contextWindow: 512,
|
|
49
|
-
maxOutputTokens: 256,
|
|
50
|
-
vision: false,
|
|
51
|
-
functionCalling: false,
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
};
|
package/dist/providers/laya.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { DecisionError, DecisionState, NeurolinkCredentials } from "../types/index.js";
|
|
2
|
-
import { SystemOneDecisionProvider } from "./systemOneDecision.js";
|
|
3
|
-
/**
|
|
4
|
-
* Laya Provider — the `decide` inference type only.
|
|
5
|
-
*
|
|
6
|
-
* Laya is Convai Innovations' open-weights "System One" decision model: the
|
|
7
|
-
* same typed `noul` / `choice` / `score` questions as TypeSafe's Jev, answered
|
|
8
|
-
* by an encoder in one forward pass, on the same wire. The request loop,
|
|
9
|
-
* retries, auth circuit breaker and answer parsing are shared with every
|
|
10
|
-
* decision provider in {@link SystemOneDecisionProvider}.
|
|
11
|
-
*
|
|
12
|
-
* Its encoders read far less than Jev: 1,024 tokens on the `typed-decisions`
|
|
13
|
-
* and `multilingual` checkpoints, 512 on `english`. The descriptor's
|
|
14
|
-
* `decisionLimits` refuses what does not fit rather than letting the server
|
|
15
|
-
* cut the state off silently.
|
|
16
|
-
*
|
|
17
|
-
* @see https://github.com/NandhaKishorM/laya
|
|
18
|
-
*/
|
|
19
|
-
export declare class LayaProvider extends SystemOneDecisionProvider {
|
|
20
|
-
private readonly apiKey;
|
|
21
|
-
private readonly baseURL;
|
|
22
|
-
constructor(modelName?: string, sdk?: unknown, _region?: string, credentials?: NeurolinkCredentials["laya"]);
|
|
23
|
-
protected getDefaultModel(): string;
|
|
24
|
-
protected vendorLabel(): string;
|
|
25
|
-
protected vendorDisplayName(): string;
|
|
26
|
-
protected decisionApiKey(): string;
|
|
27
|
-
protected missingKeyMessage(): string;
|
|
28
|
-
protected missingConfigMessage(): string | undefined;
|
|
29
|
-
protected decisionEndpoint(): string;
|
|
30
|
-
protected decisionHeaders(): Record<string, string>;
|
|
31
|
-
/** `auto` means "let Laya's router choose", which it does when no model is named. */
|
|
32
|
-
protected buildDecisionBody(state: DecisionState, questions: Record<string, Record<string, unknown>>, model: string): Record<string, unknown>;
|
|
33
|
-
protected parseDecisionError(status: number, payload: unknown, requestId: string | undefined): DecisionError;
|
|
34
|
-
protected readRequestId(headers: Headers): string | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* The checkpoint that actually answered is `routing.model` — the one Laya's
|
|
37
|
-
* router picked when the request said `auto`.
|
|
38
|
-
*/
|
|
39
|
-
protected resolveResponseModel(payload: Record<string, unknown>, requestedModel: string): string;
|
|
40
|
-
}
|
package/dist/providers/laya.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { LayaModels } from "../constants/enums.js";
|
|
2
|
-
import { logger } from "../utils/logger.js";
|
|
3
|
-
import { redactUrlForError } from "../utils/logSanitize.js";
|
|
4
|
-
import { getProviderModel } from "../utils/providerConfig.js";
|
|
5
|
-
import { describeValidationErrors, isRecord, redactCredentials, SystemOneDecisionProvider, } from "./systemOneDecision.js";
|
|
6
|
-
/**
|
|
7
|
-
* Normalise the two envelopes a Laya failure can arrive in.
|
|
8
|
-
*
|
|
9
|
-
* LiteLLM's own, `{"error":{"message","type","code"}}`, for anything the proxy
|
|
10
|
-
* rejects before Laya sees it (a bad key, a rate limit). FastAPI's, from
|
|
11
|
-
* Laya's server: `{"detail":"..."}` for its own checks (question types, the
|
|
12
|
-
* question cap) and `{"detail":[{loc,msg,input}]}` for request validation.
|
|
13
|
-
*/
|
|
14
|
-
function parseLayaError(status, body, requestId) {
|
|
15
|
-
const retryable = status === 429 || status >= 500;
|
|
16
|
-
const kind = status === 401 || status === 403
|
|
17
|
-
? "authentication"
|
|
18
|
-
: status === 413
|
|
19
|
-
? "max_tokens_exceeded"
|
|
20
|
-
: status === 429
|
|
21
|
-
? "rate_limit"
|
|
22
|
-
: status === 503
|
|
23
|
-
? "overloaded"
|
|
24
|
-
: status >= 500
|
|
25
|
-
? "server"
|
|
26
|
-
: "invalid_request";
|
|
27
|
-
const proxyError = isRecord(body) && isRecord(body.error) ? body.error : undefined;
|
|
28
|
-
if (proxyError &&
|
|
29
|
-
typeof proxyError.message === "string" &&
|
|
30
|
-
proxyError.message.length > 0) {
|
|
31
|
-
return {
|
|
32
|
-
kind,
|
|
33
|
-
message: proxyError.message,
|
|
34
|
-
status,
|
|
35
|
-
requestId,
|
|
36
|
-
retryable,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
const detail = isRecord(body) ? body.detail : undefined;
|
|
40
|
-
if (Array.isArray(detail)) {
|
|
41
|
-
return {
|
|
42
|
-
kind: "invalid_request",
|
|
43
|
-
message: `Request failed validation — ${describeValidationErrors(detail)}`,
|
|
44
|
-
status,
|
|
45
|
-
requestId,
|
|
46
|
-
retryable: false,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
if (typeof detail === "string" && detail.length > 0) {
|
|
50
|
-
return { kind, message: detail, status, requestId, retryable };
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
kind,
|
|
54
|
-
message: `Laya request failed with HTTP ${status}`,
|
|
55
|
-
status,
|
|
56
|
-
requestId,
|
|
57
|
-
retryable,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Laya Provider — the `decide` inference type only.
|
|
62
|
-
*
|
|
63
|
-
* Laya is Convai Innovations' open-weights "System One" decision model: the
|
|
64
|
-
* same typed `noul` / `choice` / `score` questions as TypeSafe's Jev, answered
|
|
65
|
-
* by an encoder in one forward pass, on the same wire. The request loop,
|
|
66
|
-
* retries, auth circuit breaker and answer parsing are shared with every
|
|
67
|
-
* decision provider in {@link SystemOneDecisionProvider}.
|
|
68
|
-
*
|
|
69
|
-
* Its encoders read far less than Jev: 1,024 tokens on the `typed-decisions`
|
|
70
|
-
* and `multilingual` checkpoints, 512 on `english`. The descriptor's
|
|
71
|
-
* `decisionLimits` refuses what does not fit rather than letting the server
|
|
72
|
-
* cut the state off silently.
|
|
73
|
-
*
|
|
74
|
-
* @see https://github.com/NandhaKishorM/laya
|
|
75
|
-
*/
|
|
76
|
-
export class LayaProvider extends SystemOneDecisionProvider {
|
|
77
|
-
apiKey;
|
|
78
|
-
baseURL;
|
|
79
|
-
constructor(modelName, sdk, _region, credentials) {
|
|
80
|
-
super(modelName, "laya", sdk);
|
|
81
|
-
this.apiKey =
|
|
82
|
-
credentials?.apiKey?.trim() || (process.env.LAYA_API_KEY?.trim() ?? "");
|
|
83
|
-
// No built-in endpoint: Laya is self-hosted or reached through a proxy
|
|
84
|
-
// (a Laya server, or a LiteLLM pass-through route to one), so the base URL
|
|
85
|
-
// comes only from config. `||`, not `??`, so a blank one counts as unset.
|
|
86
|
-
this.baseURL = (credentials?.baseURL?.trim() ||
|
|
87
|
-
process.env.LAYA_BASE_URL?.trim() ||
|
|
88
|
-
"").replace(/\/+$/, "");
|
|
89
|
-
// A self-hosted LAYA_BASE_URL can carry `user:pass@` or a `?token=`.
|
|
90
|
-
logger.debug("Laya Provider initialized (decide only)", {
|
|
91
|
-
modelName: this.modelName,
|
|
92
|
-
baseURL: this.baseURL ? redactUrlForError(this.baseURL) : "(not set)",
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
getDefaultModel() {
|
|
96
|
-
return getProviderModel("LAYA_MODEL", LayaModels.TYPED_DECISIONS);
|
|
97
|
-
}
|
|
98
|
-
vendorLabel() {
|
|
99
|
-
return "Laya";
|
|
100
|
-
}
|
|
101
|
-
vendorDisplayName() {
|
|
102
|
-
return "Laya";
|
|
103
|
-
}
|
|
104
|
-
decisionApiKey() {
|
|
105
|
-
return this.apiKey;
|
|
106
|
-
}
|
|
107
|
-
missingKeyMessage() {
|
|
108
|
-
return "Laya requires an API key. Set LAYA_API_KEY or pass credentials.laya.apiKey.";
|
|
109
|
-
}
|
|
110
|
-
missingConfigMessage() {
|
|
111
|
-
return this.baseURL
|
|
112
|
-
? undefined
|
|
113
|
-
: "Laya requires a base URL. Set LAYA_BASE_URL or pass credentials.laya.baseURL.";
|
|
114
|
-
}
|
|
115
|
-
decisionEndpoint() {
|
|
116
|
-
return `${this.baseURL}/predict`;
|
|
117
|
-
}
|
|
118
|
-
decisionHeaders() {
|
|
119
|
-
return {
|
|
120
|
-
Authorization: `Bearer ${this.apiKey}`,
|
|
121
|
-
"Content-Type": "application/json",
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
/** `auto` means "let Laya's router choose", which it does when no model is named. */
|
|
125
|
-
buildDecisionBody(state, questions, model) {
|
|
126
|
-
return model === LayaModels.AUTO
|
|
127
|
-
? { state, questions }
|
|
128
|
-
: { model, state, questions };
|
|
129
|
-
}
|
|
130
|
-
parseDecisionError(status, payload, requestId) {
|
|
131
|
-
const parsed = parseLayaError(status, payload, requestId);
|
|
132
|
-
const message = redactCredentials(parsed.message, this.apiKey);
|
|
133
|
-
return {
|
|
134
|
-
...parsed,
|
|
135
|
-
message: message || `Laya request failed with HTTP ${status}`,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
readRequestId(headers) {
|
|
139
|
-
return headers.get("x-litellm-call-id") ?? undefined;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* The checkpoint that actually answered is `routing.model` — the one Laya's
|
|
143
|
-
* router picked when the request said `auto`.
|
|
144
|
-
*/
|
|
145
|
-
resolveResponseModel(payload, requestedModel) {
|
|
146
|
-
const routing = payload.routing;
|
|
147
|
-
if (isRecord(routing) && typeof routing.model === "string") {
|
|
148
|
-
return routing.model;
|
|
149
|
-
}
|
|
150
|
-
return super.resolveResponseModel(payload, requestedModel);
|
|
151
|
-
}
|
|
152
|
-
}
|