nat.llm.utils.hooks#
HTTP event hooks for LLM clients.
This module provides httpx event hooks that inject custom metadata from input payloads as HTTP headers to LLM requests, enabling end-to-end traceability in LLM server logs.
Attributes#
Functions#
|
Httpx event hook that injects custom metadata as HTTP headers. |
Module Contents#
- logger#
- async _create_metadata_injection_client(
- llm_config: nat.data_models.llm.LLMBaseConfig,
Httpx event hook that injects custom metadata as HTTP headers.
This client injects custom payload fields as X-Payload-* HTTP headers, enabling end-to-end traceability in LLM server logs.
- Args:
llm_config: LLM configuration object
- Returns:
An httpx.AsyncClient configured with metadata header injection