@valerypopoff/rivet2-core 2.15.0 → 2.19.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.
- package/dist/cjs/bundle.cjs +7906 -3980
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/interpolationRuntime.cjs +62 -7
- package/dist/cjs/interpolationRuntime.cjs.map +3 -3
- package/dist/cjs/interpolationSyntax.cjs +9 -5
- package/dist/cjs/interpolationSyntax.cjs.map +2 -2
- package/dist/cjs/serialization.cjs +1880 -0
- package/dist/cjs/serialization.cjs.map +7 -0
- package/dist/cjs/webAppRuntime.cjs +168 -6
- package/dist/cjs/webAppRuntime.cjs.map +3 -3
- package/dist/esm/api/createProcessor.js +5 -2
- package/dist/esm/api/processSettings.js +1 -0
- package/dist/esm/exports.js +4 -0
- package/dist/esm/model/AgentResponseTrace.js +99 -34
- package/dist/esm/model/AgentResponseTracePresentation.js +130 -0
- package/dist/esm/model/DataValue.js +11 -2
- package/dist/esm/model/GlobalVariables.js +2 -1
- package/dist/esm/model/GraphBoundaryCache.js +2 -1
- package/dist/esm/model/GraphBoundaryEffects.js +38 -1
- package/dist/esm/model/GraphExecutionState.js +81 -0
- package/dist/esm/model/GraphProcessor.js +825 -884
- package/dist/esm/model/GraphSchedulerBoundaryState.js +64 -0
- package/dist/esm/model/Nodes.js +15 -0
- package/dist/esm/model/ProjectBundle.js +248 -0
- package/dist/esm/model/ProjectBundleRuntime.js +54 -0
- package/dist/esm/model/SchedulerBoundaryPlanner.js +233 -0
- package/dist/esm/model/SplitRunProcessor.js +28 -7
- package/dist/esm/model/StreamingWatchTopology.js +118 -8
- package/dist/esm/model/SubgraphProjectTarget.js +7 -0
- package/dist/esm/model/SubprocessorBridge.js +125 -87
- package/dist/esm/model/ToolCallContinuationCoordinator.js +1 -1
- package/dist/esm/model/chat-v2/aiSdkBridge.js +22 -17
- package/dist/esm/model/chat-v2/chatV2CallObserver.js +2 -4
- package/dist/esm/model/chat-v2/chatV2CredentialNames.js +5 -1
- package/dist/esm/model/chat-v2/chatV2Outputs.js +2 -2
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +24 -9
- package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +3 -2
- package/dist/esm/model/chat-v2/chatV2ProviderRegistry.js +46 -6
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +26 -1
- package/dist/esm/model/chat-v2/chatV2Shared.js +2 -1
- package/dist/esm/model/chat-v2/chatV2UsageAccounting.js +10 -0
- package/dist/esm/model/chat-v2/llmChatV2Body.js +13 -10
- package/dist/esm/model/chat-v2/llmChatV2CacheBoundary.js +5 -2
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +3 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +33 -9
- package/dist/esm/model/chat-v2/llmChatV2NodeMigration.js +22 -2
- package/dist/esm/model/chat-v2/llmInvocationCoordinator.js +10 -2
- package/dist/esm/model/chat-v2/llmInvocationResultProjector.js +17 -0
- package/dist/esm/model/chat-v2/llmModelCandidate.js +2 -1
- package/dist/esm/model/chat-v2/llmProfile.js +5 -1
- package/dist/esm/model/chat-v2/llmProfileBody.js +11 -2
- package/dist/esm/model/chat-v2/llmProfileFallback.js +7 -4
- package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +2 -1
- package/dist/esm/model/chat-v2/llmProfileHealthStore.js +16 -3
- package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +1 -1
- package/dist/esm/model/chat-v2/messageConverter.js +18 -16
- package/dist/esm/model/chat-v2/modelRegistry.js +14 -4
- package/dist/esm/model/chat-v2/openRouterModel.js +73 -0
- package/dist/esm/model/chat-v2/parallelToolCalls.js +2 -0
- package/dist/esm/model/chat-v2/providerOptions.js +30 -25
- package/dist/esm/model/chat-v2/temperature.js +9 -0
- package/dist/esm/model/classifier/credentials.js +42 -6
- package/dist/esm/model/classifier/images.js +176 -0
- package/dist/esm/model/classifier/json.js +57 -0
- package/dist/esm/model/classifier/limits.js +300 -0
- package/dist/esm/model/classifier/openai.js +118 -0
- package/dist/esm/model/classifier/perplexity.js +63 -0
- package/dist/esm/model/classifier/preparation.js +74 -0
- package/dist/esm/model/classifier/profile.js +151 -0
- package/dist/esm/model/classifier/profileExecution.js +294 -0
- package/dist/esm/model/classifier/providers.js +454 -192
- package/dist/esm/model/classifier/questionHelpers.js +29 -45
- package/dist/esm/model/classifier/questions.js +53 -0
- package/dist/esm/model/classifier/response.js +75 -0
- package/dist/esm/model/classifier/state.js +207 -0
- package/dist/esm/model/classifier/types.js +11 -1
- package/dist/esm/model/nodeRunFailure.js +54 -0
- package/dist/esm/model/nodes/CallGraphNode.js +6 -0
- package/dist/esm/model/nodes/CatchStreamingChunksNode.js +42 -0
- package/dist/esm/model/nodes/ClassifierEvaluateNode.js +385 -154
- package/dist/esm/model/nodes/ClassifierProfileNode.js +133 -0
- package/dist/esm/model/nodes/ClassifierQuestionNode.js +59 -15
- package/dist/esm/model/nodes/DelegateFunctionCallNode.js +1 -1
- package/dist/esm/model/nodes/GetGlobalNode.js +2 -2
- package/dist/esm/model/nodes/HttpCallNode.js +44 -75
- package/dist/esm/model/nodes/ImageNode.js +44 -3
- package/dist/esm/model/nodes/LLMChatV2Node.js +26 -4
- package/dist/esm/model/nodes/ObjectNode.js +29 -18
- package/dist/esm/model/nodes/PromptNode.js +2 -1
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +4 -1
- package/dist/esm/model/nodes/SetGlobalNode.js +5 -3
- package/dist/esm/model/nodes/StopWatchingStreamingOutputNode.js +8 -8
- package/dist/esm/model/nodes/StreamValueNode.js +38 -0
- package/dist/esm/model/nodes/SubGraphNode.js +199 -35
- package/dist/esm/model/nodes/ToBase64Node.js +106 -0
- package/dist/esm/model/nodes/WatchStreamingOutputNode.js +7 -7
- package/dist/esm/model/nodes/toolCallDelegation.js +5 -1
- package/dist/esm/model/profileSuspensionHints.js +8 -0
- package/dist/esm/recording/ExecutionRecorder.js +26 -0
- package/dist/esm/serialization.js +2 -0
- package/dist/esm/utils/base64.js +18 -15
- package/dist/esm/utils/coerceType.js +11 -1
- package/dist/esm/utils/errors.js +41 -0
- package/dist/esm/utils/interpolation.js +44 -22
- package/dist/esm/utils/interpolationSyntax.js +15 -6
- package/dist/esm/utils/serialization/serialization.js +3 -2
- package/dist/esm/utils/serialization/serializationUtils.js +6 -0
- package/dist/esm/utils/serialization/serialization_v4.js +15 -3
- package/dist/esm/webAppRuntime.js +1 -0
- package/dist/types/api/createProcessor.d.ts +7 -1
- package/dist/types/exports.d.ts +4 -0
- package/dist/types/model/AgentResponseTrace.d.ts +15 -4
- package/dist/types/model/AgentResponseTracePresentation.d.ts +15 -0
- package/dist/types/model/CycleDetector.d.ts +1 -2
- package/dist/types/model/DataValue.d.ts +12 -8
- package/dist/types/model/ExecutorProtocol.d.ts +9 -0
- package/dist/types/model/GraphBoundaryCache.d.ts +2 -0
- package/dist/types/model/GraphBoundaryEffects.d.ts +10 -1
- package/dist/types/model/GraphExecutionState.d.ts +68 -0
- package/dist/types/model/GraphProcessor.d.ts +2 -0
- package/dist/types/model/GraphSchedulerBoundaryState.d.ts +96 -0
- package/dist/types/model/Nodes.d.ts +11 -4
- package/dist/types/model/ProcessContext.d.ts +24 -3
- package/dist/types/model/ProjectBundle.d.ts +59 -0
- package/dist/types/model/ProjectBundleRuntime.d.ts +24 -0
- package/dist/types/model/ProjectReferenceLoader.d.ts +3 -0
- package/dist/types/model/RivetUIContext.d.ts +1 -1
- package/dist/types/model/SchedulerBoundaryPlanner.d.ts +42 -0
- package/dist/types/model/Settings.d.ts +1 -0
- package/dist/types/model/StreamingWatchTopology.d.ts +11 -1
- package/dist/types/model/SubgraphProjectTarget.d.ts +38 -0
- package/dist/types/model/SubprocessorBridge.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2CredentialNames.d.ts +4 -0
- package/dist/types/model/chat-v2/chatV2Outputs.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2ProviderRegistry.d.ts +79 -1
- package/dist/types/model/chat-v2/chatV2ProviderTypes.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2Shared.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2UsageAccounting.d.ts +2 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +4 -1
- package/dist/types/model/chat-v2/llmChatV2NodeMigration.d.ts +3 -1
- package/dist/types/model/chat-v2/llmInvocationCoordinator.d.ts +2 -0
- package/dist/types/model/chat-v2/llmInvocationResultProjector.d.ts +2 -0
- package/dist/types/model/chat-v2/llmProfileFallback.d.ts +51 -3
- package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +10 -7
- package/dist/types/model/chat-v2/llmProfileHealthStore.d.ts +6 -2
- package/dist/types/model/chat-v2/modelRegistry.d.ts +5 -4
- package/dist/types/model/chat-v2/openRouterModel.d.ts +2 -0
- package/dist/types/model/chat-v2/providerOptions.d.ts +2 -13
- package/dist/types/model/chat-v2/temperature.d.ts +2 -0
- package/dist/types/model/classifier/credentials.d.ts +7 -1
- package/dist/types/model/classifier/images.d.ts +18 -0
- package/dist/types/model/classifier/json.d.ts +19 -0
- package/dist/types/model/classifier/limits.d.ts +45 -0
- package/dist/types/model/classifier/openai.d.ts +5 -0
- package/dist/types/model/classifier/perplexity.d.ts +7 -0
- package/dist/types/model/classifier/preparation.d.ts +16 -0
- package/dist/types/model/classifier/profile.d.ts +46 -0
- package/dist/types/model/classifier/profileExecution.d.ts +32 -0
- package/dist/types/model/classifier/providers.d.ts +98 -9
- package/dist/types/model/classifier/questionHelpers.d.ts +6 -4
- package/dist/types/model/classifier/questions.d.ts +4 -0
- package/dist/types/model/classifier/response.d.ts +4 -0
- package/dist/types/model/classifier/state.d.ts +37 -0
- package/dist/types/model/classifier/types.d.ts +11 -0
- package/dist/types/model/nodeRunFailure.d.ts +13 -0
- package/dist/types/model/nodes/CatchStreamingChunksNode.d.ts +20 -0
- package/dist/types/model/nodes/ClassifierEvaluateNode.d.ts +17 -12
- package/dist/types/model/nodes/ClassifierProfileNode.d.ts +20 -0
- package/dist/types/model/nodes/GetGlobalNode.d.ts +7 -0
- package/dist/types/model/nodes/ImageNode.d.ts +4 -0
- package/dist/types/model/nodes/LLMChatV2Node.d.ts +1 -0
- package/dist/types/model/nodes/ObjectNode.d.ts +2 -1
- package/dist/types/model/nodes/StreamValueNode.d.ts +14 -0
- package/dist/types/model/nodes/SubGraphNode.d.ts +21 -2
- package/dist/types/model/nodes/ToBase64Node.d.ts +12 -0
- package/dist/types/model/nodes/toolCallDelegation.d.ts +3 -1
- package/dist/types/model/profileSuspensionHints.d.ts +8 -0
- package/dist/types/recording/ExecutionRecorder.d.ts +8 -2
- package/dist/types/serialization.d.ts +2 -0
- package/dist/types/utils/base64.d.ts +1 -1
- package/dist/types/utils/errors.d.ts +4 -0
- package/dist/types/utils/interpolation.d.ts +13 -2
- package/dist/types/utils/interpolationSyntax.d.ts +1 -1
- package/dist/types/utils/serialization/serialization.d.ts +3 -1
- package/dist/types/utils/serialization/serializationUtils.d.ts +1 -0
- package/dist/types/webAppRuntime.d.ts +1 -0
- package/package.json +7 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ChartNode } from '../NodeBase.js';
|
|
2
|
+
/** Repair legacy payloads on read or Save without mutating the supplied data. */
|
|
3
|
+
export declare function normalizeSerializedLLMTemperatureData(nodeType: string, data: ChartNode['data']): ChartNode['data'];
|
|
2
4
|
/**
|
|
3
|
-
* Serialized LLM Chat migrations live beside the node contract, rather than
|
|
5
|
+
* Serialized LLM Chat/Profile migrations live beside the node contract, rather than
|
|
4
6
|
* making generic project serialization understand LLM-specific settings.
|
|
5
7
|
* This is deliberately idempotent because deserialization can normalize a
|
|
6
8
|
* graph more than once while it is imported or embedded in a prefab.
|
|
@@ -4,6 +4,7 @@ import type { InternalProcessContext } from '../ProcessContext.js';
|
|
|
4
4
|
import type { ToolCallContinuation } from '../ToolCallContinuation.js';
|
|
5
5
|
import { type LLMChatOutputSnapshotDescriptor } from './toolContinuation.js';
|
|
6
6
|
import type { LLMInvocationJournal } from './llmInvocationJournal.js';
|
|
7
|
+
import { type GraphCostBreakdown } from '../GraphBoundaryEffects.js';
|
|
7
8
|
/**
|
|
8
9
|
* Owns the LLM-level recovery and continuation decision boundary. The node
|
|
9
10
|
* boundary provides a resolved runtime and GraphProcessor supplies only the
|
|
@@ -17,4 +18,5 @@ export declare function executeLLMInvocation(params: {
|
|
|
17
18
|
}): Promise<{
|
|
18
19
|
result: ChatV2PipelineResult;
|
|
19
20
|
terminalSnapshot?: LLMChatOutputSnapshotDescriptor;
|
|
21
|
+
toolCost?: GraphCostBreakdown;
|
|
20
22
|
}>;
|
|
@@ -2,6 +2,7 @@ import type { Outputs } from '../GraphProcessor.js';
|
|
|
2
2
|
import type { ChatV2CallFinishedEvent } from '../ProcessContext.js';
|
|
3
3
|
import type { LLMAttempt } from './llmProfileFallback.js';
|
|
4
4
|
import type { ChatV2PipelineResult, ChatV2PipelineRoundOptions } from './chatV2Types.js';
|
|
5
|
+
import type { GraphCostBreakdown } from '../GraphBoundaryEffects.js';
|
|
5
6
|
type LLMInvocationDiagnosticProjectionOptions = {
|
|
6
7
|
runOptions: Pick<ChatV2PipelineRoundOptions, 'requestBodies' | 'responseBodies' | 'outputRequestBody' | 'outputResponseBody'>;
|
|
7
8
|
outputLLMAttempts: boolean | undefined;
|
|
@@ -26,5 +27,6 @@ export declare function projectLLMInvocationResult(params: {
|
|
|
26
27
|
outputLLMAttempts: boolean | undefined;
|
|
27
28
|
llmAttempts: readonly LLMAttempt[];
|
|
28
29
|
profileSummary?: string | undefined;
|
|
30
|
+
toolCost?: GraphCostBreakdown;
|
|
29
31
|
}): Outputs;
|
|
30
32
|
export {};
|
|
@@ -1,13 +1,38 @@
|
|
|
1
|
+
import type { ClassifierFailureKind, ClassifierAttemptUsage } from '../classifier/types.js';
|
|
1
2
|
import { type ChatV2Provider, type ChatV2PipelineRoundOptions, type ChatV2PipelineResult, type RunChatV2PipelineOptions } from './chatV2Types.js';
|
|
2
3
|
import { type CustomProviderApi } from './customProviderApi.js';
|
|
3
4
|
import { type RivetLLMProfileCircuitBreakerPolicy, type RivetLLMProfileHealthIdentity, type RivetLLMProfileHealthOutcome, type RivetLLMProfileHealthState, type RivetLLMProfileHealthStore } from './llmProfileHealthStore.js';
|
|
5
|
+
/**
|
|
6
|
+
* Health persistence is deliberately fail-open, including when a remote
|
|
7
|
+
* implementation never settles. Invoke the operation before racing so a
|
|
8
|
+
* synchronous local store can still release a permit during cancellation;
|
|
9
|
+
* the attached handlers also consume any rejection that arrives after the
|
|
10
|
+
* deadline or caller abort won the race.
|
|
11
|
+
*/
|
|
12
|
+
export declare function runBoundedHealthOperation<T>(params: {
|
|
13
|
+
operation: string;
|
|
14
|
+
timeoutMs: number;
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
/** Finish must release a permit even when the graph has just been cancelled. */
|
|
17
|
+
runWhenAborted?: boolean;
|
|
18
|
+
/** Best-effort cleanup for results that arrive after timeout or cancellation. */
|
|
19
|
+
onLateResolve?: (value: T) => void | Promise<void>;
|
|
20
|
+
run: () => T | Promise<T>;
|
|
21
|
+
}): Promise<T>;
|
|
4
22
|
export type LLMAttempt = {
|
|
23
|
+
family?: 'llm' | 'classifier';
|
|
24
|
+
failureKind?: ClassifierFailureKind;
|
|
25
|
+
/** Unreached candidates are observability only, not a fallback attempt. */
|
|
26
|
+
skipReason?: 'unreached';
|
|
27
|
+
classifierUsage?: ClassifierAttemptUsage;
|
|
28
|
+
/** Physical classifier request duration, excluding retry waits. */
|
|
29
|
+
durationMs?: number;
|
|
5
30
|
roundIndex: number;
|
|
6
31
|
/** Present when a From profile candidate produced this attempt. */
|
|
7
32
|
profileIndex?: number;
|
|
8
|
-
/** User-facing title captured from the source
|
|
33
|
+
/** User-facing title captured from the source profile node. */
|
|
9
34
|
profileName?: string;
|
|
10
|
-
provider:
|
|
35
|
+
provider: string;
|
|
11
36
|
model: string;
|
|
12
37
|
customProviderApi?: CustomProviderApi;
|
|
13
38
|
stage: 'configuration' | 'request' | 'response-validation' | 'health-gate' | 'health-update';
|
|
@@ -20,7 +45,7 @@ export type LLMAttempt = {
|
|
|
20
45
|
healthDisposition?: 'allow' | 'deny' | 'fail-open';
|
|
21
46
|
healthOutcome?: RivetLLMProfileHealthOutcome;
|
|
22
47
|
retryAt?: number;
|
|
23
|
-
timeoutKind?: 'first-output' | 'stream-inactivity';
|
|
48
|
+
timeoutKind?: 'first-output' | 'stream-inactivity' | 'response';
|
|
24
49
|
};
|
|
25
50
|
export type LLMProfileFallbackHealth = {
|
|
26
51
|
identity: RivetLLMProfileHealthIdentity;
|
|
@@ -55,6 +80,29 @@ export declare function getLLMAttemptErrorMessage(error: unknown): string;
|
|
|
55
80
|
export declare function buildLLMProfileFallbackSummary(candidates: readonly LLMProfileFallbackCandidate[], attempts: readonly LLMAttempt[]): string;
|
|
56
81
|
/** Classifies only provider availability failures, never local/configuration errors. */
|
|
57
82
|
export declare function isUnhealthyLLMProfileProviderFailure(error: unknown): boolean;
|
|
83
|
+
export declare function createProfileHealthPermit(params: {
|
|
84
|
+
candidate: {
|
|
85
|
+
provider: string;
|
|
86
|
+
model: string;
|
|
87
|
+
customProviderApi?: CustomProviderApi;
|
|
88
|
+
health: Pick<LLMProfileFallbackHealth, 'identity' | 'policy'>;
|
|
89
|
+
};
|
|
90
|
+
healthStore: RivetLLMProfileHealthStore;
|
|
91
|
+
permitId: string;
|
|
92
|
+
state: RivetLLMProfileHealthState;
|
|
93
|
+
roundIndex: number;
|
|
94
|
+
profileIndex: number;
|
|
95
|
+
operationTimeoutMs: number;
|
|
96
|
+
executionCorrelationId?: string;
|
|
97
|
+
signal: AbortSignal;
|
|
98
|
+
recordAttempt: (attempt: LLMAttempt) => void;
|
|
99
|
+
}): {
|
|
100
|
+
permitId: string;
|
|
101
|
+
state: RivetLLMProfileHealthState;
|
|
102
|
+
renew: () => void;
|
|
103
|
+
renewForRetry: (cooldownMs: number) => Promise<void>;
|
|
104
|
+
finish: (outcome: RivetLLMProfileHealthOutcome) => Promise<void>;
|
|
105
|
+
};
|
|
58
106
|
/**
|
|
59
107
|
* Creates one forward-only fallback chain for a whole LLM Chat invocation.
|
|
60
108
|
* A model which succeeds in an earlier tool round stays active for subsequent
|
|
@@ -26,7 +26,7 @@ export declare const llmProfileFieldSpecs: readonly [{
|
|
|
26
26
|
}, {
|
|
27
27
|
readonly key: "temperature";
|
|
28
28
|
readonly inputId: "temperature";
|
|
29
|
-
readonly valueKind: "
|
|
29
|
+
readonly valueKind: "optional-number";
|
|
30
30
|
}, {
|
|
31
31
|
readonly key: "useTemperatureInput";
|
|
32
32
|
readonly valueKind: "boolean";
|
|
@@ -127,6 +127,9 @@ export declare const llmProfileFieldSpecs: readonly [{
|
|
|
127
127
|
}, {
|
|
128
128
|
readonly key: "openAIReasoningEffort";
|
|
129
129
|
readonly valueKind: "string";
|
|
130
|
+
}, {
|
|
131
|
+
readonly key: "openRouterReasoningEffort";
|
|
132
|
+
readonly valueKind: "string";
|
|
130
133
|
}, {
|
|
131
134
|
readonly key: "openAIReasoningSummary";
|
|
132
135
|
readonly valueKind: "string";
|
|
@@ -198,12 +201,12 @@ export declare const llmProfileFieldSpecs: readonly [{
|
|
|
198
201
|
readonly key: "circuitBreakerOpenDurationMs";
|
|
199
202
|
readonly valueKind: "required-number";
|
|
200
203
|
}];
|
|
201
|
-
export declare const llmProfileDataKeys: ("provider" | "model" | "
|
|
202
|
-
export declare const llmProfileInputIds: ("model" | "
|
|
204
|
+
export declare const llmProfileDataKeys: ("provider" | "model" | "useModelInput" | "temperature" | "useTemperatureInput" | "topP" | "useTopPInput" | "topK" | "useTopKInput" | "presencePenalty" | "usePresencePenaltyInput" | "frequencyPenalty" | "useFrequencyPenaltyInput" | "stopSequences" | "useStopSequencesInput" | "seed" | "useSeedInput" | "maxTokens" | "useMaxTokensInput" | "apiKeySource" | "providerApiKeyNames" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "customProviderApi" | "headers" | "useHeadersInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openRouterReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "anthropicCacheControlTtl" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "enableCircuitBreaker" | "firstOutputTimeoutMs" | "streamInactivityTimeoutMs" | "circuitBreakerFailureThreshold" | "circuitBreakerFailureWindowMs" | "circuitBreakerOpenDurationMs")[];
|
|
205
|
+
export declare const llmProfileInputIds: ("model" | "temperature" | "topP" | "topK" | "presencePenalty" | "frequencyPenalty" | "stopSequences" | "seed" | "maxTokens" | "customProviderBaseURL" | "headers" | "extraProviderOptions" | "anthropicThinkingBudget" | "googleThinkingBudget" | "apiKey" | "previousResponseId")[];
|
|
203
206
|
/** Runtime validation categories for resolved LLM Profile values. */
|
|
204
|
-
export declare const llmProfileStringDataKeys: ("provider" | "
|
|
205
|
-
export declare const llmProfileBooleanDataKeys: ("provider" | "
|
|
206
|
-
export declare const llmProfileRequiredNumberDataKeys: ("provider" | "
|
|
207
|
-
export declare const llmProfileOptionalNumberDataKeys: ("provider" | "
|
|
207
|
+
export declare const llmProfileStringDataKeys: ("provider" | keyof import("./chatV2Shared.js").ChatV2CommonNodeData | "configurationMode" | "apiKeySource" | "providerApiKeyNames" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "customProviderApi" | "baseURL" | "useBaseURLInput" | "headers" | "useHeadersInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openRouterReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "anthropicCacheControlTtl" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "enableCircuitBreaker" | "firstOutputTimeoutMs" | "streamInactivityTimeoutMs" | "circuitBreakerFailureThreshold" | "circuitBreakerFailureWindowMs" | "circuitBreakerOpenDurationMs" | "responseFormat" | "responseSchemaName" | "useResponseSchemaNameInput" | "responseSchemaDescription" | "useResponseSchemaDescriptionInput" | "toolChoice" | "toolChoiceFunction" | "parallelToolCalls" | "autoContinueToolCalls" | "maxToolRounds" | "retryOnNon200" | "errorOnNon200" | "catchRequestFailed" | "retryOnNon200RepeatTimes" | "retryOnNon200CooldownMs" | "outputLLMAttempts" | "outputRequestBody" | "outputResponseBody")[];
|
|
208
|
+
export declare const llmProfileBooleanDataKeys: ("provider" | keyof import("./chatV2Shared.js").ChatV2CommonNodeData | "configurationMode" | "apiKeySource" | "providerApiKeyNames" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "customProviderApi" | "baseURL" | "useBaseURLInput" | "headers" | "useHeadersInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openRouterReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "anthropicCacheControlTtl" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "enableCircuitBreaker" | "firstOutputTimeoutMs" | "streamInactivityTimeoutMs" | "circuitBreakerFailureThreshold" | "circuitBreakerFailureWindowMs" | "circuitBreakerOpenDurationMs" | "responseFormat" | "responseSchemaName" | "useResponseSchemaNameInput" | "responseSchemaDescription" | "useResponseSchemaDescriptionInput" | "toolChoice" | "toolChoiceFunction" | "parallelToolCalls" | "autoContinueToolCalls" | "maxToolRounds" | "retryOnNon200" | "errorOnNon200" | "catchRequestFailed" | "retryOnNon200RepeatTimes" | "retryOnNon200CooldownMs" | "outputLLMAttempts" | "outputRequestBody" | "outputResponseBody")[];
|
|
209
|
+
export declare const llmProfileRequiredNumberDataKeys: ("provider" | keyof import("./chatV2Shared.js").ChatV2CommonNodeData | "configurationMode" | "apiKeySource" | "providerApiKeyNames" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "customProviderApi" | "baseURL" | "useBaseURLInput" | "headers" | "useHeadersInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openRouterReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "anthropicCacheControlTtl" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "enableCircuitBreaker" | "firstOutputTimeoutMs" | "streamInactivityTimeoutMs" | "circuitBreakerFailureThreshold" | "circuitBreakerFailureWindowMs" | "circuitBreakerOpenDurationMs" | "responseFormat" | "responseSchemaName" | "useResponseSchemaNameInput" | "responseSchemaDescription" | "useResponseSchemaDescriptionInput" | "toolChoice" | "toolChoiceFunction" | "parallelToolCalls" | "autoContinueToolCalls" | "maxToolRounds" | "retryOnNon200" | "errorOnNon200" | "catchRequestFailed" | "retryOnNon200RepeatTimes" | "retryOnNon200CooldownMs" | "outputLLMAttempts" | "outputRequestBody" | "outputResponseBody")[];
|
|
210
|
+
export declare const llmProfileOptionalNumberDataKeys: ("provider" | keyof import("./chatV2Shared.js").ChatV2CommonNodeData | "configurationMode" | "apiKeySource" | "providerApiKeyNames" | "customProviderApiKeyProgrammaticName" | "customProviderApiKeyEnvVarName" | "customProviderBaseURL" | "useCustomProviderBaseURLInput" | "customProviderApi" | "baseURL" | "useBaseURLInput" | "headers" | "useHeadersInput" | "extraProviderOptions" | "useExtraProviderOptionsInput" | "openAIReasoningEffort" | "openRouterReasoningEffort" | "openAIReasoningSummary" | "openAIPreviousResponseId" | "useOpenAIPreviousResponseIdInput" | "enableOpenAIWebSearch" | "openAIWebSearchContextSize" | "enableOpenAICodeInterpreter" | "anthropicThinkingMode" | "anthropicThinkingBudget" | "useAnthropicThinkingBudgetInput" | "anthropicEffort" | "anthropicCacheControlTtl" | "googleThinkingBudget" | "useGoogleThinkingBudgetInput" | "googleThinkingLevel" | "googleIncludeThoughts" | "enableGoogleSearchGrounding" | "enableGoogleUrlContext" | "enableCircuitBreaker" | "firstOutputTimeoutMs" | "streamInactivityTimeoutMs" | "circuitBreakerFailureThreshold" | "circuitBreakerFailureWindowMs" | "circuitBreakerOpenDurationMs" | "responseFormat" | "responseSchemaName" | "useResponseSchemaNameInput" | "responseSchemaDescription" | "useResponseSchemaDescriptionInput" | "toolChoice" | "toolChoiceFunction" | "parallelToolCalls" | "autoContinueToolCalls" | "maxToolRounds" | "retryOnNon200" | "errorOnNon200" | "catchRequestFailed" | "retryOnNon200RepeatTimes" | "retryOnNon200CooldownMs" | "outputLLMAttempts" | "outputRequestBody" | "outputResponseBody")[];
|
|
208
211
|
/** A serialized profile must be self-contained, not driven by hidden ports. */
|
|
209
212
|
export declare const llmProfileResolvedInputToggleDataKeys: Array<keyof LLMChatV2NodeData>;
|
|
@@ -2,7 +2,6 @@ import type { NodeId } from '../NodeBase.js';
|
|
|
2
2
|
import type { ProjectId } from '../Project.js';
|
|
3
3
|
import type { ChatV2CredentialResult } from './chatV2ProviderProfile.js';
|
|
4
4
|
import type { LLMChatV2ProfileData } from './llmChatV2NodeData.js';
|
|
5
|
-
import type { ChatV2Provider } from './chatV2ProviderTypes.js';
|
|
6
5
|
import type { CustomProviderApi } from './customProviderApi.js';
|
|
7
6
|
export declare const DEFAULT_LLM_PROFILE_FIRST_OUTPUT_TIMEOUT_MS = 30000;
|
|
8
7
|
export declare const DEFAULT_LLM_PROFILE_STREAM_INACTIVITY_TIMEOUT_MS = 30000;
|
|
@@ -26,12 +25,14 @@ export declare function resolveRivetLLMProfileCircuitBreakerPolicy(configuration
|
|
|
26
25
|
* contract.
|
|
27
26
|
*/
|
|
28
27
|
export type RivetLLMProfileHealthIdentity = {
|
|
28
|
+
/** Absent on legacy LLM records. Classifiers share the atomic store, not its namespace. */
|
|
29
|
+
family?: 'llm' | 'classifier';
|
|
29
30
|
key: string;
|
|
30
31
|
projectId?: ProjectId;
|
|
31
32
|
profileNodeId?: NodeId;
|
|
32
33
|
/** Current source-node title used only for operator-facing identification. */
|
|
33
34
|
profileName?: string;
|
|
34
|
-
provider:
|
|
35
|
+
provider: string;
|
|
35
36
|
model: string;
|
|
36
37
|
customProviderApi?: CustomProviderApi;
|
|
37
38
|
configurationFingerprint: string;
|
|
@@ -88,12 +89,15 @@ export type RivetLLMProfileHealthRenewRequest = {
|
|
|
88
89
|
export type RivetLLMProfileHealthResetRequest = {
|
|
89
90
|
key: string;
|
|
90
91
|
projectId?: never;
|
|
92
|
+
family?: 'llm' | 'classifier';
|
|
91
93
|
} | {
|
|
92
94
|
key?: never;
|
|
93
95
|
projectId: ProjectId;
|
|
96
|
+
family?: 'llm' | 'classifier';
|
|
94
97
|
};
|
|
95
98
|
export type RivetLLMProfileHealthListRequest = {
|
|
96
99
|
projectId?: ProjectId;
|
|
100
|
+
family?: 'llm' | 'classifier';
|
|
97
101
|
};
|
|
98
102
|
/**
|
|
99
103
|
* Host persistence seam for LLM Profile health. Implementations must make
|
|
@@ -113,14 +113,15 @@ export declare function getChatV2ModelRegistry(): {
|
|
|
113
113
|
};
|
|
114
114
|
};
|
|
115
115
|
google: Record<string, ChatV2ModelInfo>;
|
|
116
|
+
openrouter: {};
|
|
116
117
|
custom: {};
|
|
117
118
|
};
|
|
118
119
|
export declare function getChatV2ModelInfo(provider: ChatV2Provider, modelId: string): ChatV2ModelInfo | undefined;
|
|
119
120
|
export declare function calculateChatV2Cost(provider: ChatV2Provider, modelId: string, promptTokens: number, completionTokens: number): number | undefined;
|
|
120
121
|
/**
|
|
121
|
-
*
|
|
122
|
-
* counts. Cache discounts, long-context
|
|
123
|
-
*
|
|
122
|
+
* Uses reported OpenRouter cost; estimates other providers only when both
|
|
123
|
+
* billable text-token counts are available. Cache discounts, long-context
|
|
124
|
+
* premiums, and provider tool fees are not modeled in those estimates.
|
|
124
125
|
*/
|
|
125
|
-
export declare function calculateChatV2UsageCost(provider: ChatV2Provider, modelId: string, usage: TokenUsageForCost | undefined): number | undefined;
|
|
126
|
+
export declare function calculateChatV2UsageCost(provider: ChatV2Provider, modelId: string, usage: TokenUsageForCost | undefined, providerMetadata?: Record<string, Record<string, unknown>>): number | undefined;
|
|
126
127
|
export {};
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
2
2
|
import { type CustomProviderApi } from './customProviderApi.js';
|
|
3
3
|
import type { ChatV2Model, ChatV2Provider } from './chatV2Types.js';
|
|
4
|
+
import { chatV2ProviderOptions } from './chatV2ProviderRegistry.js';
|
|
4
5
|
export { customProviderApiOptions, getCustomProviderApiContract, parseCustomProviderApi, type CustomProviderApi, type CustomProviderApiContract, } from './customProviderApi.js';
|
|
5
|
-
export
|
|
6
|
-
readonly value: "openai";
|
|
7
|
-
readonly label: "OpenAI";
|
|
8
|
-
}, {
|
|
9
|
-
readonly value: "anthropic";
|
|
10
|
-
readonly label: "Anthropic";
|
|
11
|
-
}, {
|
|
12
|
-
readonly value: "google";
|
|
13
|
-
readonly label: "Google";
|
|
14
|
-
}, {
|
|
15
|
-
readonly value: "custom";
|
|
16
|
-
readonly label: "Custom provider";
|
|
17
|
-
}];
|
|
6
|
+
export { chatV2ProviderOptions };
|
|
18
7
|
export declare const openAIReasoningEffortOptions: {
|
|
19
8
|
value: string;
|
|
20
9
|
label: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Inputs } from '../GraphProcessor.js';
|
|
2
2
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
3
|
-
export type ClassifierApiKeySource = 'configured' | 'input';
|
|
3
|
+
export type ClassifierApiKeySource = 'configured' | 'classifier-settings' | 'input';
|
|
4
|
+
export declare class ClassifierCredentialMissingError extends Error {
|
|
5
|
+
}
|
|
4
6
|
export type ClassifierCredentialNames = {
|
|
5
7
|
programmaticName: string;
|
|
6
8
|
environmentVariableName: string;
|
|
@@ -9,6 +11,10 @@ export type ClassifierProviderCredentials = Record<string, {
|
|
|
9
11
|
apiKey?: string | undefined;
|
|
10
12
|
}>;
|
|
11
13
|
export declare const JEV_DEFAULT_CREDENTIAL_NAMES: ClassifierCredentialNames;
|
|
14
|
+
export declare const LIQUID_DEFAULT_CREDENTIAL_NAMES: ClassifierCredentialNames;
|
|
15
|
+
export declare const OPENAI_DEFAULT_CREDENTIAL_NAMES: ClassifierCredentialNames;
|
|
16
|
+
export declare const OPENROUTER_DEFAULT_CREDENTIAL_NAMES: ClassifierCredentialNames;
|
|
17
|
+
export declare const PERPLEXITY_DEFAULT_CREDENTIAL_NAMES: ClassifierCredentialNames;
|
|
12
18
|
export declare function isValidClassifierProgrammaticCredentialName(name: string): boolean;
|
|
13
19
|
export declare function isValidClassifierEnvironmentCredentialName(name: string): boolean;
|
|
14
20
|
export declare function normalizeClassifierCredentialNames(value: unknown, defaults?: ClassifierCredentialNames): ClassifierCredentialNames;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ClassifierPreparationCheck } from './limits.js';
|
|
2
|
+
type ImageInfo = {
|
|
3
|
+
mediaType: string;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
export type PreparedClassifierImage = ImageInfo & {
|
|
8
|
+
dataUrl: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function prepareNativeClassifierImage(value: unknown, check?: ClassifierPreparationCheck): PreparedClassifierImage;
|
|
11
|
+
export declare function nativeClassifierImage(value: unknown, check?: ClassifierPreparationCheck): string;
|
|
12
|
+
export declare function inspectClassifierImage(value: unknown, check?: ClassifierPreparationCheck): ImageInfo;
|
|
13
|
+
/** Recognize image bytes, not merely strings using the base64 alphabet. */
|
|
14
|
+
export declare function classifierImageFromText(value: string, check?: ClassifierPreparationCheck): string | undefined;
|
|
15
|
+
export declare function prepareClassifierImageText(value: string, check?: ClassifierPreparationCheck): PreparedClassifierImage | undefined;
|
|
16
|
+
export declare function assertClassifierImages(value: unknown, check?: ClassifierPreparationCheck): asserts value is string[];
|
|
17
|
+
export declare function assertLiquidImageLimits(images: readonly PreparedClassifierImage[], check?: ClassifierPreparationCheck): void;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ClassifierEntry } from './types.js';
|
|
2
|
+
import type { DataValue } from '../DataValue.js';
|
|
3
|
+
import type { Inputs } from '../GraphProcessor.js';
|
|
4
|
+
import { ClassifierValueBudget, type ClassifierPreparationCheck } from './limits.js';
|
|
5
|
+
/** Read evidence fields without invoking getters or accepting prototype-provided content. */
|
|
6
|
+
export declare function classifierDataProperty(value: object, key: string, label?: string): unknown;
|
|
7
|
+
/** Snapshot only the selected port's wrapper; never read unrelated input getters. */
|
|
8
|
+
export declare function classifierInputDataValue(inputs: Inputs, port: string): DataValue | undefined;
|
|
9
|
+
/** Match JSON array order; never invoke a caller-provided iterator or index getter. */
|
|
10
|
+
export declare function classifierArrayValues(value: readonly unknown[], label: string): Generator<unknown>;
|
|
11
|
+
/** Validate the data JSON.stringify will read, without invoking property getters or array iterators. */
|
|
12
|
+
export declare function assertClassifierJson(value: unknown, label?: string, allowUndefinedProperties?: boolean, check?: ClassifierPreparationCheck, maxBytes?: number): number;
|
|
13
|
+
/** Validate, account and detach JSON in one bounded walk, without serialization hooks. */
|
|
14
|
+
export declare function snapshotClassifierJson(value: unknown, label: string, budget: ClassifierValueBudget, allowUndefinedProperties?: boolean): unknown;
|
|
15
|
+
/** Root entry kinds are narrower than the JSON values allowed inside structured entries. */
|
|
16
|
+
export declare function assertClassifierEntryKind(value: unknown, label: string): asserts value is ClassifierEntry;
|
|
17
|
+
export declare function assertClassifierEntry(value: unknown, label: string): asserts value is ClassifierEntry;
|
|
18
|
+
export declare function assertClassifierInstructionsKind(value: unknown, label?: string): asserts value is Exclude<ClassifierEntry, null>;
|
|
19
|
+
export declare function assertClassifierInstructions(value: unknown, label?: string): asserts value is Exclude<ClassifierEntry, null>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Core safety limits, not provider capacity claims. Stricter provider limits still apply. */
|
|
2
|
+
export declare const CLASSIFIER_LIMITS: {
|
|
3
|
+
readonly requestBytes: number;
|
|
4
|
+
readonly responseBytes: number;
|
|
5
|
+
readonly depth: 64;
|
|
6
|
+
readonly values: 100000;
|
|
7
|
+
readonly questions: 1000;
|
|
8
|
+
readonly messages: 1024;
|
|
9
|
+
readonly parts: 4096;
|
|
10
|
+
};
|
|
11
|
+
export type ClassifierPreparationCheck = () => void;
|
|
12
|
+
export declare class ClassifierResourceLimitError extends Error {
|
|
13
|
+
}
|
|
14
|
+
/** Receipt failed before JSON decoding/validation, rather than malformed evidence. */
|
|
15
|
+
export declare class ClassifierResponseReadError extends Error {
|
|
16
|
+
}
|
|
17
|
+
/** A plain view uses real byte geometry and cannot execute authored byte accessors/methods. */
|
|
18
|
+
export declare function classifierByteView(value: Uint8Array): Uint8Array;
|
|
19
|
+
export declare function classifierPreparationCheck(signal: AbortSignal, deadline: number, timeoutMs?: number): ClassifierPreparationCheck;
|
|
20
|
+
/** Bound expanded work before JSON serialization or image encoding, without reading getters. */
|
|
21
|
+
export declare function assertClassifierResourceLimits(value: unknown, check?: ClassifierPreparationCheck, maxBytes?: number): number;
|
|
22
|
+
/** One traversal can account, validate plain JSON, and detach it before IO. */
|
|
23
|
+
export declare class ClassifierValueBudget {
|
|
24
|
+
readonly check: ClassifierPreparationCheck;
|
|
25
|
+
private bytes;
|
|
26
|
+
private values;
|
|
27
|
+
private readonly maxBytes;
|
|
28
|
+
constructor(check?: ClassifierPreparationCheck, maxBytes?: number);
|
|
29
|
+
get remainingBytes(): number;
|
|
30
|
+
private add;
|
|
31
|
+
private string;
|
|
32
|
+
private value;
|
|
33
|
+
inspect(value: unknown, json?: {
|
|
34
|
+
label: string;
|
|
35
|
+
allowUndefinedProperties?: boolean;
|
|
36
|
+
copy?: boolean;
|
|
37
|
+
}): {
|
|
38
|
+
value: unknown;
|
|
39
|
+
bytes: number;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Bound parser allocation without interpreting brackets or separators inside strings. */
|
|
43
|
+
export declare function checkClassifierJsonWork(text: string, check: ClassifierPreparationCheck, label?: string): void;
|
|
44
|
+
/** Consume decoded response bytes incrementally; Content-Length is not trusted. */
|
|
45
|
+
export declare function readClassifierResponse(response: Response, signal: AbortSignal, check?: ClassifierPreparationCheck, onBody?: (body: unknown) => void): Promise<unknown>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ClassifierEvaluationResponse, PreparedClassifierQuestion } from './types.js';
|
|
2
|
+
import type { PreparedClassifierEvaluation } from './providers.js';
|
|
3
|
+
/** OpenAI's Decisions schema is not the System One protocol. */
|
|
4
|
+
export declare function createOpenAIDecisionRequest(args: PreparedClassifierEvaluation): Record<string, unknown>;
|
|
5
|
+
export declare function validateOpenAIDecisionResponse(body: unknown, questions: readonly PreparedClassifierQuestion[], providerLabel?: string): ClassifierEvaluationResponse;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PreparedClassifierEvaluation } from './providers.js';
|
|
2
|
+
import { type PreparedClassifierState } from './state.js';
|
|
3
|
+
export declare const PERPLEXITY_DECISION_MODELS: string[];
|
|
4
|
+
/** Native inline image parts; a top-level images field is not accepted. */
|
|
5
|
+
export declare function perplexityDecisionState(state: PreparedClassifierState): unknown;
|
|
6
|
+
/** Provider capability limits, not shared input errors or provider outages. */
|
|
7
|
+
export declare function assertPerplexityDecisionLimits({ model, state, questions }: PreparedClassifierEvaluation, check: () => void): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { InterpolationGuard } from '../../utils/interpolation.js';
|
|
2
|
+
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
3
|
+
/** One cumulative budget for authored templates, referenced values and resolved entries. */
|
|
4
|
+
export declare class ClassifierQuestionPreparation implements InterpolationGuard {
|
|
5
|
+
readonly tokenLimit: 100000;
|
|
6
|
+
private readonly budget;
|
|
7
|
+
private operations;
|
|
8
|
+
private readonly deadlineCheck;
|
|
9
|
+
constructor(context: Pick<InternalProcessContext, 'signal'>);
|
|
10
|
+
check: () => void;
|
|
11
|
+
capture(value: unknown): void;
|
|
12
|
+
prepareValue: (value: unknown) => unknown;
|
|
13
|
+
private inspect;
|
|
14
|
+
output: (fragment: string, previousLength: number) => void;
|
|
15
|
+
processing: (input: string, name: string, parameter: number | undefined) => void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { NodeId } from '../NodeBase.js';
|
|
2
|
+
import type { ProjectId } from '../Project.js';
|
|
3
|
+
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
4
|
+
import type { Inputs } from '../GraphProcessor.js';
|
|
5
|
+
import { type ClassifierPreparationCheck } from './limits.js';
|
|
6
|
+
import { type ClassifierApiKeySource, type ClassifierCredentialNames } from './credentials.js';
|
|
7
|
+
import type { RivetLLMProfileCircuitBreakerPolicy, RivetLLMProfileHealthIdentity } from '../chat-v2/llmProfileHealthStore.js';
|
|
8
|
+
export type ClassifierProfileConfiguration = {
|
|
9
|
+
provider?: string;
|
|
10
|
+
model?: string;
|
|
11
|
+
useModelInput?: boolean;
|
|
12
|
+
apiKeySource?: ClassifierApiKeySource;
|
|
13
|
+
apiKeyNamesByProvider?: Record<string, ClassifierCredentialNames | undefined>;
|
|
14
|
+
apiKeyNames?: ClassifierCredentialNames;
|
|
15
|
+
responseTimeoutMs?: number;
|
|
16
|
+
enableCircuitBreaker?: boolean;
|
|
17
|
+
circuitBreakerFailureThreshold?: number;
|
|
18
|
+
circuitBreakerFailureWindowMs?: number;
|
|
19
|
+
circuitBreakerOpenDurationMs?: number;
|
|
20
|
+
};
|
|
21
|
+
/** Resolved, sensitive runtime value, never a persisted API key in node settings. */
|
|
22
|
+
export type ClassifierProfileValue = {
|
|
23
|
+
version: 1;
|
|
24
|
+
configuration: ClassifierProfileConfiguration & {
|
|
25
|
+
provider: string;
|
|
26
|
+
model: string;
|
|
27
|
+
};
|
|
28
|
+
credential: {
|
|
29
|
+
value?: string;
|
|
30
|
+
};
|
|
31
|
+
profileName?: string;
|
|
32
|
+
sourceNodeId?: NodeId;
|
|
33
|
+
};
|
|
34
|
+
export declare const DEFAULT_CLASSIFIER_PROFILE_RESPONSE_TIMEOUT_MS = 500;
|
|
35
|
+
export declare const DEFAULT_CLASSIFIER_PROFILE_FAILURE_THRESHOLD = 3;
|
|
36
|
+
export declare const DEFAULT_CLASSIFIER_PROFILE_FAILURE_WINDOW_MS = 300000;
|
|
37
|
+
export declare const DEFAULT_CLASSIFIER_PROFILE_OPEN_DURATION_MS = 300000;
|
|
38
|
+
export declare const classifierProfileInputIds: readonly ["model", "apiKey"];
|
|
39
|
+
export declare const classifierProfileDataKeys: readonly ["provider", "model", "useModelInput", "apiKeySource", "apiKeyNamesByProvider", "apiKeyNames", "responseTimeoutMs", "enableCircuitBreaker", "circuitBreakerFailureThreshold", "circuitBreakerFailureWindowMs", "circuitBreakerOpenDurationMs"];
|
|
40
|
+
export declare function pickClassifierProfileData(data: ClassifierProfileConfiguration): ClassifierProfileConfiguration;
|
|
41
|
+
export declare function classifierProfileResponseTimeout(configuration: ClassifierProfileConfiguration): number;
|
|
42
|
+
export declare function classifierProfileHealthPolicy(configuration: ClassifierProfileConfiguration): RivetLLMProfileCircuitBreakerPolicy | undefined;
|
|
43
|
+
export declare function normalizeClassifierProfileValue(value: unknown): ClassifierProfileValue;
|
|
44
|
+
export declare function normalizeClassifierProfiles(value: unknown, check?: ClassifierPreparationCheck): ClassifierProfileValue[];
|
|
45
|
+
export declare function resolveClassifierProfile(data: ClassifierProfileConfiguration, inputs: Inputs, context: InternalProcessContext): ClassifierProfileValue;
|
|
46
|
+
export declare function classifierProfileHealthIdentity(profile: ClassifierProfileValue, projectId: ProjectId, fallbackNodeId: NodeId): RivetLLMProfileHealthIdentity;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
2
|
+
import type { NodeId } from '../NodeBase.js';
|
|
3
|
+
import { type LLMAttempt } from '../chat-v2/llmProfileFallback.js';
|
|
4
|
+
import { getClassifierProvider, type ClassifierProviderEvaluationResult, type ClassifierProviderEvaluateArgs } from './providers.js';
|
|
5
|
+
import { type ClassifierProfileValue } from './profile.js';
|
|
6
|
+
import type { ClassifierState } from './state.js';
|
|
7
|
+
import type { ClassifierQuestionDefinition } from './types.js';
|
|
8
|
+
export declare function classifierProfileSummary(profiles: readonly ClassifierProfileValue[], attempts: readonly LLMAttempt[]): string;
|
|
9
|
+
export declare class ClassifierProfileExhaustedError extends Error {
|
|
10
|
+
readonly attempts: readonly LLMAttempt[];
|
|
11
|
+
readonly summary: string;
|
|
12
|
+
readonly statusCode?: number | undefined;
|
|
13
|
+
constructor(attempts: readonly LLMAttempt[], summary: string, options?: ErrorOptions, statusCode?: number | undefined);
|
|
14
|
+
}
|
|
15
|
+
export declare function runClassifierProfiles(input: {
|
|
16
|
+
profiles: readonly ClassifierProfileValue[];
|
|
17
|
+
state: ClassifierState;
|
|
18
|
+
questions: ClassifierQuestionDefinition[];
|
|
19
|
+
context: InternalProcessContext;
|
|
20
|
+
nodeId: NodeId;
|
|
21
|
+
deadline: number;
|
|
22
|
+
retryOnNon200?: boolean;
|
|
23
|
+
retryOnNon200RepeatTimes?: number;
|
|
24
|
+
retryOnNon200CooldownMs?: number;
|
|
25
|
+
onAttempt: (attempt: LLMAttempt) => void;
|
|
26
|
+
onRequestBody?: ClassifierProviderEvaluateArgs['onRequestBody'];
|
|
27
|
+
onResponseBody?: ClassifierProviderEvaluateArgs['onResponseBody'];
|
|
28
|
+
}): Promise<{
|
|
29
|
+
result: ClassifierProviderEvaluationResult;
|
|
30
|
+
provider: ReturnType<typeof getClassifierProvider>;
|
|
31
|
+
model: string;
|
|
32
|
+
}>;
|