Typed Helpers#
Generated from crates/node/typed.d.ts via sphinx-js.
typedLlmStreamExecute#
Execute a typed streaming LLM call through the JSON middleware pipeline.
Chunks yielded by func are converted to JSON via chunkCodec.toJson
before entering the middleware pipeline. After interception, chunks are
converted back via chunkCodec.fromJson before reaching collector.
The finalizer result is converted via responseCodec.toJson.
Kind: function
Parameters#
namestring: Model/provider name.requestTRequest: The LLM request object ({headers, content}).func(request: TRequest) => AsyncIterable<TChunk>: Async iterable producer for typed stream chunks.collector(chunk: TChunk) => void: Callback invoked with each decoded typed chunk.finalizer() => TResponse: Callback that returns the final typed aggregate response.chunkCodecCodec<TChunk>: Codec for stream chunk serialization/deserialization.responseCodecCodec<TResponse>: Codec for final response serialization/deserialization.optionsTypedLlmStreamExecuteOptions: Optional scope handle, attributes, data, metadata, modelName.
Returns#
Promise<LlmStream>: A promise resolving to the nativeLlmStreamhandle.
Remarks#
The wrapper bridges async iteration back into the native stream lifecycle and closes the stream even when the source iterator throws.
TypedLlmStreamExecuteOptions#
Options for typedLlmStreamExecute.
Kind: interface
Members#
handle?ScopeHandleattributes?numberdata?JsonValuemetadata?JsonValuemodelName?stringcodec?LlmCodecresponseCodec?LlmResponseCodec
typedLlmExecute#
Execute a typed LLM call through the JSON middleware pipeline.
Forwards the JSON-shaped request payload into the native LLM lifecycle and
decodes the final response with the supplied response codec before resolving.
Kind: function
Parameters#
namestring: Model/provider name.requestTRequest: The LLM request object ({headers, content}).func(request: TRequest) => TResponse | Promise<TResponse>: The LLM implementation.responseCodecCodec<TResponse>: Codec for response serialization/deserialization.optionsTypedLlmExecuteOptions: Optional scope handle, attributes, data, metadata, modelName.
Returns#
Promise<TResponse>: A promise resolving to the decoded typed LLM response.
Remarks#
options.responseCodeconly affects annotated response event payloads; failures while decoding those event payloads are downgraded to debug logging and do not rewrite the caller-visible response.
typedToolExecute#
Execute a typed tool call through the JSON middleware pipeline.
Converts args to JSON, runs the native tool execution lifecycle, and
decodes the final JSON result back into the caller’s typed result shape.
Kind: function
Parameters#
namestring: Tool name.argsTArgs: Typed tool arguments.func(args: TArgs) => TResult | Promise<TResult>: The tool implementation.argsCodecCodec<TArgs>: Codec for args serialization/deserialization.resultCodecCodec<TResult>: Codec for result serialization/deserialization.optionsTypedToolExecuteOptions: Optional scope handle, attributes, data, metadata.
Returns#
Promise<TResult>: A promise resolving to the decoded typed tool result.
Remarks#
The wrapper accepts both synchronous and promise-returning tool implementations; codec failures and native execution errors propagate to the returned promise.
TypedLlmExecuteOptions#
Options for typedLlmExecute.
Kind: interface
Members#
handle?ScopeHandleattributes?numberdata?JsonValuemetadata?JsonValuemodelName?stringcodec?LlmCodecresponseCodec?LlmResponseCodec
TypedToolExecuteOptions#
Options for typedToolExecute.
Kind: interface
Members#
handle?ScopeHandleattributes?numberdata?JsonValuemetadata?JsonValue
JsonPassthrough#
A passthrough codec that performs no conversion.
Use when arguments or results are already plain JSON objects.
Kind: class
Members#
toJsonunknown: Convert a typed value to a JSON-serializable object.fromJsonunknown: Reconstruct a typed value from a JSON-serializable object.
Codec#
A codec that converts between a typed value T and a JSON-serializable
representation (JsonValue by default).
Kind: interface
Members#
toJsonunknown: Convert a typed value to a JSON-serializable object.fromJsonunknown: Reconstruct a typed value from a JSON-serializable object.
LlmResponseCodec#
A codec for normalizing and decoding raw LLM responses into JsonValue.
Use when model output requires custom parsing or normalization before the
response is consumed as plain JSON by the library.
Kind: interface
Members#
decodeResponseunknown: Decode a raw LLM response payload into the normalized JSON shape expected by the library.
Implementations should return a JSON-serializable value and should prefer normalizing missing or provider-specific fields into a stable shape when possible.
LlmCodec#
A codec for annotating and unwrapping LLM JSON request payloads.
Use when an LLM integration needs custom request parsing or normalization
before the raw payload is passed through the NeMo Flow LLM middleware
pipeline.
Kind: interface
Members#
decodeunknown: Decode a raw LLM request payload into the normalized JSON shape used by the codec.encodeunknown: Encode an annotated request payload back into the JSON shape expected by the underlying LLM implementation.
LlmRequestShape#
Canonical JSON shape for an opaque LLM request payload.
Kind: interface
Members#
headersJsonObjectcontentJsonValue
JsonValue#
Any JSON-serializable value accepted by the typed wrapper APIs.
Alias Of: JsonPrimitive | JsonObject | JsonArray
JsonArray#
A JSON array with recursively JSON-serializable values.
Alias Of: JsonValue[]
JsonObject#
A JSON object with recursively JSON-serializable values.
Kind: interface
JsonPrimitive#
One JSON scalar value accepted by the typed wrapper APIs.
Alias Of: string | number | boolean | null
LlmStream#
No description available.
Alias Of: LlmStream
ScopeHandle#
Typed wrappers for NeMo Flow Node.js execute APIs.
Provides generic typed versions of toolCallExecute and llmCallExecute
that use explicit Codec<T> objects to serialize/deserialize at the API
boundary.
Alias Of: ScopeHandle