nemo_eval.adapters.interceptors.logging_interceptor
#
Module Contents#
Classes#
Intercepts and logs incoming requests with configurable limits. |
|
Intercepts and logs outgoing responses with configurable limits. |
Functions#
Create a copy of headers with authorization redacted. |
API#
- nemo_eval.adapters.interceptors.logging_interceptor._get_safe_headers(headers: dict[str, str]) dict[str, str] [source]#
Create a copy of headers with authorization redacted.
- class nemo_eval.adapters.interceptors.logging_interceptor.RequestLoggingInterceptor(max_requests: Optional[int] = 5)[source]#
Bases:
nemo_eval.adapters.interceptors.types.RequestInterceptor
Intercepts and logs incoming requests with configurable limits.
Initialization
Initialize the request logging interceptor.
- Parameters:
output_dir – Directory to store logs in
max_requests – Maximum number of requests to log. If None, all requests will be logged.
log_failed_requests – Whether to log failed request-response pairs (status code >= 400)
- _max_requests: Optional[int]#
None
- _logged_requests: int#
None
- _lock: threading.Lock#
None
- class nemo_eval.adapters.interceptors.logging_interceptor.ResponseLoggingInterceptor(max_responses: Optional[int] = 5)[source]#
Bases:
nemo_eval.adapters.interceptors.types.ResponseInterceptor
Intercepts and logs outgoing responses with configurable limits.
Initialization
Initialize the response logging interceptor.
- Parameters:
use_response_logging – Whether to log full responses to the console
max_responses – max responses to log, if
None
all of them are logged
- _max_responses: Optional[int]#
None
- _logged_responses: int#
None
- _lock: threading.Lock#
None
- intercept_response( ) nemo_eval.adapters.interceptors.types.AdapterResponse [source]#