@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
28 lines (27 loc) • 1.85 kB
TypeScript
/**
* Shared Gemini adapter onto the agentic loop engine.
*
* Lives in `core/` rather than inside either provider's folder because two
* providers use it: Google AI Studio (Task 9) and Vertex Gemini (Task 10).
* Both issue the same wire call — `models.generateContentStream` — and consume
* the same response shape, so one `executeStep` serves four hand-rolled loops
* (each provider has a streaming one and a near-duplicate inside `generate()`).
*
* Function-name sanitization stays entirely on this side of the engine
* boundary, which is the design decision Task 7 recorded rather than a
* shortcut. Google requires function names to match a restricted pattern, so
* declarations are built with sanitized names and the model calls back with
* those same sanitized names. The engine only ever sees plain string names, so
* this adapter translates sanitized -> original before returning `toolCalls`,
* and original -> sanitized when writing `functionResponse` parts. Neither the
* engine nor any other adapter needs to know sanitization happened.
*/
import type { AgenticLoopAdapter, GeminiLoopAdapterConfig, GeminiStepRaw, GeminiStepRequest, GeminiTurnContent, GenerationRecord } from "../types/index.js";
/**
* @description Describes one Gemini request as the request half of a Langfuse generation.
* @param provider {string} - Provider name used to price the call.
* @param request {GeminiStepRequest} - Model, contents and generation config sent.
* @returns {GenerationRecord} Provider, model, sampling and thinking parameters, and the system instruction plus contents.
*/
export declare function describeGeminiRequest(provider: string, request: GeminiStepRequest): GenerationRecord;
export declare function createGeminiLoopAdapter(config: GeminiLoopAdapterConfig): AgenticLoopAdapter<GeminiTurnContent[], GeminiStepRaw>;