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

55 lines (54 loc) • 2.38 kB
import type { AIProviderName } from "../constants/enums.js"; import type { EmbedInput, NeurolinkCredentials } from "../types/index.js"; import { OpenAIChatCompletionsProvider } from "./openaiChatCompletionsBase.js"; /** * Cohere Provider — direct HTTP, no AI SDK. * * Routes Command R / Command R+ chat completions through Cohere's * OpenAI-compatible endpoint at /compatibility/v1. All request/stream/ * tool-loop orchestration lives in `OpenAIChatCompletionsProvider`; this * class only declares configuration and provider-specific error mapping. * * Embed v3 is exposed via `embed()` / `embedMany()` backed by a native * POST to /v2/embed (the compatibility path is chat-only). * * @see https://docs.cohere.com/docs/compatibility-api * @see https://docs.cohere.com/reference/embed */ export declare class CohereProvider extends OpenAIChatCompletionsProvider { constructor(modelName?: string, sdk?: unknown, _region?: string, credentials?: NeurolinkCredentials["cohere"]); protected getProviderName(): AIProviderName; protected getDefaultModel(): string; protected getFallbackModelName(): string; protected getFallbackModels(): string[]; protected formatProviderError(error: unknown): Error; validateConfiguration(): Promise<boolean>; getConfiguration(): { provider: AIProviderName; model: string; defaultModel: string; baseURL: string; }; /** * Default embedding model for Cohere. */ protected getDefaultEmbeddingModel(): string; /** * Generate an embedding for a single text via Cohere's native /v2/embed * endpoint. Returns the float[] embedding vector. * * The shared OpenAI-compatible /compatibility/v1 path is chat-only; embed * lives on the native API (POST /v2/embed). Documented at * https://docs.cohere.com/reference/embed. */ embed(input: string | EmbedInput, modelName?: string): Promise<number[]>; /** * Batch embedding via Cohere's native /v2/embed endpoint. Cohere caps at * 96 inputs per request; larger batches are chunked. * * Partial failures are not surfaced: if any chunk request fails the whole * call rejects and already-embedded chunks are discarded — callers should * retry the full input. */ embedMany(texts: string[], modelName?: string): Promise<number[][]>; }