@valerypopoff/rivet2-core 2.1.7 → 2.1.9

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.
Files changed (115) hide show
  1. package/dist/cjs/bundle.cjs +4911 -2546
  2. package/dist/cjs/bundle.cjs.map +4 -4
  3. package/dist/esm/api/createProcessor.js +45 -4
  4. package/dist/esm/exports.js +2 -0
  5. package/dist/esm/integrations/KnowledgeStoreFieldPolicy.js +216 -0
  6. package/dist/esm/integrations/KnowledgeStoreProvider.js +14 -90
  7. package/dist/esm/integrations/ManagedKnowledgeStore.js +0 -8
  8. package/dist/esm/model/DataBusPorts.js +26 -0
  9. package/dist/esm/model/DataBusTopology.js +207 -0
  10. package/dist/esm/model/DataValue.js +22 -7
  11. package/dist/esm/model/GraphPreprocessor.js +9 -3
  12. package/dist/esm/model/GraphProcessor.js +164 -366
  13. package/dist/esm/model/NodeIO.js +1 -0
  14. package/dist/esm/model/NodePrefabResolver.js +16 -0
  15. package/dist/esm/model/Nodes.js +7 -0
  16. package/dist/esm/model/SplitRunProcessor.js +19 -10
  17. package/dist/esm/model/ToolCallContinuationBranchPlanner.js +165 -0
  18. package/dist/esm/model/ToolCallContinuationCoordinator.js +206 -0
  19. package/dist/esm/model/chat/aiSdkMessages.js +8 -0
  20. package/dist/esm/model/chat-v2/chatV2CallObserver.js +142 -0
  21. package/dist/esm/model/chat-v2/chatV2EditorCache.js +22 -0
  22. package/dist/esm/model/chat-v2/chatV2Errors.js +23 -6
  23. package/dist/esm/model/chat-v2/chatV2Outputs.js +41 -31
  24. package/dist/esm/model/chat-v2/chatV2Pipeline.js +167 -56
  25. package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +1 -0
  26. package/dist/esm/model/chat-v2/chatV2ProviderTypes.js +1 -0
  27. package/dist/esm/model/chat-v2/chatV2RequestPlan.js +6 -5
  28. package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +2 -2
  29. package/dist/esm/model/chat-v2/chatV2Shared.js +1 -6
  30. package/dist/esm/model/chat-v2/chatV2Types.js +11 -1
  31. package/dist/esm/model/chat-v2/developerMessageRoles.js +45 -0
  32. package/dist/esm/model/chat-v2/index.js +1 -0
  33. package/dist/esm/model/chat-v2/llmChatV2NodeData.js +53 -3
  34. package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +53 -19
  35. package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +232 -68
  36. package/dist/esm/model/chat-v2/llmProfile.js +212 -0
  37. package/dist/esm/model/chat-v2/llmProfileFallback.js +288 -0
  38. package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +73 -0
  39. package/dist/esm/model/chat-v2/llmProfileTypes.js +45 -0
  40. package/dist/esm/model/chat-v2/messageConverter.js +14 -0
  41. package/dist/esm/model/chat-v2/providerOptions.js +44 -11
  42. package/dist/esm/model/chat-v2/toolContinuation.js +0 -4
  43. package/dist/esm/model/nodes/AssembleMessageNode.js +6 -0
  44. package/dist/esm/model/nodes/DataBusNode.js +81 -0
  45. package/dist/esm/model/nodes/DelegateFunctionCallNode.js +12 -0
  46. package/dist/esm/model/nodes/GetGlobalNode.js +7 -11
  47. package/dist/esm/model/nodes/GetKnowledgeSourceStatusNode.js +1 -1
  48. package/dist/esm/model/nodes/LLMChatV2Node.js +156 -18
  49. package/dist/esm/model/nodes/LLMProfileNode.js +132 -0
  50. package/dist/esm/model/nodes/PassthroughNode.js +1 -11
  51. package/dist/esm/model/nodes/PromptNode.js +9 -2
  52. package/dist/esm/model/nodes/SearchKnowledgeNode.js +1 -1
  53. package/dist/esm/model/nodes/SetGlobalNode.js +6 -6
  54. package/dist/esm/model/nodes/SyncKnowledgeSourceNode.js +0 -1
  55. package/dist/esm/model/nodes/toolCallDelegation.js +31 -4
  56. package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +22 -28
  57. package/dist/esm/plugins/google/google.js +20 -9
  58. package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +17 -6
  59. package/dist/esm/plugins/pinecone/PineconeKnowledgeStore.js +0 -4
  60. package/dist/esm/plugins/pinecone/plugin.js +1 -1
  61. package/dist/esm/utils/chatMessageToOpenAIChatCompletionMessage.js +4 -0
  62. package/dist/esm/utils/coerceType.js +84 -41
  63. package/dist/esm/utils/expectType.js +45 -8
  64. package/dist/esm/utils/fetchEventSource.js +18 -0
  65. package/dist/esm/utils/serialization/serialization.js +37 -7
  66. package/dist/esm/vendor/fnv1a.js +6 -3
  67. package/dist/types/api/createProcessor.d.ts +2 -0
  68. package/dist/types/exports.d.ts +2 -0
  69. package/dist/types/integrations/KnowledgeStore.d.ts +0 -2
  70. package/dist/types/integrations/KnowledgeStoreFieldPolicy.d.ts +38 -0
  71. package/dist/types/integrations/KnowledgeStoreProvider.d.ts +6 -3
  72. package/dist/types/model/DataBusPorts.d.ts +6 -0
  73. package/dist/types/model/DataBusTopology.d.ts +16 -0
  74. package/dist/types/model/DataValue.d.ts +22 -6
  75. package/dist/types/model/GraphPreprocessor.d.ts +2 -1
  76. package/dist/types/model/GraphProcessor.d.ts +4 -3
  77. package/dist/types/model/NodeBase.d.ts +6 -0
  78. package/dist/types/model/NodeIO.d.ts +5 -0
  79. package/dist/types/model/NodePrefabResolver.d.ts +9 -0
  80. package/dist/types/model/Nodes.d.ts +5 -2
  81. package/dist/types/model/ProcessContext.d.ts +64 -0
  82. package/dist/types/model/SplitRunProcessor.d.ts +2 -1
  83. package/dist/types/model/ToolCallContinuationBranchPlanner.d.ts +43 -0
  84. package/dist/types/model/ToolCallContinuationCoordinator.d.ts +70 -0
  85. package/dist/types/model/chat-v2/chatV2CallObserver.d.ts +10 -0
  86. package/dist/types/model/chat-v2/chatV2EditorCache.d.ts +4 -0
  87. package/dist/types/model/chat-v2/chatV2Outputs.d.ts +5 -5
  88. package/dist/types/model/chat-v2/chatV2Pipeline.d.ts +33 -0
  89. package/dist/types/model/chat-v2/chatV2ProviderProfile.d.ts +1 -0
  90. package/dist/types/model/chat-v2/chatV2ProviderTypes.d.ts +1 -0
  91. package/dist/types/model/chat-v2/chatV2RequestPlan.d.ts +2 -2
  92. package/dist/types/model/chat-v2/chatV2RuntimeOptions.d.ts +8 -0
  93. package/dist/types/model/chat-v2/chatV2Shared.d.ts +0 -1
  94. package/dist/types/model/chat-v2/chatV2Types.d.ts +27 -3
  95. package/dist/types/model/chat-v2/developerMessageRoles.d.ts +10 -0
  96. package/dist/types/model/chat-v2/index.d.ts +1 -0
  97. package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +10 -1
  98. package/dist/types/model/chat-v2/llmChatV2NodeEditors.d.ts +5 -1
  99. package/dist/types/model/chat-v2/llmChatV2NodeRuntime.d.ts +18 -2
  100. package/dist/types/model/chat-v2/llmProfile.d.ts +10 -0
  101. package/dist/types/model/chat-v2/llmProfileFallback.d.ts +79 -0
  102. package/dist/types/model/chat-v2/llmProfileNodeRuntime.d.ts +9 -0
  103. package/dist/types/model/chat-v2/llmProfileTypes.d.ts +18 -0
  104. package/dist/types/model/chat-v2/providerOptions.d.ts +1 -0
  105. package/dist/types/model/nodes/AssembleMessageNode.d.ts +2 -1
  106. package/dist/types/model/nodes/DataBusNode.d.ts +19 -0
  107. package/dist/types/model/nodes/LLMProfileNode.d.ts +20 -0
  108. package/dist/types/model/nodes/PassthroughNode.d.ts +2 -15
  109. package/dist/types/model/nodes/PromptNode.d.ts +2 -2
  110. package/dist/types/model/nodes/SetGlobalNode.d.ts +2 -2
  111. package/dist/types/model/nodes/toolCallDelegation.d.ts +9 -0
  112. package/dist/types/plugins/google/google.d.ts +12 -1
  113. package/dist/types/plugins/google/nodes/ChatGoogleNode.d.ts +2 -1
  114. package/dist/types/vendor/fnv1a.d.ts +5 -5
  115. package/package.json +1 -1
@@ -2,8 +2,8 @@ import type { LanguageModelUsage } from 'ai';
2
2
  import type { ChatMessage } from '../DataValue.js';
3
3
  import type { Outputs } from '../GraphProcessor.js';
4
4
  import { type StreamedFunctionCall } from '../chat/streamChatResponse.js';
5
- import type { ChatV2NormalizedUsage, ChatV2ReasoningOutput, RunChatV2PipelineOptions } from './chatV2Types.js';
6
- type ChatV2CommonOutputOptions = Pick<RunChatV2PipelineOptions, 'outputUsage' | 'outputReasoning' | 'outputRequestStatus' | 'includeFunctionCalls' | 'functionCallMode' | 'retryOnNon200' | 'responseFormat'>;
5
+ import { type ChatV2NormalizedUsage, type ChatV2ReasoningOutput, type RunChatV2PipelineOptions } from './chatV2Types.js';
6
+ type ChatV2CommonOutputOptions = Pick<RunChatV2PipelineOptions, 'outputUsage' | 'outputReasoning' | 'outputRequestStatus' | 'outputRequestError' | 'outputRequestBody' | 'includeFunctionCalls' | 'functionCallMode' | 'retryOnNon200' | 'responseFormat'>;
7
7
  type CreateChatV2CommonOutputsOptions = ChatV2CommonOutputOptions & {
8
8
  requestMessages: ChatMessage[];
9
9
  response: string;
@@ -17,7 +17,7 @@ type CreateChatV2CommonOutputsOptions = ChatV2CommonOutputOptions & {
17
17
  requestErrors: string[];
18
18
  requestBodies?: unknown[] | undefined;
19
19
  };
20
- type CreateChatV2ProviderFailureOutputsOptions = Pick<RunChatV2PipelineOptions, 'outputUsage' | 'outputReasoning' | 'includeFunctionCalls' | 'retryOnNon200'> & {
20
+ type CreateChatV2ProviderFailureOutputsOptions = Pick<RunChatV2PipelineOptions, 'outputUsage' | 'outputReasoning' | 'outputRequestStatus' | 'outputRequestError' | 'outputRequestBody' | 'includeFunctionCalls' | 'retryOnNon200'> & {
21
21
  requestMessages: ChatMessage[];
22
22
  responseStatus: number | undefined;
23
23
  responseError: string;
@@ -26,6 +26,6 @@ type CreateChatV2ProviderFailureOutputsOptions = Pick<RunChatV2PipelineOptions,
26
26
  requestBodies?: unknown[] | undefined;
27
27
  };
28
28
  export declare function normalizeChatV2Usage(usage: LanguageModelUsage | undefined, options: Pick<RunChatV2PipelineOptions, 'provider' | 'modelId'>): ChatV2NormalizedUsage | undefined;
29
- export declare function createChatV2CommonOutputs({ requestMessages, response, structuredOutput, functionCalls, usage, reasoning, requestStatus, responseError, requestStatuses, requestErrors, requestBodies, outputUsage, outputReasoning, outputRequestStatus, includeFunctionCalls, functionCallMode, retryOnNon200, responseFormat, }: CreateChatV2CommonOutputsOptions): Outputs;
30
- export declare function createChatV2ProviderFailureOutputs({ requestMessages, responseStatus, responseError, requestStatuses, requestErrors, requestBodies, outputUsage, outputReasoning, includeFunctionCalls, retryOnNon200, }: CreateChatV2ProviderFailureOutputsOptions): Outputs;
29
+ export declare function createChatV2CommonOutputs({ requestMessages, response, structuredOutput, functionCalls, usage, reasoning, requestStatus, responseError, requestStatuses, requestErrors, requestBodies, outputUsage, outputReasoning, outputRequestStatus, outputRequestError, outputRequestBody, includeFunctionCalls, functionCallMode, retryOnNon200, responseFormat, }: CreateChatV2CommonOutputsOptions): Outputs;
30
+ export declare function createChatV2ProviderFailureOutputs({ requestMessages, responseStatus, responseError, requestStatuses, requestErrors, requestBodies, outputUsage, outputReasoning, outputRequestStatus, outputRequestError, outputRequestBody, includeFunctionCalls, retryOnNon200, }: CreateChatV2ProviderFailureOutputsOptions): Outputs;
31
31
  export {};
@@ -1,2 +1,35 @@
1
+ import type { ChatMessage } from '../DataValue.js';
1
2
  import type { ChatV2PipelineResult, RunChatV2PipelineOptions } from './chatV2Types.js';
3
+ import { type ChatV2RequestPlan } from './chatV2RequestPlan.js';
4
+ export type ChatV2PipelineProviderFailure = {
5
+ requestMessages: ChatMessage[];
6
+ options: RunChatV2PipelineOptions;
7
+ plan: ChatV2RequestPlan;
8
+ normalizedError: unknown;
9
+ rawError: unknown;
10
+ requestStatuses: number[];
11
+ requestErrors: string[];
12
+ /** A completed non-200 custom stream may still have a useful response body. */
13
+ diagnosticResult?: ChatV2PipelineResult;
14
+ };
15
+ export type ChatV2PipelineExecution = {
16
+ outcome: 'success';
17
+ result: ChatV2PipelineResult;
18
+ } | {
19
+ outcome: 'provider-failure';
20
+ failure: ChatV2PipelineProviderFailure;
21
+ };
22
+ /**
23
+ * Runs one provider/model round without deciding whether a provider failure
24
+ * should become diagnostic outputs or should advance an LLM Profile fallback
25
+ * chain. Shared prompt/schema/tool construction errors deliberately continue
26
+ * to throw: they are graph configuration errors, not a profile failure.
27
+ */
28
+ export declare function runChatV2PipelineExecution(options: RunChatV2PipelineOptions): Promise<ChatV2PipelineExecution>;
29
+ /**
30
+ * Retains the established single-profile behavior: request-detail mode can
31
+ * turn a provider failure into normal excluded outputs; otherwise it remains
32
+ * a thrown normalized provider error.
33
+ */
34
+ export declare function materializeChatV2PipelineFailure(failure: ChatV2PipelineProviderFailure): ChatV2PipelineResult;
2
35
  export declare function runChatV2Pipeline(options: RunChatV2PipelineOptions): Promise<ChatV2PipelineResult>;
@@ -38,6 +38,7 @@ export declare function createResolvedChatV2Provider(options: {
38
38
  headers?: Record<string, string> | undefined;
39
39
  credential: ChatV2CredentialResult;
40
40
  onRequestBody?: CreateChatV2ModelOptions['onRequestBody'];
41
+ transformRequestBody?: CreateChatV2ModelOptions['transformRequestBody'];
41
42
  }): Promise<{
42
43
  profile: ChatV2ProviderProfile;
43
44
  model: ChatV2Model;
@@ -0,0 +1 @@
1
+ export type ChatV2Provider = 'openai' | 'anthropic' | 'google' | 'custom';
@@ -10,9 +10,9 @@ export type ChatV2RequestPlan = {
10
10
  cooldownMs: number;
11
11
  };
12
12
  request: Omit<StreamChatV2Options, 'abortSignal' | 'executeStream' | 'executeGenerate' | 'onPartialOutput'>;
13
- output: Pick<RunChatV2PipelineOptions, 'outputUsage' | 'outputReasoning' | 'outputRequestStatus' | 'includeFunctionCalls' | 'functionCallMode'>;
13
+ output: Pick<RunChatV2PipelineOptions, 'outputUsage' | 'outputReasoning' | 'outputRequestStatus' | 'outputRequestError' | 'outputRequestBody' | 'includeFunctionCalls' | 'functionCallMode'>;
14
14
  };
15
- type BuildChatV2RequestPlanOptions = Pick<RunChatV2PipelineOptions, 'provider' | 'model' | 'modelId' | 'maxTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'responseOutput' | 'responseFormat' | 'providerOptions' | 'toolChoice' | 'retryOnNon200' | 'retryOnNon200RepeatTimes' | 'retryOnNon200CooldownMs' | 'outputUsage' | 'outputReasoning' | 'outputRequestStatus' | 'includeFunctionCalls' | 'emitPartialOutputs' | 'functionCallMode'> & {
15
+ type BuildChatV2RequestPlanOptions = Pick<RunChatV2PipelineOptions, 'provider' | 'model' | 'modelId' | 'maxTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'responseOutput' | 'responseFormat' | 'providerOptions' | 'toolChoice' | 'retryOnNon200' | 'retryOnNon200RepeatTimes' | 'retryOnNon200CooldownMs' | 'outputUsage' | 'outputReasoning' | 'outputRequestStatus' | 'outputRequestError' | 'outputRequestBody' | 'includeFunctionCalls' | 'emitPartialOutputs' | 'functionCallMode'> & {
16
16
  messages: ChatV2MessageList;
17
17
  tools?: ChatV2ToolSet | undefined;
18
18
  };
@@ -4,9 +4,17 @@ import type { ResolvedChatV2ProviderConfig } from './providerOptions.js';
4
4
  import type { ChatV2ProviderOptions, ChatV2ToolChoice, ChatV2ToolSet, RunChatV2PipelineOptions } from './chatV2Types.js';
5
5
  import type { LLMChatV2NodeData } from './llmChatV2NodeData.js';
6
6
  export type LLMChatV2GenerationParameters = Pick<RunChatV2PipelineOptions, 'maxTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed'>;
7
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
8
+ [key: string]: JsonValue | undefined;
9
+ };
10
+ type JsonObject = {
11
+ [key: string]: JsonValue | undefined;
12
+ };
7
13
  export declare function resolveLLMChatV2Headers(data: LLMChatV2NodeData, inputs: Inputs): Record<string, string> | undefined;
8
14
  export declare function resolveLLMChatV2ApiKey(data: LLMChatV2NodeData, inputs: Inputs, context: Pick<InternalProcessContext, 'getPluginConfig' | 'settings'>): string | undefined;
15
+ export declare function resolveLLMChatV2ExtraProviderOptions(data: LLMChatV2NodeData, inputs: Inputs): JsonObject | undefined;
9
16
  export declare function resolveLLMChatV2RuntimeProviderOptions(data: LLMChatV2NodeData, inputs: Inputs): ChatV2ProviderOptions | undefined;
10
17
  export declare function resolveLLMChatV2ToolChoice(data: LLMChatV2NodeData): ChatV2ToolChoice | undefined;
11
18
  export declare function resolveLLMChatV2GenerationParameters(data: LLMChatV2NodeData, inputs: Inputs): LLMChatV2GenerationParameters;
12
19
  export declare function resolveLLMChatV2BuiltInTools(data: LLMChatV2NodeData, context: Pick<InternalProcessContext, 'getPluginConfig' | 'settings'>, config: ResolvedChatV2ProviderConfig, apiKey: string | undefined): ChatV2ToolSet | undefined;
20
+ export {};
@@ -39,7 +39,6 @@ export type CommonChatV2OutputOptions = {
39
39
  inMessagesPortId?: PortId;
40
40
  allMessagesPortId?: PortId;
41
41
  functionCallsPortId?: PortId;
42
- responseTokensPortId?: PortId;
43
42
  usagePortId?: PortId;
44
43
  reasoningPortId?: PortId;
45
44
  includeFunctionCalls?: boolean;
@@ -3,10 +3,11 @@ import type { ChatMessage, GptFunction } from '../DataValue.js';
3
3
  import type { Outputs } from '../GraphProcessor.js';
4
4
  import type { InternalProcessContext } from '../ProcessContext.js';
5
5
  import type { AssistantMessageFunctionCallMode, StreamedFunctionCall } from '../chat/streamChatResponse.js';
6
+ import type { ChatV2Provider } from './chatV2ProviderTypes.js';
7
+ export type { ChatV2Provider };
6
8
  type StreamTextArgs = Parameters<typeof streamText>[0];
7
9
  type GenerateTextArgs = Parameters<typeof generateText>[0];
8
10
  type MaybePromiseLike<T> = T | PromiseLike<T>;
9
- export type ChatV2Provider = 'openai' | 'anthropic' | 'google' | 'custom';
10
11
  export type ChatV2Model = StreamTextArgs['model'];
11
12
  export type ChatV2ProviderOptions = StreamTextArgs['providerOptions'];
12
13
  export type ChatV2ToolSet = NonNullable<StreamTextArgs['tools']>;
@@ -113,16 +114,40 @@ export type RunChatV2PipelineOptions = {
113
114
  outputUsage?: boolean | undefined;
114
115
  outputReasoning?: boolean | undefined;
115
116
  outputRequestStatus?: boolean | undefined;
117
+ outputRequestError?: boolean | undefined;
118
+ outputRequestBody?: boolean | undefined;
116
119
  includeFunctionCalls?: boolean | undefined;
117
120
  emitPartialOutputs?: boolean | undefined;
118
121
  functionCallMode?: AssistantMessageFunctionCallMode | undefined;
119
122
  retryOnNon200?: boolean | undefined;
120
123
  retryOnNon200RepeatTimes?: number | undefined;
121
124
  retryOnNon200CooldownMs?: number | undefined;
122
- context: Pick<InternalProcessContext, 'signal' | 'onPartialOutputs'>;
125
+ /**
126
+ * Internal, privacy-bounded metadata for an ordered LLM Profile fallback
127
+ * chain. It is forwarded to physical-call observers but never sent to a
128
+ * provider.
129
+ */
130
+ profileIndex?: number | undefined;
131
+ roundIndex?: number | undefined;
132
+ /** Internal physical-call trace used by the LLM Profile fallback coordinator. */
133
+ onProviderAttempt?: ((attempt: ChatV2ProviderAttempt) => void) | undefined;
134
+ context: Pick<InternalProcessContext, 'signal' | 'onPartialOutputs'> & Partial<Pick<InternalProcessContext, 'node' | 'onChatV2CallFinished' | 'processId'>>;
123
135
  executeStream?: ChatV2StreamExecutor | undefined;
124
136
  executeGenerate?: ChatV2GenerateExecutor | undefined;
125
137
  };
138
+ /**
139
+ * Older LLM Chat nodes used Output request details as one switch for status,
140
+ * error, and request body. Keep that saved contract intact while newly saved
141
+ * nodes use the independent controls.
142
+ */
143
+ export declare function shouldOutputChatV2RequestError(options: Pick<RunChatV2PipelineOptions, 'outputRequestStatus' | 'outputRequestError'>): boolean;
144
+ export declare function shouldOutputChatV2RequestBody(options: Pick<RunChatV2PipelineOptions, 'outputRequestStatus' | 'outputRequestBody'>): boolean;
145
+ export type ChatV2ProviderAttempt = {
146
+ attemptIndex: number;
147
+ outcome: 'success' | 'provider-failure';
148
+ status?: number | undefined;
149
+ error?: unknown;
150
+ };
126
151
  export type ChatV2PipelineResult = {
127
152
  commonOutputs: Outputs;
128
153
  requestMessages: ChatMessage[];
@@ -136,4 +161,3 @@ export type ChatV2PipelineResult = {
136
161
  providerMetadata: ChatV2ProviderMetadata | undefined;
137
162
  requestStatus: number | undefined;
138
163
  };
139
- export {};
@@ -0,0 +1,10 @@
1
+ import type { ChatMessage } from '../DataValue.js';
2
+ export type InstructionMessageRole = Extract<ChatMessage['type'], 'system' | 'developer'>;
3
+ export declare function getInstructionMessageRoles(messages: ChatMessage[]): InstructionMessageRole[];
4
+ /**
5
+ * AI SDK's provider-neutral ModelMessage represents both Rivet system and
6
+ * developer instructions with role `system`. Restore the explicit Rivet roles
7
+ * only at OpenAI-compatible wire boundaries, after the provider has built its
8
+ * request body.
9
+ */
10
+ export declare function restoreOpenAICompatibleInstructionRoles(body: unknown, roles: InstructionMessageRole[]): unknown;
@@ -6,6 +6,7 @@ export * from './chatV2RequestPlan.js';
6
6
  export * from './chatV2ResponseFormat.js';
7
7
  export * from './chatV2Shared.js';
8
8
  export * from './chatV2Types.js';
9
+ export * from './llmProfileTypes.js';
9
10
  export * from './messageConverter.js';
10
11
  export * from './modelRegistry.js';
11
12
  export * from './providerOptions.js';
@@ -4,7 +4,9 @@ import type { ChatV2Provider } from './chatV2Types.js';
4
4
  import type { ChartNode, NodeId } from '../NodeBase.js';
5
5
  export type LLMChatV2ToolChoiceMode = '' | 'auto' | 'function' | 'required';
6
6
  export type LLMChatV2ApiKeySource = 'environment' | 'input';
7
+ export type LLMChatV2ConfigurationMode = 'inline' | 'profile';
7
8
  export type LLMChatV2NodeConfigData = ChatV2CommonNodeData & {
9
+ configurationMode?: LLMChatV2ConfigurationMode;
8
10
  provider: ChatV2Provider;
9
11
  apiKeySource?: LLMChatV2ApiKeySource;
10
12
  customProviderApiKeyProgrammaticName?: string;
@@ -52,9 +54,14 @@ export type LLMChatV2NodeConfigData = ChatV2CommonNodeData & {
52
54
  retryOnNon200RepeatTimes?: number;
53
55
  retryOnNon200CooldownMs?: number;
54
56
  outputRequestStatus?: boolean;
57
+ outputRequestError?: boolean;
58
+ outputRequestBody?: boolean;
55
59
  };
56
60
  export type LLMChatV2NodeData = LLMChatV2NodeConfigData;
57
61
  export type LLMChatV2Node = ChartNode<'llmChatV2', LLMChatV2NodeData>;
62
+ export declare const llmChatV2ProfileDataKeys: readonly ["model", "useModelInput", "temperature", "useTemperatureInput", "topP", "useTopPInput", "topK", "useTopKInput", "presencePenalty", "usePresencePenaltyInput", "frequencyPenalty", "useFrequencyPenaltyInput", "stopSequences", "useStopSequencesInput", "seed", "useSeedInput", "maxTokens", "useMaxTokensInput", "provider", "apiKeySource", "customProviderApiKeyProgrammaticName", "customProviderApiKeyEnvVarName", "customProviderBaseURL", "useCustomProviderBaseURLInput", "headers", "useHeadersInput", "extraProviderOptions", "useExtraProviderOptionsInput", "openAIReasoningEffort", "openAIReasoningSummary", "openAIPreviousResponseId", "useOpenAIPreviousResponseIdInput", "enableOpenAIWebSearch", "openAIWebSearchContextSize", "enableOpenAICodeInterpreter", "anthropicThinkingMode", "anthropicThinkingBudget", "useAnthropicThinkingBudgetInput", "anthropicEffort", "anthropicCacheControlTtl", "googleThinkingBudget", "useGoogleThinkingBudgetInput", "googleThinkingLevel", "googleIncludeThoughts", "enableGoogleSearchGrounding", "enableGoogleUrlContext"];
63
+ export type LLMChatV2ProfileDataKey = (typeof llmChatV2ProfileDataKeys)[number];
64
+ export type LLMChatV2ProfileData = Pick<LLMChatV2NodeData, LLMChatV2ProfileDataKey>;
58
65
  export type LLMChatV2EditorCacheKeyParts = {
59
66
  nodeId: NodeId;
60
67
  nodeData: LLMChatV2NodeData;
@@ -69,6 +76,8 @@ export type LLMChatV2EditorCacheKeyParts = {
69
76
  responseFormatParameters: unknown;
70
77
  providerOptions: unknown;
71
78
  toolChoice: unknown;
79
+ /** Ordered, credential-fingerprinted fallback profile configuration. */
80
+ profileChain?: unknown;
72
81
  };
73
82
  export declare function createLLMChatV2NodeData(): LLMChatV2NodeData;
74
- export declare function hasLLMChatV2BuiltInToolsEnabled(data: LLMChatV2NodeData): boolean;
83
+ export declare function shouldIncludeLLMChatV2ToolCalls(data: LLMChatV2NodeData): boolean;
@@ -1,4 +1,8 @@
1
1
  import type { EditorDefinition } from '../EditorDefinition.js';
2
+ import type { ChartNode } from '../NodeBase.js';
2
3
  import type { RivetUIContext } from '../RivetUIContext.js';
3
- import type { LLMChatV2Node, LLMChatV2NodeData } from './llmChatV2NodeData.js';
4
+ import type { LLMChatV2Node, LLMChatV2NodeData, LLMChatV2ProfileData } from './llmChatV2NodeData.js';
5
+ type LLMProfileEditorNode = ChartNode<'llmProfile', LLMChatV2ProfileData>;
4
6
  export declare function getLLMChatV2Editors(data: LLMChatV2NodeData, context: RivetUIContext): Promise<EditorDefinition<LLMChatV2Node>[]>;
7
+ export declare function getLLMProfileEditors(data: LLMChatV2ProfileData, context: RivetUIContext): Promise<EditorDefinition<LLMProfileEditorNode>[]>;
8
+ export {};
@@ -1,21 +1,37 @@
1
1
  import type { GptFunction } from '../DataValue.js';
2
2
  import type { Inputs, Outputs } from '../GraphProcessor.js';
3
3
  import type { InternalProcessContext } from '../ProcessContext.js';
4
+ import { type LLMProfileAttempt } from './llmProfileFallback.js';
4
5
  import type { ChatV2ProviderProfile } from './chatV2ProviderProfile.js';
5
- import type { RunChatV2PipelineOptions } from './chatV2Types.js';
6
+ import { type ChatV2PipelineResult, type RunChatV2PipelineOptions } from './chatV2Types.js';
6
7
  import { buildLLMChatV2EditorCacheKey, cloneLLMChatV2EditorCacheOutputs } from './chatV2EditorCache.js';
7
8
  import { type LLMChatV2EditorCacheKeyParts, type LLMChatV2NodeData } from './llmChatV2NodeData.js';
8
9
  export { buildLLMChatV2EditorCacheKey, cloneLLMChatV2EditorCacheOutputs };
9
10
  export { resolveLLMChatV2RuntimeProviderOptions } from './chatV2RuntimeOptions.js';
11
+ export type { LLMProfileAttempt } from './llmProfileFallback.js';
10
12
  export type LLMChatV2RuntimeConfig = {
11
- providerProfile: ChatV2ProviderProfile;
13
+ /**
14
+ * Shared invocation values plus a profile-shaped placeholder in From profile
15
+ * mode. The actual provider model is resolved lazily by `runPipeline` so a
16
+ * broken primary candidate can advance to the next profile.
17
+ */
12
18
  runOptions: RunChatV2PipelineOptions;
19
+ /** A safe summary of the first configured candidate for editor/runtime consumers. */
20
+ providerProfile: ChatV2ProviderProfile;
21
+ runPipeline: (options: RunChatV2PipelineOptions) => Promise<ChatV2PipelineResult>;
13
22
  functions: GptFunction[] | undefined;
14
23
  cacheKey: string | undefined;
15
24
  cachedOutputs: Outputs | undefined;
16
25
  editorCache: Map<string, unknown> | undefined;
17
26
  shouldAutoContinueToolCalls: boolean;
18
27
  maxToolRounds: number;
28
+ profileAttempts: LLMProfileAttempt[] | undefined;
29
+ /** True only when the incoming LLM Profile value was an actual array. */
30
+ profileChainUsesArray: boolean;
31
+ /** Defined for From profile runs, including a scalar single-profile input. */
32
+ profileChainLength: number | undefined;
33
+ getProfileSummary: (() => string) | undefined;
34
+ isProfileFallbackExhausted: () => boolean;
19
35
  };
20
36
  export declare function resolveLLMChatV2RuntimeConfig(params: {
21
37
  data: LLMChatV2NodeData;
@@ -0,0 +1,10 @@
1
+ import { type LLMProfileValue } from './llmProfileTypes.js';
2
+ export { applyLLMProfileToNodeData, createDefaultLLMProfileValue, createLLMProfileNodeData, LLM_PROFILE_VALUE_VERSION, pickLLMChatV2ProfileData, type LLMProfileValue, } from './llmProfileTypes.js';
3
+ export declare function normalizeLLMProfileValue(value: unknown): LLMProfileValue;
4
+ /**
5
+ * Normalizes the single LLM Profile or ordered fallback chain accepted by
6
+ * LLM Chat's From profile input. We validate every member here rather than
7
+ * trusting a same-type `llm-config[]` wrapper: arrays can otherwise carry
8
+ * malformed values without re-entering scalar coercion.
9
+ */
10
+ export declare function normalizeLLMProfileChainInput(value: unknown): LLMProfileValue[];
@@ -0,0 +1,79 @@
1
+ import { type ChatV2Provider, type ChatV2PipelineResult, type RunChatV2PipelineOptions } from './chatV2Types.js';
2
+ export type LLMProfileAttempt = {
3
+ roundIndex: number;
4
+ profileIndex: number;
5
+ provider: ChatV2Provider;
6
+ model: string;
7
+ stage: 'configuration' | 'request';
8
+ outcome: 'success' | 'failure';
9
+ attemptIndex?: number;
10
+ status?: number;
11
+ error?: string;
12
+ };
13
+ export type LLMProfileFallbackCandidate = {
14
+ provider: ChatV2Provider;
15
+ model: string;
16
+ credential?: string | undefined;
17
+ /** Additional known request secrets, such as profile or global header values. */
18
+ redactionValues?: readonly string[] | undefined;
19
+ };
20
+ /**
21
+ * Request-level diagnostics grouped by the configured LLM Profile order.
22
+ *
23
+ * `LLMProfileAttempt` deliberately retains the full chronology and round
24
+ * information. These compact arrays are the shape used by the familiar
25
+ * Response Status and Response Error outputs when a profile *array* drives
26
+ * LLM Chat: outer index is the input profile index; inner order is the
27
+ * physical request order for that profile across the whole invocation.
28
+ */
29
+ export type LLMProfileRequestDiagnostics = {
30
+ statuses: Array<number | number[]>;
31
+ errors: LLMProfileRequestErrorDiagnostics;
32
+ };
33
+ /**
34
+ * Compact error diagnostics for an LLM Profile array.
35
+ *
36
+ * A single request failure is easier to inspect as a string, while retries
37
+ * still need an array. When every candidate completed without a request error,
38
+ * there is nothing useful to preserve per profile, so the value is simply an
39
+ * empty array. The detailed LLM Profile Attempts output remains the canonical
40
+ * per-profile/per-attempt record in every case.
41
+ */
42
+ export type LLMProfileRequestErrorDiagnostics = string | string[] | Array<string | string[]>;
43
+ export type LLMProfileFallbackRunner = {
44
+ run: (roundOptions: RunChatV2PipelineOptions) => Promise<ChatV2PipelineResult>;
45
+ attempts: LLMProfileAttempt[];
46
+ summary: () => string;
47
+ wasExhausted: () => boolean;
48
+ };
49
+ export declare class LLMProfileFallbackExhaustedError extends Error {
50
+ readonly attempts: readonly LLMProfileAttempt[];
51
+ constructor(attempts: readonly LLMProfileAttempt[]);
52
+ }
53
+ /**
54
+ * Produces the concise, developer-facing companion to the full attempt trace.
55
+ * It deliberately includes candidates that were never reached, so a successful
56
+ * primary profile does not make the configured fallback order invisible.
57
+ */
58
+ export declare function buildLLMProfileFallbackSummary(candidates: readonly LLMProfileFallbackCandidate[], attempts: readonly LLMProfileAttempt[]): string;
59
+ export declare function buildLLMProfileRequestDiagnostics(profileCount: number, attempts: readonly LLMProfileAttempt[]): LLMProfileRequestDiagnostics;
60
+ /**
61
+ * Preserves one profile slot per input profile while making a single physical
62
+ * request easy to read. This also repairs cache entries made before the
63
+ * scalar-single-status contract was introduced.
64
+ */
65
+ export declare function compactLLMProfileRequestStatuses(statuses: readonly unknown[]): unknown[];
66
+ /**
67
+ * Keeps Response Error readable for profile-array fallback chains and repairs
68
+ * editor-cache entries written before that compact presentation contract.
69
+ */
70
+ export declare function compactLLMProfileRequestErrors(errors: readonly unknown[]): unknown;
71
+ /**
72
+ * Creates one forward-only fallback chain for a whole LLM Chat invocation.
73
+ * A model which succeeds in an earlier tool round stays active for subsequent
74
+ * rounds; only a later failure advances farther through the configured chain.
75
+ */
76
+ export declare function createLLMProfileFallbackRunner(params: {
77
+ candidates: readonly LLMProfileFallbackCandidate[];
78
+ resolveCandidate: (profileIndex: number, roundOptions: RunChatV2PipelineOptions) => Promise<RunChatV2PipelineOptions>;
79
+ }): LLMProfileFallbackRunner;
@@ -0,0 +1,9 @@
1
+ import type { Inputs } from '../GraphProcessor.js';
2
+ import type { InternalProcessContext } from '../ProcessContext.js';
3
+ import type { LLMChatV2ProfileData } from './llmChatV2NodeData.js';
4
+ import { type LLMProfileValue } from './llmProfileTypes.js';
5
+ export declare function resolveLLMProfileNodeValue(params: {
6
+ data: LLMChatV2ProfileData;
7
+ inputs: Inputs;
8
+ context: Pick<InternalProcessContext, 'getPluginConfig' | 'settings'>;
9
+ }): LLMProfileValue;
@@ -0,0 +1,18 @@
1
+ import type { ChatV2CredentialResult } from './chatV2ProviderProfile.js';
2
+ import { type LLMChatV2NodeData, type LLMChatV2ProfileData } from './llmChatV2NodeData.js';
3
+ export declare const LLM_PROFILE_VALUE_VERSION: 1;
4
+ /**
5
+ * Every input port owned by an LLM Profile, including ports that are hidden
6
+ * until their matching provider or input toggle is enabled. This lets editor
7
+ * operations preserve recoverable connections across configuration changes.
8
+ */
9
+ export declare const llmProfileInputIds: readonly ["model", "apiKey", "customProviderBaseURL", "previousResponseId", "temperature", "maxTokens", "topP", "topK", "presencePenalty", "frequencyPenalty", "stopSequences", "seed", "headers", "extraProviderOptions", "anthropicThinkingBudget", "googleThinkingBudget"];
10
+ export type LLMProfileValue = {
11
+ version: typeof LLM_PROFILE_VALUE_VERSION;
12
+ configuration: LLMChatV2ProfileData;
13
+ credential: ChatV2CredentialResult;
14
+ };
15
+ export declare function createLLMProfileNodeData(): LLMChatV2ProfileData;
16
+ export declare function createDefaultLLMProfileValue(): LLMProfileValue;
17
+ export declare function pickLLMChatV2ProfileData(data: LLMChatV2NodeData): LLMChatV2ProfileData;
18
+ export declare function applyLLMProfileToNodeData(data: LLMChatV2NodeData, profile: LLMProfileValue): LLMChatV2NodeData;
@@ -49,6 +49,7 @@ export type CreateChatV2ModelOptions = {
49
49
  baseURL?: string | undefined;
50
50
  headers?: Record<string, string> | undefined;
51
51
  onRequestBody?: ((body: unknown) => void) | undefined;
52
+ transformRequestBody?: ((body: unknown) => unknown) | undefined;
52
53
  };
53
54
  export type ResolveChatV2ProviderConfigContext = Pick<InternalProcessContext, 'getPluginConfig' | 'settings'>;
54
55
  export type ResolvedChatV2ProviderConfig = {
@@ -1,11 +1,12 @@
1
1
  import { type ChartNode, type NodeConnection, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
2
2
  import { NodeImpl, type NodeBody, type NodeUIData } from '../NodeImpl.js';
3
+ import { type ChatMessage } from '../DataValue.js';
3
4
  import { type Inputs, type Outputs } from '../GraphProcessor.js';
4
5
  import type { EditorDefinition } from '../EditorDefinition.js';
5
6
  import type { RivetUIContext } from '../RivetUIContext.js';
6
7
  export type AssembleMessageNode = ChartNode<'assembleMessage', AssembleMessageNodeData>;
7
8
  export type AssembleMessageNodeData = {
8
- type: 'system' | 'user' | 'assistant' | 'function';
9
+ type: ChatMessage['type'];
9
10
  useTypeInput: boolean;
10
11
  toolCallId: string;
11
12
  useToolCallIdInput?: boolean;
@@ -0,0 +1,19 @@
1
+ import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
2
+ import { type ChartNode, type NodeConnection, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
3
+ import { type Inputs, type Outputs } from '../GraphProcessor.js';
4
+ /**
5
+ * A Data Bus is an authoring-topology primitive. Its channels are expanded
6
+ * into independent effective connections before graph execution, so this node
7
+ * must never be dispatched by GraphProcessor as an ordinary NodeImpl.
8
+ */
9
+ export type DataBusNode = ChartNode<'dataBus', Record<string, never>>;
10
+ export { getDataBusInputPortId, getDataBusOutputPortId, MAX_DATA_BUS_CHANNEL_INDEX, parseDataBusChannelIndex, } from '../DataBusPorts.js';
11
+ export declare function isDataBusNode(node: ChartNode | undefined): node is DataBusNode;
12
+ export declare class DataBusNodeImpl extends NodeImpl<DataBusNode> {
13
+ static create: () => DataBusNode;
14
+ getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
15
+ getOutputDefinitions(connections: NodeConnection[]): NodeOutputDefinition[];
16
+ static getUIData(): NodeUIData;
17
+ process(_inputData: Inputs): Promise<Outputs>;
18
+ }
19
+ export declare const dataBusNode: import("../NodeDefinition.js").NodeDefinition<DataBusNode>;
@@ -0,0 +1,20 @@
1
+ import type { EditorDefinition } from '../EditorDefinition.js';
2
+ import type { Inputs, Outputs } from '../GraphProcessor.js';
3
+ import type { ChartNode, NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
4
+ import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
5
+ import type { InternalProcessContext } from '../ProcessContext.js';
6
+ import type { RivetUIContext } from '../RivetUIContext.js';
7
+ import type { LLMChatV2ProfileData } from '../chat-v2/llmChatV2NodeData.js';
8
+ export type { LLMProfileValue } from '../chat-v2/llmProfileTypes.js';
9
+ export type LLMProfileNodeData = LLMChatV2ProfileData;
10
+ export type LLMProfileNode = ChartNode<'llmProfile', LLMProfileNodeData>;
11
+ export declare class LLMProfileNodeImpl extends NodeImpl<LLMProfileNode> {
12
+ static create(): LLMProfileNode;
13
+ getInputDefinitions(): NodeInputDefinition[];
14
+ getOutputDefinitions(): NodeOutputDefinition[];
15
+ getEditors(context: RivetUIContext): Promise<EditorDefinition<LLMProfileNode>[]>;
16
+ getBody(): string;
17
+ static getUIData(): NodeUIData;
18
+ process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
19
+ }
20
+ export declare const llmProfileNode: import("../NodeDefinition.js").NodeDefinition<LLMProfileNode>;
@@ -1,22 +1,9 @@
1
1
  import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
2
2
  import { type ChartNode, type NodeConnection, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
3
3
  import { type Inputs, type Outputs } from '../GraphProcessor.js';
4
- export type PassthroughNode = ChartNode<'passthrough', PassthroughNodeData>;
5
- export type PassthroughNodeData = {
6
- /**
7
- * Canvas-only presentation mode. Runtime execution and serialized connections
8
- * remain an ordinary Passthrough node.
9
- */
10
- renderAsDataBus?: boolean;
11
- };
4
+ export type PassthroughNode = ChartNode<'passthrough', Record<string, never>>;
5
+ /** @deprecated Use MAX_DATA_BUS_CHANNEL_INDEX for Data Bus channels. */
12
6
  export declare const MAX_PASSTHROUGH_PORT_INDEX = 10000;
13
- export declare function isPassthroughDataBusNode(node: ChartNode | undefined): node is PassthroughNode;
14
- /**
15
- * Conditional and split-run Passthrough nodes have execution semantics that a
16
- * hidden canvas rail cannot communicate. Malformed or hand-edited combinations
17
- * therefore fall back to the normal visible node until the conflict is removed.
18
- */
19
- export declare function canRenderPassthroughAsDataBus(node: ChartNode | undefined): node is PassthroughNode;
20
7
  export declare class PassthroughNodeImpl extends NodeImpl<PassthroughNode> {
21
8
  static create: () => PassthroughNode;
22
9
  getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
@@ -1,9 +1,9 @@
1
1
  import { type ChartNode, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
2
2
  import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
3
- import { type EditorDefinition, type Inputs, type InternalProcessContext, type NodeBodySpec, type Outputs } from '../../index.js';
3
+ import { type ChatMessage, type EditorDefinition, type Inputs, type InternalProcessContext, type NodeBodySpec, type Outputs } from '../../index.js';
4
4
  export type PromptNode = ChartNode<'prompt', PromptNodeData>;
5
5
  export type PromptNodeData = {
6
- type: 'system' | 'user' | 'assistant' | 'function';
6
+ type: ChatMessage['type'];
7
7
  useTypeInput: boolean;
8
8
  promptText: string;
9
9
  name?: string;
@@ -1,6 +1,6 @@
1
1
  import { type ChartNode, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
2
2
  import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
3
- import { type DataType } from '../DataValue.js';
3
+ import { type ScalarOrArrayDataType } from '../DataValue.js';
4
4
  import { type Inputs, type Outputs } from '../GraphProcessor.js';
5
5
  import { type InternalProcessContext } from '../ProcessContext.js';
6
6
  import { type EditorDefinition } from '../EditorDefinition.js';
@@ -9,7 +9,7 @@ export type SetGlobalNode = ChartNode<'setGlobal', SetGlobalNodeData>;
9
9
  export type SetGlobalNodeData = {
10
10
  id: string;
11
11
  useIdInput: boolean;
12
- dataType: DataType;
12
+ dataType: ScalarOrArrayDataType;
13
13
  };
14
14
  export declare class SetGlobalNodeImpl extends NodeImpl<SetGlobalNode> {
15
15
  static create(): SetGlobalNode;
@@ -27,6 +27,15 @@ export type DelegatedToolCallRecord = {
27
27
  output: string;
28
28
  message: ChatMessage;
29
29
  };
30
+ /**
31
+ * Finds an Auto Delegate handler from an ordered set of graph-like candidates.
32
+ *
33
+ * Candidate identity belongs to the caller. Runtime execution passes graph
34
+ * objects and uses their metadata IDs; editor analysis passes project-map
35
+ * entries and uses their map keys. Keeping that distinction here preserves the
36
+ * existing behavior for malformed projects where those identities disagree.
37
+ */
38
+ export declare function findAutoDelegateGraphCandidate<T>(candidates: readonly T[], toolName: string, getGraphName: (candidate: T) => string | undefined): T | undefined;
30
39
  export declare function isDelegatedToolCallRecord(input: unknown): input is DelegatedToolCallRecord;
31
40
  export declare function buildDelegatedToolCallOutputs(records: DelegatedToolCallRecord[], preToolMessage?: string, cost?: number): Outputs;
32
41
  export declare function normalizeFunctionCallInput(input: unknown): ParsedAssistantChatMessageFunctionCall;
@@ -98,6 +98,7 @@ export type ChatCompletionOptions = {
98
98
  location: string;
99
99
  applicationCredentials: string;
100
100
  model: GoogleModelsDeprecated;
101
+ systemPrompt?: string;
101
102
  prompt: Content[];
102
103
  max_output_tokens: number;
103
104
  temperature?: number;
@@ -111,6 +112,16 @@ export type ChatCompletionChunk = {
111
112
  finish_reason: 'FINISH_REASON_UNSPECIFIED' | 'FINISH_REASON_STOP' | 'FINISH_REASON_MAX_TOKENS' | 'FINISH_REASON_SAFETY' | 'FINISH_REASON_RECITATION' | 'FINISH_REASON_OTHER' | undefined;
112
113
  model: string;
113
114
  };
115
+ export declare function getVertexGenerativeModelOptions(options: Pick<ChatCompletionOptions, 'model' | 'systemPrompt' | 'max_output_tokens' | 'temperature' | 'top_p' | 'top_k'>): {
116
+ model: "gemini-pro" | "gemini-pro-vision";
117
+ systemInstruction: string | undefined;
118
+ generationConfig: {
119
+ maxOutputTokens: number;
120
+ temperature: number | undefined;
121
+ topP: number | undefined;
122
+ topK: number | undefined;
123
+ };
124
+ };
114
125
  export type StreamGenerativeAiOptions = {
115
126
  apiKey: string;
116
127
  model: GenerativeAiGoogleModel;
@@ -126,4 +137,4 @@ export type StreamGenerativeAiOptions = {
126
137
  additionalHeaders?: Record<string, string>;
127
138
  };
128
139
  export declare function streamGenerativeAi({ apiKey, model, systemPrompt, prompt, maxOutputTokens, temperature, topP, topK, signal, tools, thinkingBudget, additionalHeaders, }: StreamGenerativeAiOptions): AsyncGenerator<ChatCompletionChunk>;
129
- export declare function streamChatCompletions({ project, location, applicationCredentials, model, signal, max_output_tokens, temperature, top_p, top_k, prompt, }: ChatCompletionOptions): AsyncGenerator<ChatCompletionChunk>;
140
+ export declare function streamChatCompletions({ project, location, applicationCredentials, model, signal, max_output_tokens, temperature, top_p, top_k, systemPrompt, prompt, }: ChatCompletionOptions): AsyncGenerator<ChatCompletionChunk>;
@@ -31,5 +31,6 @@ export type ChatGoogleNodeData = ChatGoogleNodeConfigData & {
31
31
  export declare const ChatGoogleNodeImpl: PluginNodeImpl<ChatGoogleNode>;
32
32
  export declare const chatGoogleNode: import("../../../index.js").PluginNodeDefinition<ChatGoogleNode>;
33
33
  export declare function getChatGoogleNodeMessages(inputs: Inputs): {
34
- messages: import("../../../index.js").ChatMessage[];
34
+ messages: (import("../../../index.js").UserChatMessage | import("../../../index.js").AssistantChatMessage | import("../../../index.js").FunctionResponseChatMessage)[];
35
+ systemPrompt: string | undefined;
35
36
  };
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @param {string} value
3
- * @param {{ size?: 32 | 64 | 128 | 256 | 512 | 1024, utf8Buffer?: Uint8Array }} options
4
- * @returns {string}
2
+ * @param {string | Uint8Array} value
3
+ * @param {{ size?: 32 | 64 | 128 | 256 | 512 | 1024, utf8Buffer?: Uint8Array }} [options]
4
+ * @returns {bigint}
5
5
  */
6
- export default function fnv1a(value: string, { size, utf8Buffer }?: {
6
+ export default function fnv1a(value: string | Uint8Array, { size, utf8Buffer }?: {
7
7
  size?: 32 | 64 | 128 | 256 | 512 | 1024;
8
8
  utf8Buffer?: Uint8Array;
9
- }): string;
9
+ }): bigint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valerypopoff/rivet2-core",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "license": "MIT",
5
5
  "main": "dist/cjs/bundle.cjs",
6
6
  "module": "dist/esm/index.js",