@juspay/neurolink 9.67.1 → 9.67.2

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.
@@ -1,15 +1,15 @@
1
- import type { ZodType } from "zod";
2
1
  import type { AIProviderName } from "../constants/enums.js";
3
2
  import { BaseProvider } from "../core/baseProvider.js";
4
- import type { StreamOptions, StreamResult } from "../types/index.js";
5
- import type { LanguageModel, Schema } from "../types/index.js";
3
+ import type { LanguageModel, Schema, StreamOptions, StreamResult, ZodUnknownSchema } from "../types/index.js";
6
4
  /**
7
- * LiteLLM Provider - BaseProvider Implementation
8
- * Provides access to 100+ models via LiteLLM proxy server
5
+ * LiteLLM Provider direct HTTP, no AI SDK. Talks to a LiteLLM proxy
6
+ * server (or any deployment that speaks OpenAI chat-completions + the
7
+ * `/v1/models` and `/v1/embeddings` endpoints).
9
8
  */
10
9
  export declare class LiteLLMProvider extends BaseProvider {
11
- private model;
10
+ private config;
12
11
  private credentials?;
12
+ private resolvedModel?;
13
13
  private static modelsCache;
14
14
  private static modelsCacheTime;
15
15
  private static readonly MODELS_CACHE_DURATION;
@@ -20,38 +20,45 @@ export declare class LiteLLMProvider extends BaseProvider {
20
20
  protected getProviderName(): AIProviderName;
21
21
  protected getDefaultModel(): string;
22
22
  /**
23
- * Returns the Vercel AI SDK model instance for LiteLLM
23
+ * Abstract from BaseProvider used by the parent's generate() path which
24
+ * still goes through `generateText`. Returns a thin LanguageModelV3-shaped
25
+ * object that delegates to the same HTTP helpers used by executeStream.
24
26
  */
25
- protected getAISDKModel(): LanguageModel;
26
- formatProviderError(error: unknown): Error;
27
+ protected getAISDKModel(): Promise<LanguageModel>;
28
+ private resolveModelName;
27
29
  /**
28
- * LiteLLM supports tools for compatible models
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.
29
33
  */
34
+ private buildDelegatingModel;
35
+ formatProviderError(error: unknown): Error;
30
36
  supportsTools(): boolean;
31
37
  /**
32
- * Provider-specific streaming implementation
33
- * Note: This is only used when tools are disabled
38
+ * Streaming path — drives the LiteLLM proxy directly. No streamText, no
39
+ * AI SDK orchestrator. Tool calls, multi-step loops, telemetry, abort
40
+ * handling all inline. OTel span captures gen_ai.system + cost.
34
41
  */
35
- protected executeStream(options: StreamOptions, analysisSchema?: ZodType | Schema<unknown>): Promise<StreamResult>;
36
- private createLiteLLMTransformedStream;
42
+ protected executeStream(options: StreamOptions, _analysisSchema?: ZodUnknownSchema | Schema<unknown>): Promise<StreamResult>;
43
+ private runStreamLoop;
44
+ private streamOneStep;
45
+ private executeToolBatch;
37
46
  /**
38
- * Generate an embedding for a single text input
39
- * Uses the LiteLLM proxy with OpenAI-compatible embedding API
47
+ * Generate an embedding for a single text input via native /v1/embeddings.
40
48
  */
41
49
  embed(text: string, modelName?: string): Promise<number[]>;
42
50
  /**
43
- * Generate embeddings for multiple text inputs
44
- * Uses the LiteLLM proxy with OpenAI-compatible embedding API
51
+ * Generate embeddings for multiple text inputs via native /v1/embeddings.
45
52
  */
46
53
  embedMany(texts: string[], modelName?: string): Promise<number[][]>;
54
+ private callEmbeddings;
47
55
  /**
48
- * Get available models from LiteLLM proxy server
49
- * Dynamically fetches from /v1/models endpoint with caching and fallback
56
+ * Get available models from LiteLLM proxy `/v1/models` endpoint.
57
+ * Caches results for 10 minutes; falls back to env-driven list or a
58
+ * minimal safe default if the API fetch fails.
50
59
  */
51
60
  getAvailableModels(): Promise<string[]>;
52
- /**
53
- * Fetch available models from LiteLLM proxy /v1/models endpoint
54
- * @private
55
- */
61
+ getFirstAvailableModel(): Promise<string>;
62
+ private getFallbackModels;
56
63
  private fetchModelsFromAPI;
57
64
  }