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#
- create_metadata_injection_client(
- timeout: float = 600.0,
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:
timeout: HTTP request timeout in seconds
- Returns:
An httpx.AsyncClient configured with metadata header injection