@juspay/neurolink 9.67.2 → 9.67.3
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 +2 -0
- package/dist/browser/neurolink.min.js +326 -326
- package/dist/lib/providers/litellm.d.ts +25 -32
- package/dist/lib/providers/litellm.js +132 -601
- package/dist/lib/providers/openaiChatCompletionsBase.d.ts +93 -0
- package/dist/lib/providers/openaiChatCompletionsBase.js +644 -0
- package/dist/lib/providers/openaiCompatible.d.ts +7 -63
- package/dist/lib/providers/openaiCompatible.js +27 -658
- package/dist/lib/types/openaiCompatible.d.ts +20 -0
- package/dist/providers/litellm.d.ts +25 -32
- package/dist/providers/litellm.js +132 -601
- package/dist/providers/openaiChatCompletionsBase.d.ts +93 -0
- package/dist/providers/openaiChatCompletionsBase.js +643 -0
- package/dist/providers/openaiCompatible.d.ts +7 -63
- package/dist/providers/openaiCompatible.js +27 -658
- package/dist/types/openaiCompatible.d.ts +20 -0
- package/package.json +1 -1
|
@@ -1,77 +1,21 @@
|
|
|
1
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
2
|
-
import {
|
|
3
|
-
import type { LanguageModel, Schema, StreamOptions, StreamResult, ZodUnknownSchema } from "../types/index.js";
|
|
2
|
+
import { OpenAIChatCompletionsProvider } from "./openaiChatCompletionsBase.js";
|
|
4
3
|
/**
|
|
5
4
|
* OpenAI Compatible Provider — direct HTTP, no AI SDK.
|
|
6
5
|
*
|
|
7
6
|
* Talks to any OpenAI chat-completions-shaped endpoint (LiteLLM, vLLM,
|
|
8
|
-
* OpenRouter, etc.).
|
|
9
|
-
*
|
|
7
|
+
* OpenRouter, etc.). All request/stream/tool-loop orchestration lives in
|
|
8
|
+
* `OpenAIChatCompletionsProvider`. This class just declares config and
|
|
9
|
+
* provider-specific error mapping.
|
|
10
10
|
*/
|
|
11
|
-
export declare class OpenAICompatibleProvider extends
|
|
12
|
-
private config;
|
|
13
|
-
private resolvedModel?;
|
|
14
|
-
private discoveredModel?;
|
|
11
|
+
export declare class OpenAICompatibleProvider extends OpenAIChatCompletionsProvider {
|
|
15
12
|
constructor(modelName?: string, sdk?: unknown, _region?: string, credentials?: {
|
|
16
13
|
apiKey?: string;
|
|
17
14
|
baseURL?: string;
|
|
18
15
|
});
|
|
19
16
|
protected getProviderName(): AIProviderName;
|
|
20
17
|
protected getDefaultModel(): string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* still goes through `generateText`. Returns a thin LanguageModelV3-shaped
|
|
24
|
-
* object that delegates to the same HTTP helpers used by executeStream.
|
|
25
|
-
* Stays inside this file so no AI-SDK-named import is needed here.
|
|
26
|
-
*/
|
|
27
|
-
protected getAISDKModel(): Promise<LanguageModel>;
|
|
28
|
-
private resolveModelName;
|
|
29
|
-
/**
|
|
30
|
-
* Returns a minimal V3-shaped model. Only used by BaseProvider's
|
|
31
|
-
* `generate()` non-streaming path which still relies on the parent's
|
|
32
|
-
* `generateText`. The streaming path bypasses this entirely.
|
|
33
|
-
*/
|
|
34
|
-
private buildDelegatingModel;
|
|
18
|
+
protected getFallbackModelName(): string;
|
|
19
|
+
protected getFallbackModels(): string[];
|
|
35
20
|
protected formatProviderError(error: unknown): Error;
|
|
36
|
-
supportsTools(): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Streaming path — drives the OpenAI endpoint directly. No streamText,
|
|
39
|
-
* no AI SDK orchestrator. Tool calls, multi-step loops, telemetry,
|
|
40
|
-
* abort handling all inline.
|
|
41
|
-
*/
|
|
42
|
-
protected executeStream(options: StreamOptions, _analysisSchema?: ZodUnknownSchema | Schema<unknown>): Promise<StreamResult>;
|
|
43
|
-
/**
|
|
44
|
-
* Multi-step streaming orchestrator. One iteration per model turn:
|
|
45
|
-
*
|
|
46
|
-
* 1. POST /chat/completions with stream:true
|
|
47
|
-
* 2. Parse SSE; push text deltas to the consumer queue
|
|
48
|
-
* 3. If the step emitted tool_calls → execute each, append to
|
|
49
|
-
* conversation, loop again
|
|
50
|
-
* 4. Otherwise resolve the deferred analytics promises and exit
|
|
51
|
-
*
|
|
52
|
-
* Bounded by `args.maxSteps`. Any thrown error rejects loopPromise and
|
|
53
|
-
* is surfaced to the consumer via `await loopPromise` in the stream
|
|
54
|
-
* generator.
|
|
55
|
-
*/
|
|
56
|
-
private runStreamLoop;
|
|
57
|
-
/**
|
|
58
|
-
* One streaming round-trip: POST chat-completions, parse SSE, push text
|
|
59
|
-
* deltas to the consumer queue. Returns the accumulated SSE result so
|
|
60
|
-
* the caller can decide whether to run tools and re-stream.
|
|
61
|
-
*/
|
|
62
|
-
private streamOneStep;
|
|
63
|
-
/**
|
|
64
|
-
* Execute every tool_call collected from one streaming step:
|
|
65
|
-
*
|
|
66
|
-
* - append an `assistant` turn carrying the tool_calls
|
|
67
|
-
* - resolve each tool from the local registry and run it
|
|
68
|
-
* - emit tool:start/tool:end events
|
|
69
|
-
* - push per-execution summaries
|
|
70
|
-
* - append a `tool` turn per result so the next step can see them
|
|
71
|
-
* - mirror BaseProvider's tool-events + storage hooks
|
|
72
|
-
*/
|
|
73
|
-
private executeToolBatch;
|
|
74
|
-
getAvailableModels(): Promise<string[]>;
|
|
75
|
-
getFirstAvailableModel(): Promise<string>;
|
|
76
|
-
private getFallbackModels;
|
|
77
21
|
}
|