@infersec/conduit 1.67.0 → 1.69.0

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,12 +1,11 @@
1
- import { LLMEngine, ULID } from "@infersec/definitions";
2
1
  import { z } from "zod";
2
+ import { ULID } from "@infersec/definitions";
3
3
  declare const StartModeSchema: z.ZodEnum<{
4
4
  idle: "idle";
5
5
  auto: "auto";
6
6
  }>;
7
7
  export type StartMode = z.infer<typeof StartModeSchema>;
8
8
  export interface Configuration {
9
- agentEngineType: LLMEngine;
10
9
  apiKey: string;
11
10
  apiURL: string;
12
11
  enginePort: number;
@@ -16,7 +15,6 @@ export interface Configuration {
16
15
  startMode: StartMode;
17
16
  }
18
17
  export interface ConfigurationOverrides {
19
- agentEngineType?: string;
20
18
  apiKey?: string;
21
19
  apiURL?: string;
22
20
  enginePort?: number;
@@ -27,5 +25,5 @@ export interface ConfigurationOverrides {
27
25
  }
28
26
  export declare function getConfiguration({ overrides }?: {
29
27
  overrides?: ConfigurationOverrides;
30
- }): Configuration;
28
+ }): Promise<Configuration>;
31
29
  export {};
@@ -1,4 +1,4 @@
1
- import { LLMEngine, LLMModel } from "@infersec/definitions";
1
+ import { LLMModel } from "@infersec/definitions";
2
2
  import { Logger } from "@infersec/logger";
3
3
  import EventEmitter from "eventemitter3";
4
4
  import { Response } from "undici";
@@ -11,10 +11,10 @@ interface ModelManagerEvents {
11
11
  }
12
12
  type EngineLifecycleState = "errored" | "running" | "starting" | "stopped" | "stopping";
13
13
  export declare class ModelManager extends EventEmitter<ModelManagerEvents> {
14
- readonly engine: LLMEngine;
14
+ readonly engine: string;
15
+ readonly engineConfig: Record<string, unknown> | null;
15
16
  readonly enginePort: number;
16
17
  readonly model: LLMModel;
17
- readonly parallelism: number | null;
18
18
  private uniqueName;
19
19
  readonly contextLength: number | null;
20
20
  protected readonly logger: Logger;
@@ -23,13 +23,13 @@ export declare class ModelManager extends EventEmitter<ModelManagerEvents> {
23
23
  private lifecycleState;
24
24
  private stopRequested;
25
25
  protected readonly modelsDirectory: string;
26
- constructor({ contextLength, engine, enginePort, logger, model, parallelism, root }: {
26
+ constructor({ contextLength, engineConfig, enginePort, engineType, logger, model, root }: {
27
27
  contextLength?: number | null;
28
- engine: LLMEngine;
28
+ engineConfig?: Record<string, unknown> | null;
29
29
  enginePort: number;
30
+ engineType: string;
30
31
  logger: Logger;
31
32
  model: LLMModel;
32
- parallelism?: number | null;
33
33
  root: string;
34
34
  });
35
35
  fetchOpenAI(path: string, opts?: RequestInit): Promise<Response>;
@@ -1,12 +1,13 @@
1
- import { API_CLIENT_CONDUIT_ANTHROPIC_REFERENCE } from "@infersec/definitions";
1
+ import { API_CLIENT_CONDUIT_ANTHROPIC_REFERENCE, type InferenceAgentConfiguration } from "@infersec/definitions";
2
2
  import { implementAPIReference, type APIRequest } from "@infersec/fetch";
3
3
  import { Logger } from "@infersec/logger";
4
4
  import { APIClient } from "../apiClient/index.js";
5
5
  import { Configuration } from "../configuration.js";
6
6
  import { ModelManager } from "../modelManagement/ModelManager.js";
7
7
  type ConduitAnthropicAPIReferenceHandlers = Parameters<typeof implementAPIReference<typeof API_CLIENT_CONDUIT_ANTHROPIC_REFERENCE>>[0]["api"];
8
- export declare function createConduitAnthropicAPIReferenceHandlers({ apiClient, configuration, getModelID, getModelManager, logger }: {
8
+ export declare function createConduitAnthropicAPIReferenceHandlers({ apiClient, conduitConfiguration, configuration, getModelID, getModelManager, logger }: {
9
9
  apiClient: APIClient;
10
+ conduitConfiguration: () => InferenceAgentConfiguration;
10
11
  configuration: Configuration;
11
12
  getModelID: () => string;
12
13
  getModelManager: () => ModelManager;
@@ -14,6 +15,7 @@ export declare function createConduitAnthropicAPIReferenceHandlers({ apiClient,
14
15
  }): ConduitAnthropicAPIReferenceHandlers;
15
16
  export declare function createPostMessagesHandler(options: {
16
17
  apiClient: APIClient;
18
+ conduitConfiguration: () => InferenceAgentConfiguration;
17
19
  configuration: Configuration;
18
20
  getModelID: () => string;
19
21
  getModelManager: () => ModelManager;
@@ -1,12 +1,13 @@
1
- import { API_CLIENT_CONDUIT_OPENAI_REFERENCE } from "@infersec/definitions";
1
+ import { API_CLIENT_CONDUIT_OPENAI_REFERENCE, type InferenceAgentConfiguration } from "@infersec/definitions";
2
2
  import { implementAPIReference, type APIRequest } from "@infersec/fetch";
3
3
  import { Logger } from "@infersec/logger";
4
4
  import { APIClient } from "../apiClient/index.js";
5
5
  import { Configuration } from "../configuration.js";
6
6
  import { ModelManager } from "../modelManagement/ModelManager.js";
7
7
  type ConduitOpenAIAPIReferenceHandlers = Parameters<typeof implementAPIReference<typeof API_CLIENT_CONDUIT_OPENAI_REFERENCE>>[0]["api"];
8
- export declare function createConduitOpenAIAPIReferenceHandlers({ apiClient, configuration, getModelID, getModelManager, logger, startup }: {
8
+ export declare function createConduitOpenAIAPIReferenceHandlers({ apiClient, conduitConfiguration, configuration, getModelID, getModelManager, logger, startup }: {
9
9
  apiClient: APIClient;
10
+ conduitConfiguration: () => InferenceAgentConfiguration;
10
11
  configuration: Configuration;
11
12
  getModelID: () => string;
12
13
  getModelManager: () => ModelManager;
@@ -15,6 +16,7 @@ export declare function createConduitOpenAIAPIReferenceHandlers({ apiClient, con
15
16
  }): ConduitOpenAIAPIReferenceHandlers;
16
17
  export declare function createGetModelsHandler(options: {
17
18
  apiClient: APIClient;
19
+ conduitConfiguration: () => InferenceAgentConfiguration;
18
20
  configuration: Configuration;
19
21
  getModelID: () => string;
20
22
  getModelManager: () => ModelManager;
@@ -60,6 +62,7 @@ export declare function createGetModelsHandler(options: {
60
62
  }>;
61
63
  export declare function createPostChatCompletionsHandler(options: {
62
64
  apiClient: APIClient;
65
+ conduitConfiguration: () => InferenceAgentConfiguration;
63
66
  configuration: Configuration;
64
67
  getModelID: () => string;
65
68
  getModelManager: () => ModelManager;
@@ -166,6 +169,7 @@ export declare function createPostChatCompletionsHandler(options: {
166
169
  }>;
167
170
  export declare function createPostCompletionsHandler(options: {
168
171
  apiClient: APIClient;
172
+ conduitConfiguration: () => InferenceAgentConfiguration;
169
173
  configuration: Configuration;
170
174
  getModelID: () => string;
171
175
  getModelManager: () => ModelManager;
@@ -1,8 +1,9 @@
1
- import { InferenceAgentLLMMetricsPayload, type ULID, type APIResponse, type ServerToClientAPIRequest } from "@infersec/definitions";
1
+ import { InferenceAgentConfiguration, InferenceAgentLLMMetricsPayload, type ULID, type APIResponse, type ServerToClientAPIRequest } from "@infersec/definitions";
2
2
  import { Logger } from "@infersec/logger";
3
3
  import { Configuration } from "../configuration.js";
4
- export declare function handleSSERequests({ apiURL, configuration, logger, modelID, onRequest, onRequestEnd, onRequestStart, reportMetrics, signal }: {
4
+ export declare function handleSSERequests({ apiURL, conduitConfiguration, configuration, logger, modelID, onRequest, onRequestEnd, onRequestStart, reportMetrics, signal }: {
5
5
  apiURL: string;
6
+ conduitConfiguration: () => InferenceAgentConfiguration;
6
7
  configuration: Configuration;
7
8
  logger: Logger;
8
9
  modelID: ULID;
@@ -1,10 +1,11 @@
1
1
  import { Readable } from "node:stream";
2
- import { InferenceAgentLLMMetricsPayload, type ULID } from "@infersec/definitions";
2
+ import { InferenceAgentConfiguration, InferenceAgentLLMMetricsPayload, type ULID } from "@infersec/definitions";
3
3
  import { Logger } from "@infersec/logger";
4
4
  import { Configuration } from "../configuration.js";
5
5
  import { ModelManager } from "../modelManagement/ModelManager.js";
6
- export declare function proxyAnthropicStreamingRoute({ body, configuration, endpointId, logger, modelID, modelManager, reportMetrics, signal }: {
6
+ export declare function proxyAnthropicStreamingRoute({ body, conduitConfiguration, endpointId, logger, modelID, modelManager, reportMetrics, signal }: {
7
7
  body: unknown;
8
+ conduitConfiguration: InferenceAgentConfiguration;
8
9
  configuration: Configuration;
9
10
  endpointId?: ULID | null;
10
11
  logger: Logger;
@@ -1,5 +1,4 @@
1
1
  import { Readable } from "node:stream";
2
- import { LLMEngine } from "@infersec/definitions";
3
2
  import { Logger } from "@infersec/logger";
4
3
  export interface EngineUsageMetrics {
5
4
  completionTokens: number | null;
@@ -8,7 +7,7 @@ export interface EngineUsageMetrics {
8
7
  totalTokens: number | null;
9
8
  }
10
9
  interface EngineMetricsLoggerOptions {
11
- agentEngineType: LLMEngine;
10
+ agentEngineType: string;
12
11
  logger: Logger;
13
12
  requestBodyBytes: number;
14
13
  requestPath: string;
@@ -24,9 +23,9 @@ interface EngineMetricsCompletion {
24
23
  interface MonitorEngineResponseOptions extends EngineMetricsLoggerOptions {
25
24
  body: Readable;
26
25
  contextLength: number | null;
27
- engine: LLMEngine;
26
+ engineConfig: Record<string, unknown> | null;
27
+ engineType: string;
28
28
  onComplete?: (result: EngineMetricsCompletion) => void | Promise<void>;
29
- parallelism: number | null;
30
29
  requestStartedAt?: number;
31
30
  }
32
31
  interface EngineMetricsLogOptions extends EngineMetricsLoggerOptions {
@@ -38,7 +37,7 @@ interface EngineMetricsLogOptions extends EngineMetricsLoggerOptions {
38
37
  interface MonitorEngineResponseResult {
39
38
  stream: Readable;
40
39
  }
41
- export declare function monitorEngineResponseStream({ agentEngineType, body, contextLength, engine, logger, onComplete, parallelism, requestBodyBytes, requestPath, requestStartedAt }: MonitorEngineResponseOptions): MonitorEngineResponseResult;
42
- export declare function monitorEngineResponseSingle({ agentEngineType, body, contextLength, engine, logger, onComplete, parallelism, requestBodyBytes, requestPath, requestStartedAt }: MonitorEngineResponseOptions): MonitorEngineResponseResult;
40
+ export declare function monitorEngineResponseStream({ agentEngineType, body, contextLength, engineConfig, engineType, logger, onComplete, requestBodyBytes, requestPath, requestStartedAt }: MonitorEngineResponseOptions): MonitorEngineResponseResult;
41
+ export declare function monitorEngineResponseSingle({ agentEngineType, body, contextLength, engineConfig, engineType, logger, onComplete, requestBodyBytes, requestPath, requestStartedAt }: MonitorEngineResponseOptions): MonitorEngineResponseResult;
43
42
  export declare function logEngineMetrics({ agentEngineType, error, level, logger, requestBodyBytes, requestPath, responseBytes, usage }: EngineMetricsLogOptions): void;
44
43
  export {};
@@ -1,10 +1,11 @@
1
1
  import { Readable } from "node:stream";
2
- import { InferenceAgentLLMMetricsPayload, type ULID } from "@infersec/definitions";
2
+ import { InferenceAgentConfiguration, InferenceAgentLLMMetricsPayload, type ULID } from "@infersec/definitions";
3
3
  import { Logger } from "@infersec/logger";
4
4
  import { Configuration } from "../configuration.js";
5
5
  import { ModelManager } from "../modelManagement/ModelManager.js";
6
- export declare function proxyOpenAIStreamingRoute({ body, configuration, endpointId, logger, modelID, modelManager, path, reportMetrics, signal }: {
6
+ export declare function proxyOpenAIStreamingRoute({ body, conduitConfiguration, endpointId, logger, modelID, modelManager, path, reportMetrics, signal }: {
7
7
  body: unknown;
8
+ conduitConfiguration: InferenceAgentConfiguration;
8
9
  configuration: Configuration;
9
10
  endpointId?: ULID | null;
10
11
  logger: Logger;
@@ -0,0 +1 @@
1
+ export declare function allocatePort(startFrom: number, maxTries?: number): Promise<number>;
@@ -0,0 +1 @@
1
+ export declare function stripImagesFromBody(body: unknown): unknown;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@infersec/conduit",
3
3
  "description": "End user conduit agent for connecting local LLMs to the cloud.",
4
- "version": "1.67.0",
4
+ "version": "1.69.0",
5
5
  "bin": {
6
6
  "infersec-conduit": "./dist/cli.js"
7
7
  },