nexus-ai-pro 1.2.0 → 1.2.1
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.
- package/CHANGELOG.md +12 -0
- package/dist-cjs/agent/loop.d.ts +12 -0
- package/dist-cjs/agent/tool.d.ts +16 -0
- package/dist-cjs/cache/adapters.d.ts +42 -0
- package/dist-cjs/cache/memory-cache.d.ts +20 -0
- package/dist-cjs/cache/semantic-cache.d.ts +19 -0
- package/dist-cjs/connectors/web.d.ts +20 -0
- package/dist-cjs/context/index.d.ts +2 -0
- package/dist-cjs/context/window.d.ts +34 -0
- package/dist-cjs/core/config-builder.d.ts +97 -0
- package/dist-cjs/core/create-nexus.d.ts +33 -0
- package/dist-cjs/core/nexus.d.ts +222 -0
- package/dist-cjs/core/response-format.d.ts +8 -0
- package/dist-cjs/core/secure-stream.d.ts +3 -0
- package/dist-cjs/core/streaming.d.ts +4 -0
- package/dist-cjs/embeddings/providers.d.ts +20 -0
- package/dist-cjs/evals/index.d.ts +3 -0
- package/dist-cjs/evals/judge.d.ts +50 -0
- package/dist-cjs/evals/metrics.d.ts +75 -0
- package/dist-cjs/evals/runner.d.ts +47 -0
- package/dist-cjs/hallucination/consistency.d.ts +15 -0
- package/dist-cjs/hallucination/factual.d.ts +14 -0
- package/dist-cjs/hallucination/knowledge-graph.d.ts +31 -0
- package/dist-cjs/hallucination/rag.d.ts +21 -0
- package/dist-cjs/hallucination/retrieval.d.ts +24 -0
- package/dist-cjs/hallucination/verification.d.ts +36 -0
- package/dist-cjs/images/assets.d.ts +115 -0
- package/dist-cjs/images/errors.d.ts +35 -0
- package/dist-cjs/images/index.d.ts +4 -0
- package/dist-cjs/images/manager.d.ts +23 -0
- package/dist-cjs/images/mock.d.ts +17 -0
- package/dist-cjs/images/openai.d.ts +46 -0
- package/dist-cjs/index.d.ts +80 -0
- package/dist-cjs/jobs/batch.d.ts +11 -0
- package/dist-cjs/jobs/durable-adapters.d.ts +48 -0
- package/dist-cjs/jobs/queue.d.ts +24 -0
- package/dist-cjs/models/registry.d.ts +15 -0
- package/dist-cjs/next/route-handler.d.ts +6 -0
- package/dist-cjs/ops/audit-logger.d.ts +6 -0
- package/dist-cjs/ops/health.d.ts +29 -0
- package/dist-cjs/ops/metrics.d.ts +53 -0
- package/dist-cjs/ops/otel-tracing.d.ts +20 -0
- package/dist-cjs/ops/rate-limiter.d.ts +11 -0
- package/dist-cjs/optimizer/budget.d.ts +19 -0
- package/dist-cjs/optimizer/cost.d.ts +13 -0
- package/dist-cjs/optimizer/densifier.d.ts +10 -0
- package/dist-cjs/optimizer/index.d.ts +12 -0
- package/dist-cjs/pipeline/pipeline.d.ts +14 -0
- package/dist-cjs/pipeline/types.d.ts +48 -0
- package/dist-cjs/providers/anthropic.d.ts +20 -0
- package/dist-cjs/providers/azure-openai.d.ts +8 -0
- package/dist-cjs/providers/base.d.ts +23 -0
- package/dist-cjs/providers/cohere.d.ts +16 -0
- package/dist-cjs/providers/deepseek.d.ts +8 -0
- package/dist-cjs/providers/errors.d.ts +26 -0
- package/dist-cjs/providers/google.d.ts +22 -0
- package/dist-cjs/providers/groq.d.ts +15 -0
- package/dist-cjs/providers/llamacpp.d.ts +8 -0
- package/dist-cjs/providers/lmstudio.d.ts +8 -0
- package/dist-cjs/providers/mistral.d.ts +15 -0
- package/dist-cjs/providers/ollama.d.ts +16 -0
- package/dist-cjs/providers/openai.d.ts +33 -0
- package/dist-cjs/providers/openrouter.d.ts +14 -0
- package/dist-cjs/providers/type-guards.d.ts +8 -0
- package/dist-cjs/rag/file-ingestion.d.ts +20 -0
- package/dist-cjs/rag/ingestion.d.ts +21 -0
- package/dist-cjs/realtime/conversation.d.ts +19 -0
- package/dist-cjs/realtime/errors.d.ts +25 -0
- package/dist-cjs/realtime/events.d.ts +10 -0
- package/dist-cjs/realtime/id.d.ts +2 -0
- package/dist-cjs/realtime/index.d.ts +22 -0
- package/dist-cjs/realtime/mock.transport.d.ts +55 -0
- package/dist-cjs/realtime/openai-events.d.ts +5 -0
- package/dist-cjs/realtime/openai-server.d.ts +33 -0
- package/dist-cjs/realtime/openai-webrtc.transport.d.ts +153 -0
- package/dist-cjs/realtime/openai-websocket.transport.d.ts +65 -0
- package/dist-cjs/realtime/provider.d.ts +37 -0
- package/dist-cjs/realtime/session.d.ts +110 -0
- package/dist-cjs/realtime/tools.d.ts +47 -0
- package/dist-cjs/realtime/transport-utils.d.ts +55 -0
- package/dist-cjs/realtime/types.d.ts +544 -0
- package/dist-cjs/router/auto-router.d.ts +17 -0
- package/dist-cjs/router/failover.d.ts +31 -0
- package/dist-cjs/router/index.d.ts +12 -0
- package/dist-cjs/router/rules-router.d.ts +7 -0
- package/dist-cjs/router/types.d.ts +19 -0
- package/dist-cjs/security/index.d.ts +32 -0
- package/dist-cjs/security/injection-calibration.d.ts +17 -0
- package/dist-cjs/security/injection-detector.d.ts +8 -0
- package/dist-cjs/security/input-guard.d.ts +7 -0
- package/dist-cjs/security/output-guard.d.ts +14 -0
- package/dist-cjs/security/pii-detector.d.ts +8 -0
- package/dist-cjs/security/policies.d.ts +4 -0
- package/dist-cjs/security/prompt-hardening.d.ts +6 -0
- package/dist-cjs/security/schema-validator.d.ts +234 -0
- package/dist-cjs/security/semantic-injection-classifier.d.ts +19 -0
- package/dist-cjs/security/upload-scanner.d.ts +29 -0
- package/dist-cjs/telephony/errors.d.ts +8 -0
- package/dist-cjs/telephony/index.d.ts +6 -0
- package/dist-cjs/telephony/manager.d.ts +23 -0
- package/dist-cjs/telephony/providers/twilio.d.ts +32 -0
- package/dist-cjs/telephony/realtime-bridge.d.ts +58 -0
- package/dist-cjs/telephony/twiml.d.ts +2 -0
- package/dist-cjs/testing/image-provider-conformance.d.ts +33 -0
- package/dist-cjs/testing/provider-conformance.d.ts +27 -0
- package/dist-cjs/types/agent.d.ts +34 -0
- package/dist-cjs/types/config.d.ts +248 -0
- package/dist-cjs/types/context-window.d.ts +55 -0
- package/dist-cjs/types/images.d.ts +245 -0
- package/dist-cjs/types/messages.d.ts +97 -0
- package/dist-cjs/types/optimizer.d.ts +30 -0
- package/dist-cjs/types/planning.d.ts +29 -0
- package/dist-cjs/types/providers.d.ts +39 -0
- package/dist-cjs/types/response.d.ts +57 -0
- package/dist-cjs/types/security.d.ts +87 -0
- package/dist-cjs/types/telephony.d.ts +258 -0
- package/dist-cjs/types/voice.d.ts +191 -0
- package/dist-cjs/utils/ids.d.ts +1 -0
- package/dist-cjs/utils/logger.d.ts +11 -0
- package/dist-cjs/utils/tokenizer.d.ts +6 -0
- package/dist-cjs/voice/errors.d.ts +8 -0
- package/dist-cjs/voice/index.d.ts +4 -0
- package/dist-cjs/voice/manager.d.ts +23 -0
- package/dist-cjs/voice/providers/openai.d.ts +29 -0
- package/dist-cjs/voice/session.d.ts +33 -0
- package/dist-cjs/workflow/chains.d.ts +53 -0
- package/dist-cjs/workflow/domain.d.ts +22 -0
- package/package.json +598 -165
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ Notable changes to this project are recorded here. The format follows [Keep a Ch
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [1.2.1] - 2026-08-10
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- TypeScript consumers of the CommonJS build no longer resolve ESM declarations. The CommonJS build
|
|
12
|
+
now emits its own `.d.ts` files, and each export subpath carries per-condition types, so `require()`
|
|
13
|
+
resolves CommonJS declarations instead of reporting TS1479 against the ESM ones.
|
|
14
|
+
- Subpath types are discoverable under `moduleResolution: "node10"`, which ignores `exports` and is
|
|
15
|
+
still the default for NestJS projects. A `typesVersions` map now points each subpath at its
|
|
16
|
+
CommonJS declarations, so `nexus-ai-pro/telephony` and friends type-check without a consumer having
|
|
17
|
+
to migrate its `tsconfig.json` to `node16`.
|
|
18
|
+
|
|
7
19
|
## [1.2.0] - 2026-08-10
|
|
8
20
|
|
|
9
21
|
### Added
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AgentConfig, AgentResult } from '../types/agent.js';
|
|
2
|
+
import type { CompletionRequest } from '../types/messages.js';
|
|
3
|
+
import type { NexusResponse } from '../types/response.js';
|
|
4
|
+
export interface AgentModelClient {
|
|
5
|
+
complete(request: CompletionRequest): Promise<NexusResponse>;
|
|
6
|
+
}
|
|
7
|
+
export declare class AgentLoop {
|
|
8
|
+
private client;
|
|
9
|
+
constructor(client: AgentModelClient);
|
|
10
|
+
run(config: AgentConfig): Promise<AgentResult>;
|
|
11
|
+
private parseToolArgs;
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ToolDefinition } from '../types/messages.js';
|
|
2
|
+
import type { ToolExecutionResult } from '../types/agent.js';
|
|
3
|
+
export declare function tool<TArgs extends Record<string, unknown> = Record<string, unknown>>(definition: {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: Record<string, unknown>;
|
|
7
|
+
execute: (args: TArgs) => Promise<unknown> | unknown;
|
|
8
|
+
}): ToolDefinition;
|
|
9
|
+
export declare class ToolExecutor {
|
|
10
|
+
private tools;
|
|
11
|
+
constructor(tools?: ToolDefinition[]);
|
|
12
|
+
register(toolDefinition: ToolDefinition): this;
|
|
13
|
+
has(name: string): boolean;
|
|
14
|
+
list(): ToolDefinition[];
|
|
15
|
+
execute(name: string, args: Record<string, unknown>): Promise<ToolExecutionResult>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface CacheAdapter<T = unknown> {
|
|
2
|
+
get(key: string): Promise<T | undefined> | T | undefined;
|
|
3
|
+
set(key: string, value: T, ttlSeconds?: number): Promise<void> | void;
|
|
4
|
+
delete?(key: string): Promise<boolean> | boolean;
|
|
5
|
+
clear?(): Promise<void> | void;
|
|
6
|
+
}
|
|
7
|
+
export declare class MemoryCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
8
|
+
private entries;
|
|
9
|
+
get(key: string): T | undefined;
|
|
10
|
+
set(key: string, value: T, ttlSeconds?: number): void;
|
|
11
|
+
delete(key: string): boolean;
|
|
12
|
+
clear(): void;
|
|
13
|
+
}
|
|
14
|
+
export interface RedisLikeClient {
|
|
15
|
+
get(key: string): Promise<string | null> | string | null;
|
|
16
|
+
set(key: string, value: string, mode?: string, ttlSeconds?: number): Promise<unknown> | unknown;
|
|
17
|
+
del?(key: string): Promise<number> | number;
|
|
18
|
+
}
|
|
19
|
+
export declare class RedisCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
20
|
+
private client;
|
|
21
|
+
private prefix;
|
|
22
|
+
constructor(client: RedisLikeClient, prefix?: string);
|
|
23
|
+
get(key: string): Promise<T | undefined>;
|
|
24
|
+
set(key: string, value: T, ttlSeconds?: number): Promise<void>;
|
|
25
|
+
delete(key: string): Promise<boolean>;
|
|
26
|
+
}
|
|
27
|
+
export interface SQLiteLikeDatabase {
|
|
28
|
+
prepare(sql: string): {
|
|
29
|
+
get?: (...args: unknown[]) => unknown;
|
|
30
|
+
run?: (...args: unknown[]) => unknown;
|
|
31
|
+
};
|
|
32
|
+
exec?(sql: string): unknown;
|
|
33
|
+
}
|
|
34
|
+
export declare class SQLiteCacheAdapter<T = unknown> implements CacheAdapter<T> {
|
|
35
|
+
private db;
|
|
36
|
+
private table;
|
|
37
|
+
constructor(db: SQLiteLikeDatabase, table?: string);
|
|
38
|
+
get(key: string): T | undefined;
|
|
39
|
+
set(key: string, value: T, ttlSeconds?: number): void;
|
|
40
|
+
delete(key: string): boolean;
|
|
41
|
+
clear(): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CacheEntry<T> {
|
|
2
|
+
value: T;
|
|
3
|
+
expiresAt: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class MemoryCache<T> {
|
|
6
|
+
private maxEntries;
|
|
7
|
+
private entries;
|
|
8
|
+
constructor(maxEntries?: number);
|
|
9
|
+
get(key: string): T | undefined;
|
|
10
|
+
set(key: string, value: T, ttlSeconds?: number): void;
|
|
11
|
+
clear(): void;
|
|
12
|
+
delete(key: string): boolean;
|
|
13
|
+
clearExpired(): number;
|
|
14
|
+
stats(): {
|
|
15
|
+
size: number;
|
|
16
|
+
maxEntries: number;
|
|
17
|
+
expiredEntries: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare function createCacheKey(value: unknown): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CompletionRequest } from '../types/messages.js';
|
|
2
|
+
import type { NexusResponse } from '../types/response.js';
|
|
3
|
+
import { type EmbeddingProvider } from '../hallucination/retrieval.js';
|
|
4
|
+
export interface SemanticCacheOptions {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
similarityThreshold?: number;
|
|
7
|
+
maxEntries?: number;
|
|
8
|
+
ttlSeconds?: number;
|
|
9
|
+
embed?: EmbeddingProvider;
|
|
10
|
+
}
|
|
11
|
+
export declare class SemanticCache {
|
|
12
|
+
private options;
|
|
13
|
+
private entries;
|
|
14
|
+
private embed;
|
|
15
|
+
constructor(options?: SemanticCacheOptions);
|
|
16
|
+
get(request: CompletionRequest): Promise<NexusResponse | undefined>;
|
|
17
|
+
set(key: string, request: CompletionRequest, response: NexusResponse): Promise<void>;
|
|
18
|
+
clear(): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ToolDefinition } from '../types/messages.js';
|
|
2
|
+
export type WebResolvedAddress = string | {
|
|
3
|
+
address: string;
|
|
4
|
+
family?: 4 | 6;
|
|
5
|
+
};
|
|
6
|
+
export interface WebConnectorOptions {
|
|
7
|
+
allowedDomains?: string[];
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
userAgent?: string;
|
|
10
|
+
maxResponseBytes?: number;
|
|
11
|
+
maxRedirects?: number;
|
|
12
|
+
/** Explicitly allow loopback/private targets, for example a trusted local development service. */
|
|
13
|
+
allowPrivateNetworks?: boolean;
|
|
14
|
+
/** Cloud metadata endpoints remain denied unless this separate high-risk opt-in is enabled. */
|
|
15
|
+
allowCloudMetadata?: boolean;
|
|
16
|
+
/** Optional resolver for split-horizon DNS or deterministic tests. Every returned address is validated. */
|
|
17
|
+
resolveHostname?: (hostname: string) => Promise<readonly WebResolvedAddress[]>;
|
|
18
|
+
}
|
|
19
|
+
export declare function createFetchUrlTool(options?: WebConnectorOptions): ToolDefinition;
|
|
20
|
+
export declare function createSearchTool(search: (query: string) => Promise<unknown>, name?: string): ToolDefinition;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { ContextWindowManager, type ContextWindowRuntime, } from './window.js';
|
|
2
|
+
export type { ContextSummaryConfig, ContextSummaryInput, ContextSummaryMode, ContextSummarizer, ContextWindowConfig, ContextWindowResult, ContextWindowStrategy, ContextWindowUsage, } from '../types/context-window.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CompletionRequest } from '../types/messages.js';
|
|
2
|
+
import type { ContextSummarizer, ContextWindowConfig, ContextWindowResult } from '../types/context-window.js';
|
|
3
|
+
export interface ContextWindowRuntime {
|
|
4
|
+
summarizer?: ContextSummarizer;
|
|
5
|
+
}
|
|
6
|
+
export declare class ContextWindowManager {
|
|
7
|
+
private config;
|
|
8
|
+
private tokenizer;
|
|
9
|
+
constructor(config?: ContextWindowConfig);
|
|
10
|
+
optimize(request: CompletionRequest, runtime?: ContextWindowRuntime): Promise<ContextWindowResult<CompletionRequest>>;
|
|
11
|
+
preview(request: CompletionRequest): ContextWindowResult<CompletionRequest>;
|
|
12
|
+
private optimizeInternal;
|
|
13
|
+
private optimizeInternalSync;
|
|
14
|
+
private resultFromSelection;
|
|
15
|
+
private selectMessages;
|
|
16
|
+
private selectByCount;
|
|
17
|
+
private selectByTokens;
|
|
18
|
+
private createSummary;
|
|
19
|
+
private createLocalSummary;
|
|
20
|
+
private summaryInput;
|
|
21
|
+
private summaryMessage;
|
|
22
|
+
private splitMessages;
|
|
23
|
+
private effectiveStrategy;
|
|
24
|
+
private strategy;
|
|
25
|
+
private shouldSummarize;
|
|
26
|
+
private summaryEnabled;
|
|
27
|
+
private summaryMode;
|
|
28
|
+
private summaryConfig;
|
|
29
|
+
private identity;
|
|
30
|
+
private serializeMessages;
|
|
31
|
+
private messageText;
|
|
32
|
+
private partText;
|
|
33
|
+
}
|
|
34
|
+
export type { ContextSummaryConfig, ContextSummaryInput, ContextSummaryMode, ContextSummarizer, ContextWindowConfig, ContextWindowResult, ContextWindowStrategy, ContextWindowUsage, } from '../types/context-window.js';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { NexusAI } from './nexus.js';
|
|
2
|
+
import type { AnthropicProviderConfig, AuditLogConfig, AzureOpenAIProviderConfig, CacheConfig, CohereProviderConfig, CostBudgetConfig, CustomProviderConfig, DeepSeekProviderConfig, GoogleProviderConfig, GroqProviderConfig, LMStudioProviderConfig, LlamaCppProviderConfig, LoggerConfig, MistralProviderConfig, NexusAIConfig, OllamaProviderConfig, OpenAIProviderConfig, OpenRouterProviderConfig, ProvidersConfig, RateLimitConfig, ResponseFormatConfig, RetryConfig, RoutingConfig, RoutingStrategy } from '../types/config.js';
|
|
3
|
+
import type { ContextWindowConfig } from '../types/context-window.js';
|
|
4
|
+
import type { ImageConfig } from '../types/images.js';
|
|
5
|
+
import type { SecurityConfig, SecurityLevel } from '../types/security.js';
|
|
6
|
+
import type { TokenOptimizerConfig } from '../types/optimizer.js';
|
|
7
|
+
import type { PipelineConfig } from '../pipeline/types.js';
|
|
8
|
+
import type { MetricsConfig } from '../ops/metrics.js';
|
|
9
|
+
import type { HealthConfig } from '../ops/health.js';
|
|
10
|
+
/**
|
|
11
|
+
* Fluent, typed builder for `NexusAIConfig`.
|
|
12
|
+
*
|
|
13
|
+
* The builder is intentionally thin: every method maps directly to a normal config field, so advanced users
|
|
14
|
+
* can still call `build()` and edit the plain object before passing it to `new NexusAI(...)`.
|
|
15
|
+
*/
|
|
16
|
+
export declare class NexusConfigBuilder {
|
|
17
|
+
private config;
|
|
18
|
+
constructor(seed?: Partial<NexusAIConfig>);
|
|
19
|
+
/** Adds or replaces a provider config by its `ProvidersConfig` key. */
|
|
20
|
+
provider<Name extends keyof ProvidersConfig>(name: Name, config: NonNullable<ProvidersConfig[Name]>): this;
|
|
21
|
+
/** Adds OpenAI. */
|
|
22
|
+
openai(config: OpenAIProviderConfig | string): this;
|
|
23
|
+
/** Adds Anthropic. */
|
|
24
|
+
anthropic(config: AnthropicProviderConfig | string): this;
|
|
25
|
+
/** Adds Google Gemini. */
|
|
26
|
+
google(config: GoogleProviderConfig | string): this;
|
|
27
|
+
/** Adds a local Ollama server. */
|
|
28
|
+
ollama(config?: OllamaProviderConfig): this;
|
|
29
|
+
/** Adds Groq. */
|
|
30
|
+
groq(config: GroqProviderConfig | string): this;
|
|
31
|
+
/** Adds Mistral. */
|
|
32
|
+
mistral(config: MistralProviderConfig | string): this;
|
|
33
|
+
/** Adds Cohere. */
|
|
34
|
+
cohere(config: CohereProviderConfig | string): this;
|
|
35
|
+
/** Adds OpenRouter. */
|
|
36
|
+
openrouter(config: OpenRouterProviderConfig | string): this;
|
|
37
|
+
/** Adds DeepSeek. */
|
|
38
|
+
deepseek(config: DeepSeekProviderConfig | string): this;
|
|
39
|
+
/** Adds Azure OpenAI. */
|
|
40
|
+
azureOpenAI(config: AzureOpenAIProviderConfig): this;
|
|
41
|
+
/** Adds a local LM Studio OpenAI-compatible server. */
|
|
42
|
+
lmstudio(config?: LMStudioProviderConfig): this;
|
|
43
|
+
/** Adds a local llama.cpp OpenAI-compatible server. */
|
|
44
|
+
llamaCpp(config?: LlamaCppProviderConfig): this;
|
|
45
|
+
/** Adds a user-defined OpenAI- or Anthropic-compatible endpoint. */
|
|
46
|
+
custom(config: CustomProviderConfig): this;
|
|
47
|
+
/** Sets raw routing config. */
|
|
48
|
+
routing(config: RoutingConfig): this;
|
|
49
|
+
/** Uses direct routing through a single default model. */
|
|
50
|
+
direct(model: string): this;
|
|
51
|
+
/** Uses automatic routing with an optional strategy. */
|
|
52
|
+
auto(strategy?: RoutingStrategy): this;
|
|
53
|
+
/** Sets input/output security behavior. */
|
|
54
|
+
security(config: SecurityLevel | SecurityConfig): this;
|
|
55
|
+
/** Sets context-window compaction behavior. */
|
|
56
|
+
contextWindow(config: ContextWindowConfig): this;
|
|
57
|
+
/** Sets image-provider defaults and registrations. */
|
|
58
|
+
images(config: ImageConfig): this;
|
|
59
|
+
/** Sets token optimization behavior. */
|
|
60
|
+
tokenOptimizer(config: TokenOptimizerConfig): this;
|
|
61
|
+
/** Sets exact, semantic, or hybrid cache behavior. */
|
|
62
|
+
cache(config: CacheConfig): this;
|
|
63
|
+
/** Sets rate limiting behavior. */
|
|
64
|
+
rateLimit(config: RateLimitConfig): this;
|
|
65
|
+
/** Sets audit logging behavior. */
|
|
66
|
+
auditLog(config: AuditLogConfig): this;
|
|
67
|
+
/** Sets response-format defaults. */
|
|
68
|
+
responseFormat(config: ResponseFormatConfig): this;
|
|
69
|
+
/** Sets provider retry behavior. */
|
|
70
|
+
retry(config: RetryConfig): this;
|
|
71
|
+
/** Sets request cost-budget behavior. */
|
|
72
|
+
costBudget(config: CostBudgetConfig): this;
|
|
73
|
+
/** Sets pipeline hook and trace behavior. */
|
|
74
|
+
pipeline(config: PipelineConfig): this;
|
|
75
|
+
/** Sets metrics sink behavior. */
|
|
76
|
+
metrics(config: MetricsConfig): this;
|
|
77
|
+
/** Sets provider health scoring behavior. */
|
|
78
|
+
health(config: HealthConfig): this;
|
|
79
|
+
/** Sets structured logger behavior. */
|
|
80
|
+
logger(config: LoggerConfig): this;
|
|
81
|
+
/** Sets global provider timeout in milliseconds. */
|
|
82
|
+
timeout(ms: number): this;
|
|
83
|
+
/** Toggles debug logging. */
|
|
84
|
+
debug(enabled?: boolean): this;
|
|
85
|
+
/** Returns a plain `NexusAIConfig` object. */
|
|
86
|
+
build(): NexusAIConfig;
|
|
87
|
+
/** Creates a `NexusAI` instance from the current builder state. */
|
|
88
|
+
create(): NexusAI;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Starts a fluent `NexusAIConfig` builder.
|
|
92
|
+
*/
|
|
93
|
+
export declare function createNexusConfig(seed?: Partial<NexusAIConfig>): NexusConfigBuilder;
|
|
94
|
+
/**
|
|
95
|
+
* Identity helper for users who prefer object literals but want type inference and validation in editors.
|
|
96
|
+
*/
|
|
97
|
+
export declare function defineNexusConfig(config: NexusAIConfig): NexusAIConfig;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NexusAI } from './nexus.js';
|
|
2
|
+
import type { NexusAIConfig, ProvidersConfig } from '../types/config.js';
|
|
3
|
+
export type CreateNexusProvider = 'openai' | 'anthropic' | 'google' | 'ollama' | 'groq' | 'mistral' | 'cohere' | 'openrouter' | 'deepseek' | 'azureOpenAI' | 'lmstudio' | 'llamaCpp';
|
|
4
|
+
export interface CreateNexusOptions extends Omit<Partial<NexusAIConfig>, 'providers'> {
|
|
5
|
+
providers?: ProvidersConfig;
|
|
6
|
+
provider?: CreateNexusProvider;
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
endpoint?: string;
|
|
10
|
+
deployment?: string;
|
|
11
|
+
apiVersion?: string;
|
|
12
|
+
model?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates a `NexusAI` instance from either the full production config or a small beginner shorthand.
|
|
16
|
+
*
|
|
17
|
+
* Use the full `NexusAIConfig` when you need routing, retries, budgets, hooks, or multiple providers.
|
|
18
|
+
* Use the shorthand when you only want one provider and one model.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const ai = createNexus({
|
|
23
|
+
* provider: 'openai',
|
|
24
|
+
* apiKey: process.env.OPENAI_API_KEY!,
|
|
25
|
+
* model: 'gpt-5.4-mini',
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function createNexus(config?: NexusAIConfig | CreateNexusOptions): NexusAI;
|
|
30
|
+
/**
|
|
31
|
+
* Converts the beginner shorthand accepted by `createNexus()` into a normal `NexusAIConfig`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function normalizeCreateNexusConfig(config: NexusAIConfig | CreateNexusOptions): NexusAIConfig;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import type { NexusAIConfig } from '../types/config.js';
|
|
2
|
+
import type { CompletionRequest } from '../types/messages.js';
|
|
3
|
+
import type { NexusPlan } from '../types/planning.js';
|
|
4
|
+
import type { NexusResponse, NexusStream } from '../types/response.js';
|
|
5
|
+
import type { AgentConfig, AgentResult } from '../types/agent.js';
|
|
6
|
+
import type { SpeechRequest, SpeechResponse, TranscriptionRequest, TranscriptionResponse, VoiceProvider, VoiceSessionConfig, VoiceTurnRequest, VoiceTurnResponse } from '../types/voice.js';
|
|
7
|
+
import type { ImageProvider } from '../types/images.js';
|
|
8
|
+
import type { CreateCallRequest, CreateCallResponse, EndCallRequest, GetCallRequest, ListPhoneNumbersRequest, TelephonyCallDetails, TelephonyMediaStreamEvent, TelephonyOutboundAudioMessage, TelephonyPhoneNumber, TelephonyProvider, TelephonyResponseRequest, TelephonyStatusCallback, TelephonyWebhookResponse, TelephonyWebhookValidationRequest, UpdatePhoneNumberRequest } from '../types/telephony.js';
|
|
9
|
+
import type { PipelineStep } from '../pipeline/types.js';
|
|
10
|
+
import type { BaseProvider } from '../providers/base.js';
|
|
11
|
+
import { type VoiceSession } from '../voice/index.js';
|
|
12
|
+
import { ImageManager } from '../images/manager.js';
|
|
13
|
+
import { type VerificationOptions } from '../hallucination/verification.js';
|
|
14
|
+
import { type SelfConsistencyOptions } from '../hallucination/consistency.js';
|
|
15
|
+
import { type BatchOptions, type BatchItemResult } from '../jobs/batch.js';
|
|
16
|
+
import { JobQueue, type QueueOptions } from '../jobs/queue.js';
|
|
17
|
+
import { type EvalCase, type EvalRunResult } from '../evals/runner.js';
|
|
18
|
+
import { type SummarizeVerifyFormatOptions, type WorkflowResult } from '../workflow/chains.js';
|
|
19
|
+
/**
|
|
20
|
+
* Main runtime facade for provider routing, security, optimization, evals, voice, jobs, and observability.
|
|
21
|
+
*
|
|
22
|
+
* Use `new NexusAI(config)` when you want full control, or `createNexus()` for the beginner shorthand.
|
|
23
|
+
*/
|
|
24
|
+
export declare class NexusAI {
|
|
25
|
+
/** Provider-neutral image generation and editing operations. */
|
|
26
|
+
readonly images: ImageManager;
|
|
27
|
+
private config;
|
|
28
|
+
private providers;
|
|
29
|
+
private router;
|
|
30
|
+
private failover;
|
|
31
|
+
private logger;
|
|
32
|
+
private security;
|
|
33
|
+
private contextWindow;
|
|
34
|
+
private voiceManager;
|
|
35
|
+
private telephonyManager;
|
|
36
|
+
private optimizer;
|
|
37
|
+
private cache;
|
|
38
|
+
private auditLogger;
|
|
39
|
+
private rateLimiter;
|
|
40
|
+
private pipeline;
|
|
41
|
+
private metrics;
|
|
42
|
+
private health;
|
|
43
|
+
private semanticCache;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a configured Nexus runtime.
|
|
46
|
+
*
|
|
47
|
+
* Provider SDKs are loaded lazily by each provider adapter, so unused providers do not add runtime work.
|
|
48
|
+
*/
|
|
49
|
+
constructor(config: NexusAIConfig);
|
|
50
|
+
/**
|
|
51
|
+
* Runs a completion through the full configured pipeline and returns one normalized response.
|
|
52
|
+
*/
|
|
53
|
+
complete(request: CompletionRequest): Promise<NexusResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Completes a request and verifies generated claims against provided context.
|
|
56
|
+
*/
|
|
57
|
+
completeVerified(request: CompletionRequest, options: VerificationOptions): Promise<NexusResponse>;
|
|
58
|
+
/**
|
|
59
|
+
* Samples multiple completions and returns the most self-consistent answer.
|
|
60
|
+
*/
|
|
61
|
+
completeConsistent(request: CompletionRequest, options?: SelfConsistencyOptions): Promise<NexusResponse>;
|
|
62
|
+
/**
|
|
63
|
+
* Previews routing, token usage, context fit, cost, and guardrail findings without calling a provider.
|
|
64
|
+
*/
|
|
65
|
+
plan(request: CompletionRequest): NexusPlan;
|
|
66
|
+
/**
|
|
67
|
+
* Streams a completion through the configured pipeline using normalized stream chunks.
|
|
68
|
+
*/
|
|
69
|
+
stream(request: CompletionRequest): NexusStream;
|
|
70
|
+
/**
|
|
71
|
+
* Runs an agent loop with registered tools and iteration limits.
|
|
72
|
+
*/
|
|
73
|
+
agent(config: AgentConfig): Promise<AgentResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Transcribes audio through a registered voice provider.
|
|
76
|
+
*/
|
|
77
|
+
transcribe(request: TranscriptionRequest): Promise<TranscriptionResponse>;
|
|
78
|
+
/**
|
|
79
|
+
* Synthesizes speech through a registered voice provider.
|
|
80
|
+
*/
|
|
81
|
+
speak(request: SpeechRequest): Promise<SpeechResponse>;
|
|
82
|
+
/**
|
|
83
|
+
* Runs one voice turn: optional transcription, completion, and optional speech synthesis.
|
|
84
|
+
*/
|
|
85
|
+
voice(request: VoiceTurnRequest): Promise<VoiceTurnResponse>;
|
|
86
|
+
/**
|
|
87
|
+
* Alias for `voice()` for apps that model calls as turns.
|
|
88
|
+
*/
|
|
89
|
+
voiceTurn(request: VoiceTurnRequest): Promise<VoiceTurnResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Creates a stateful voice session with transcript history, task prompts, and optional tools.
|
|
92
|
+
*/
|
|
93
|
+
createVoiceSession(config: VoiceSessionConfig): VoiceSession;
|
|
94
|
+
/**
|
|
95
|
+
* Creates an outbound call through a registered telephony provider.
|
|
96
|
+
*/
|
|
97
|
+
createCall(request: CreateCallRequest): Promise<CreateCallResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Creates a provider-specific webhook response such as TwiML.
|
|
100
|
+
*/
|
|
101
|
+
createTelephonyResponse(request: TelephonyResponseRequest): Promise<TelephonyWebhookResponse>;
|
|
102
|
+
/**
|
|
103
|
+
* Validates a telephony webhook signature when the provider supports it.
|
|
104
|
+
*/
|
|
105
|
+
validateTelephonyWebhook(request: TelephonyWebhookValidationRequest): Promise<boolean>;
|
|
106
|
+
parseTelephonyMediaEvent(providerName: string, message: string | Record<string, unknown>): TelephonyMediaStreamEvent | undefined;
|
|
107
|
+
formatTelephonyAudioMessage(providerName: string, streamId: string, payload: string, options?: {
|
|
108
|
+
event?: 'media' | 'mark' | 'clear';
|
|
109
|
+
markName?: string;
|
|
110
|
+
}): TelephonyOutboundAudioMessage;
|
|
111
|
+
/**
|
|
112
|
+
* Reads a call's current provider-side state, including the duration usage metering bills on.
|
|
113
|
+
*/
|
|
114
|
+
getCall(request: GetCallRequest): Promise<TelephonyCallDetails>;
|
|
115
|
+
/**
|
|
116
|
+
* Hangs up a live call through the provider's call-control API.
|
|
117
|
+
*/
|
|
118
|
+
endCall(request: EndCallRequest): Promise<TelephonyCallDetails>;
|
|
119
|
+
/**
|
|
120
|
+
* Parses a provider status webhook into a normalized record. Prefer this over media-stream
|
|
121
|
+
* lifecycle events when metering usage.
|
|
122
|
+
*/
|
|
123
|
+
parseTelephonyStatusCallback(providerName: string, body: string | URLSearchParams | Record<string, string | number | boolean | undefined>): TelephonyStatusCallback | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Lists phone numbers owned by the provider account.
|
|
126
|
+
*/
|
|
127
|
+
listPhoneNumbers(request?: ListPhoneNumbersRequest): Promise<TelephonyPhoneNumber[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Points a phone number at a voice webhook and/or status callback.
|
|
130
|
+
*/
|
|
131
|
+
updatePhoneNumber(request: UpdatePhoneNumberRequest): Promise<TelephonyPhoneNumber>;
|
|
132
|
+
/**
|
|
133
|
+
* Registers a custom text provider at runtime.
|
|
134
|
+
*/
|
|
135
|
+
registerProvider(name: string, provider: BaseProvider): this;
|
|
136
|
+
/**
|
|
137
|
+
* Registers a custom voice provider at runtime.
|
|
138
|
+
*/
|
|
139
|
+
registerVoiceProvider(name: string, provider: VoiceProvider): this;
|
|
140
|
+
/**
|
|
141
|
+
* Registers a custom image provider at runtime.
|
|
142
|
+
*/
|
|
143
|
+
registerImageProvider(name: string, provider: ImageProvider): this;
|
|
144
|
+
/**
|
|
145
|
+
* Registers a custom telephony provider at runtime.
|
|
146
|
+
*/
|
|
147
|
+
registerTelephonyProvider(name: string, provider: TelephonyProvider): this;
|
|
148
|
+
hasProvider(name: string): boolean;
|
|
149
|
+
hasVoiceProvider(name: string): boolean;
|
|
150
|
+
hasImageProvider(name: string): boolean;
|
|
151
|
+
hasTelephonyProvider(name: string): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Lists configured text providers.
|
|
154
|
+
*/
|
|
155
|
+
listProviders(): string[];
|
|
156
|
+
listVoiceProviders(): string[];
|
|
157
|
+
listImageProviders(): string[];
|
|
158
|
+
listTelephonyProviders(): string[];
|
|
159
|
+
/**
|
|
160
|
+
* Adds a custom pipeline step.
|
|
161
|
+
*/
|
|
162
|
+
use(step: PipelineStep): this;
|
|
163
|
+
/**
|
|
164
|
+
* Runs multiple completion requests with optional concurrency control.
|
|
165
|
+
*/
|
|
166
|
+
batchComplete(requests: CompletionRequest[], options?: BatchOptions): Promise<Array<BatchItemResult<NexusResponse>>>;
|
|
167
|
+
/**
|
|
168
|
+
* Creates an in-process job queue for completion requests.
|
|
169
|
+
*/
|
|
170
|
+
createQueue(options?: QueueOptions): JobQueue<CompletionRequest, NexusResponse>;
|
|
171
|
+
/**
|
|
172
|
+
* Runs eval cases against this Nexus instance.
|
|
173
|
+
*/
|
|
174
|
+
runEvals(cases: EvalCase<NexusResponse>[]): Promise<EvalRunResult<NexusResponse>>;
|
|
175
|
+
summarizeVerifyFormat(options: SummarizeVerifyFormatOptions): Promise<WorkflowResult>;
|
|
176
|
+
/**
|
|
177
|
+
* Returns current provider health snapshots.
|
|
178
|
+
*/
|
|
179
|
+
getProviderHealth(): import("../ops/health.js").ProviderHealthSnapshot[];
|
|
180
|
+
/**
|
|
181
|
+
* Calls each provider's health check and records the result.
|
|
182
|
+
*/
|
|
183
|
+
checkProviders(): Promise<Array<{
|
|
184
|
+
providerName: string;
|
|
185
|
+
ok: boolean;
|
|
186
|
+
error?: string;
|
|
187
|
+
}>>;
|
|
188
|
+
/**
|
|
189
|
+
* Returns an in-memory metrics snapshot.
|
|
190
|
+
*/
|
|
191
|
+
getMetricsSnapshot(): Record<string, unknown>;
|
|
192
|
+
/**
|
|
193
|
+
* Returns Prometheus-formatted metrics when metrics are enabled.
|
|
194
|
+
*/
|
|
195
|
+
getPrometheusMetrics(): string;
|
|
196
|
+
/**
|
|
197
|
+
* Clears exact and semantic caches.
|
|
198
|
+
*/
|
|
199
|
+
clearCache(): void;
|
|
200
|
+
clearExpiredCache(): number;
|
|
201
|
+
getCacheStats(): {
|
|
202
|
+
size: number;
|
|
203
|
+
maxEntries: number;
|
|
204
|
+
expiredEntries: number;
|
|
205
|
+
};
|
|
206
|
+
private isAuditLogEnabled;
|
|
207
|
+
private isCacheEnabled;
|
|
208
|
+
private isCostBudgetEnabled;
|
|
209
|
+
private isSecurityEnabled;
|
|
210
|
+
private isTokenOptimizerEnabled;
|
|
211
|
+
private isContextWindowEnabled;
|
|
212
|
+
private hasResponseFormat;
|
|
213
|
+
private streamWithContextWindow;
|
|
214
|
+
private attachContextWindowToStream;
|
|
215
|
+
private summarizeContext;
|
|
216
|
+
private registerConfiguredProviders;
|
|
217
|
+
private attachTrace;
|
|
218
|
+
private getCachedResponse;
|
|
219
|
+
private setCachedResponse;
|
|
220
|
+
private enforceCostBudget;
|
|
221
|
+
private estimatedOutputTokens;
|
|
222
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CompletionRequest } from '../types/messages.js';
|
|
2
|
+
import type { NexusResponse } from '../types/response.js';
|
|
3
|
+
import type { ResponseFormatConfig } from '../types/config.js';
|
|
4
|
+
export declare class ResponseFormatError extends Error {
|
|
5
|
+
constructor(message: string);
|
|
6
|
+
}
|
|
7
|
+
export declare function applyResponseFormat(response: NexusResponse, config?: ResponseFormatConfig): NexusResponse;
|
|
8
|
+
export declare function withResponseFormat(request: CompletionRequest, config?: ResponseFormatConfig): CompletionRequest;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NexusStream, StreamChunk } from '../types/response.js';
|
|
2
|
+
export declare function collectStream(stream: NexusStream): Promise<string>;
|
|
3
|
+
export declare function mapStream(stream: NexusStream, mapChunk: (chunk: StreamChunk) => StreamChunk | Promise<StreamChunk>): AsyncGenerator<StreamChunk>;
|
|
4
|
+
export declare function createTextStream(text: string): NexusStream;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EmbeddingProvider } from '../hallucination/retrieval.js';
|
|
2
|
+
export interface OpenAIEmbeddingOptions {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
model?: string;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface GeminiEmbeddingOptions {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
model?: string;
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface CohereEmbeddingOptions {
|
|
13
|
+
apiKey: string;
|
|
14
|
+
model?: string;
|
|
15
|
+
baseUrl?: string;
|
|
16
|
+
inputType?: 'search_document' | 'search_query' | 'classification' | 'clustering';
|
|
17
|
+
}
|
|
18
|
+
export declare function createOpenAIEmbeddingProvider(options: OpenAIEmbeddingOptions): EmbeddingProvider;
|
|
19
|
+
export declare function createGeminiEmbeddingProvider(options: GeminiEmbeddingOptions): EmbeddingProvider;
|
|
20
|
+
export declare function createCohereEmbeddingProvider(options: CohereEmbeddingOptions): EmbeddingProvider;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { EvalRunner, type EvalCase, type EvalClient, type EvalJudge, type EvalJudgment, type EvalResult, type EvalRunResult, } from './runner.js';
|
|
2
|
+
export { LLMJudge, createLLMJudgeEval, parseJudgeResponse, type JudgeClient, type LLMJudgeInput, type LLMJudgeInputMapper, type LLMJudgeOptions, type LLMJudgeResult, } from './judge.js';
|
|
3
|
+
export { calculateEvalMetrics, exactMatch, f1Score, semanticSimilarity, passAtK, perplexity, tokensPerSecond, faithfulness, contextualPrecision, contextualRecall, toxicityScore, biasScore, policyAdherence, refusalRate, type EvalMetrics, type MetricInputs, type OperationalMetrics, type QualityMetrics, type RagMetrics, type SafetyMetrics, } from './metrics.js';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { CompletionRequest } from '../types/messages.js';
|
|
2
|
+
import type { NexusResponse } from '../types/response.js';
|
|
3
|
+
import type { EvalCase, EvalJudge } from './runner.js';
|
|
4
|
+
export interface JudgeClient<Response = NexusResponse> {
|
|
5
|
+
complete(request: CompletionRequest): Promise<Response>;
|
|
6
|
+
}
|
|
7
|
+
export interface LLMJudgeInput {
|
|
8
|
+
actual: string;
|
|
9
|
+
expected?: string;
|
|
10
|
+
query?: string;
|
|
11
|
+
rubric?: string;
|
|
12
|
+
contexts?: string[];
|
|
13
|
+
metadata?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export interface LLMJudgeOptions<Response = NexusResponse> {
|
|
16
|
+
client: JudgeClient<Response>;
|
|
17
|
+
model: string;
|
|
18
|
+
rubric?: string;
|
|
19
|
+
systemPrompt?: string;
|
|
20
|
+
passThreshold?: number;
|
|
21
|
+
range?: [number, number];
|
|
22
|
+
temperature?: number;
|
|
23
|
+
maxTokens?: number;
|
|
24
|
+
metadata?: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
export interface LLMJudgeResult {
|
|
27
|
+
score: number;
|
|
28
|
+
passed: boolean;
|
|
29
|
+
rationale?: string;
|
|
30
|
+
labels?: string[];
|
|
31
|
+
raw: unknown;
|
|
32
|
+
providerUsed?: string;
|
|
33
|
+
modelUsed?: string;
|
|
34
|
+
}
|
|
35
|
+
export type LLMJudgeInputMapper<Response> = (response: Response, testCase: EvalCase<Response>) => LLMJudgeInput | Promise<LLMJudgeInput>;
|
|
36
|
+
export declare class LLMJudge<Response = NexusResponse> {
|
|
37
|
+
private options;
|
|
38
|
+
constructor(options: LLMJudgeOptions<Response>);
|
|
39
|
+
evaluate(input: LLMJudgeInput): Promise<LLMJudgeResult>;
|
|
40
|
+
asEvalJudge(mapper?: LLMJudgeInputMapper<Response>): EvalJudge<Response>;
|
|
41
|
+
private messages;
|
|
42
|
+
}
|
|
43
|
+
export declare function createLLMJudgeEval<Response = NexusResponse>(judge: LLMJudge<Response>, mapper?: LLMJudgeInputMapper<Response>): EvalJudge<Response>;
|
|
44
|
+
export declare function parseJudgeResponse(content: string, options?: {
|
|
45
|
+
threshold?: number;
|
|
46
|
+
range?: [number, number];
|
|
47
|
+
raw?: unknown;
|
|
48
|
+
providerUsed?: string;
|
|
49
|
+
modelUsed?: string;
|
|
50
|
+
}): LLMJudgeResult;
|