Function nemo_relay_llm_call

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.

#[unsafe(no_mangle)]pub unsafe extern "C" fn nemo_relay_llm_call(
    name: *const c_char,
    native_json: *const c_char,
    parent: *const FfiScopeHandle,
    attributes: u32,
    data_json: *const c_char,
    metadata_json: *const c_char,
    model_name: *const c_char,
    timestamp_unix_micros: *const i64,
    out: *mut *mut FfiLLMHandle,
) -> NemoRelayStatus

Begin a manual LLM call lifecycle span.

This emits an LLM Start event after applying sanitize-request guardrails to the observability payload. Request and execution intercepts only run through nemo_relay_llm_call_execute.

Parameters

  • name: Null-terminated LLM provider name.
  • native_json: The request payload as a JSON C string representing an LlmRequest ({"headers": {...}, "content": {...}}). The request becomes the start-event data after sanitize-request guardrails.
  • parent: Optional parent scope handle, or null to use the current top of stack.
  • attributes: Bitfield of LLM attributes.
  • data_json: Optional null-terminated JSON string stored on the LLM handle, or null.
  • metadata_json: Optional null-terminated JSON metadata string recorded on the start event, or null.
  • model_name: Optional null-terminated LLM model identifier recorded in the LLM event category profile, or null.
  • timestamp_unix_micros: Optional Unix microseconds timestamp for the handle start time and start event, or null to use the current UTC time.
  • out: On success, receives a heap-allocated FfiLLMHandle that must be freed with nemo_relay_llm_handle_free.

Errors

Returns InvalidJson for invalid JSON inputs and InvalidArg when timestamp_unix_micros is outside the supported timestamp range.

Safety

name, native_json, and out must be valid, non-null pointers. Optional pointer arguments may be null; when non-null, they must be valid for reads for the duration of the call.