Typed Helpers
Generated from crates/node/dist/typed.d.ts.
Import from nemo-relay-node/typed.
Typed wrappers for the execute APIs, converting values with a Codec<T>.
Interfaces
ToolExecutionResult
Result returned to the application after tool execution.
Codec
Converts between a typed value T and JSON.
TypedToolExecuteOptions
Options for typedToolExecute.
TypedLlmExecuteOptions
Options for typedLlmExecute.
TypedLlmStreamExecuteOptions
Options for typedLlmStreamExecute.
Classes
JsonPassthrough
Codec that returns values unchanged.
Functions
typedToolExecute
Executes a tool call with typed arguments and result.
args is encoded with argsCodec before the tool lifecycle runs, and the JSON result is decoded with resultCodec afterwards. The annotation is returned as the pipeline produced it.
Parameters
name: Tool name.args: Typed tool arguments.func: The tool. It may return the result directly or in a promise.argsCodec: Converts the arguments to and from JSON.resultCodec: Converts the result to and from JSON.options: Scope handle, attributes, data, metadata, tool call id, and host execution context.
Returns
The decoded result and its annotation.
Remarks
A codec error or an execution error rejects the returned promise.
typedLlmExecute
Executes an LLM call with a typed response.
The LLM lifecycle runs on request, and the JSON response is decoded with responseCodec before it is returned.
Parameters
name: Provider name.request: Request withheadersandcontent.func: The LLM call. It may return the response directly or in a promise.responseCodec: Converts the response to and from JSON.options: Scope handle, attributes, data, metadata, model name, and codecs.
Returns
The decoded response.
Remarks
options.responseCodec decodes the response copied into events. It does not change the returned response.
typedLlmStreamExecute
Executes a streaming LLM call with typed chunks and response.
Each chunk from func is encoded with chunkCodec before middleware sees it and decoded again before collector receives it. The value from finalizer is encoded with responseCodec.
Parameters
name: Provider name.request: Request withheadersandcontent.func: The streaming LLM call. It receives the request and anAbortSignaland returns an async iterable of chunks.collector: Receives one decoded chunk at a time. It may return a promise.finalizer: Returns the final response once the stream ends. It may return a promise.chunkCodec: Converts chunks to and from JSON.responseCodec: Converts the final response to and from JSON.options: Scope handle, attributes, data, metadata, model name, and codecs.
Returns
The LlmStream to read chunks from.
Remarks
An error in collector fails the stream. An error in finalizer is thrown by stream.close(). A reader that stops early must await stream.close(), which aborts the signal and waits for cleanup.
Re-exports
ApplicationExecutionContextJsonJsonArrayJsonCompatibleJsonObjectJsonPrimitiveJsonValueLlmCodecLlmRequestCompatibleLlmRequestShapeLlmResponseCodec