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

40 lines (39 loc) • 2 kB
/** * Artifact store factory — picks a backend the way conversation memory does. * * Backend: `artifacts.store` → `artifacts.storage` → `STORAGE_TYPE` → local * Connection: `artifacts.redisConfig` → conversation memory's `redisConfig` * → `REDIS_URL` / `REDIS_HOST` … environment variables * * So `STORAGE_TYPE=redis`, which already moves sessions to Redis, moves * artifacts there too, on the same pooled connection, with nothing new to * set. The one thing never inherited is the KEY PREFIX: artifacts get their * own (`neurolink:artifact:`) even when the connection came from the * conversation config or `REDIS_KEY_PREFIX`. * * @module artifacts/artifactStoreFactory */ import type { ArtifactStorageConfig, ArtifactStorageType, ArtifactStore, RedisStorageConfig } from "../types/index.js"; /** * The Redis connection described by the environment — the same variables * conversation memory reads, minus `REDIS_KEY_PREFIX`, which names the * conversation keyspace and must not name this one. */ export declare function readArtifactRedisConfigFromEnv(): RedisStorageConfig; /** Which backend `config` and the environment select. */ export declare function resolveArtifactStorageType(config?: ArtifactStorageConfig): ArtifactStorageType; /** * The Redis connection an artifact store should use, with its own key prefix. * * @param config `artifacts` constructor config * @param fallback conversation memory's `redisConfig`, when one was given */ export declare function resolveArtifactRedisConfig(config?: ArtifactStorageConfig, fallback?: RedisStorageConfig): RedisStorageConfig; /** * Build the artifact store `config` asks for. * * @param config `artifacts` constructor config * @param fallbackRedis conversation memory's `redisConfig`, consulted for the * connection when `config.redisConfig` is absent */ export declare function createArtifactStore(config?: ArtifactStorageConfig, fallbackRedis?: RedisStorageConfig): ArtifactStore;