UNPKG

@juspay/neurolink

Version:

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

59 lines (58 loc) • 2.48 kB
import type { AIProviderName } from "../constants/enums.js"; import { BaseProvider } from "../core/baseProvider.js"; import type { EmbedInput, NeurolinkCredentials, StreamOptions, StreamResult, ValidationSchema } from "../types/index.js"; import type { LanguageModel } from "../types/index.js"; /** * Jina AI Provider — embeddings + reranking. * * Native API at api.jina.ai/v1. Chat / streaming / tool calling are not * supported. Use `embed()` / `embedMany()` for embeddings, or call * `rerank()` directly for retrieval reranking (Jina's strength). * * @see https://jina.ai/embeddings/ */ export declare class JinaProvider extends BaseProvider { private readonly apiKey; private readonly baseURL; private readonly proxyFetch; constructor(modelName?: string, sdk?: unknown, _region?: string, credentials?: NeurolinkCredentials["jina"]); protected getProviderName(): AIProviderName; protected getDefaultModel(): string; supportsTools(): boolean; protected getDefaultEmbeddingModel(): string | undefined; protected getAISDKModel(): LanguageModel; protected executeStream(_options: StreamOptions, _analysisSchema?: ValidationSchema): Promise<StreamResult>; protected formatProviderError(error: unknown): Error; embed(input: string | EmbedInput, modelName?: string): Promise<number[]>; embedMany(texts: string[], modelName?: string): Promise<number[][]>; /** * Rerank a list of documents against a query. * * Returns the documents sorted by relevance (highest first), with * score and original index preserved so callers can map back. * * Note: not exposed on `BaseProvider` — accessed by casting to * `JinaProvider` or via the dedicated rerank route on the public API * (`POST /api/agent/rerank` in the server module, when added). * * Per-call credentials can be supplied via `options.credentials?.jina`, * overriding the instance-level credentials for this request only. */ rerank(query: string, documents: string[], options?: { model?: string; topN?: number; credentials?: NeurolinkCredentials["jina"]; }): Promise<{ index: number; score: number; document: string; }[]>; private callEmbeddings; validateConfiguration(): Promise<boolean>; getConfiguration(): { provider: AIProviderName; model: string; defaultModel: string; baseURL: string; }; }