litellm/docs
Alexsander Hamir 15404db3d0
[Fix] CI/CD – Docs & Spend logs (#17843)
* fix: resolve mypy type errors in hiddenlayer guardrail and transformation

- Fix return type of apply_guardrail from str to GenericGuardrailAPIInputs
- Add None checks for logging_obj before accessing attributes
- Convert AllMessageValues to dict format for HiddenLayer API compatibility
- Fix payload type annotation in _call_hiddenlayer
- Ensure transformed_output always returns list[dict[str, Any]] in transformation.py

* fix: use litellm_call_id as trace_id fallback in langfuse logging

- Only use standard_logging_object.trace_id if explicitly set via litellm_session_id or litellm_trace_id params
- Fallback to litellm_call_id when no explicit trace_id is provided (matches test expectation)
- Return the trace_id we set instead of generation_client.trace_id for consistency
- Add warning if langfuse modifies the trace_id to help debug potential issues

Fixes test_logging_trace_id test failure where auto-generated UUID was used instead of litellm_call_id

* fix: document envs

* fix: handle None response in /spend/logs endpoint when no records found

- Return empty list [] instead of [None] when spend_log is None
- Prevents 500 errors when querying by request_id, api_key, or user_id with no matching records
- Fixes test_chat_completion_bad_model_with_spend_logs test failure

* fix: use standard_logging_object trace_id when available in langfuse logger

- Fix trace_id selection logic to use standard_logging_object.trace_id when available
- Previously only used standard_logging_object.trace_id if explicitly set via params
- Now uses standard_logging_object.trace_id whenever it's present, matching test expectations
- Falls back to litellm_call_id if no trace_id is found
- Fixes test_log_langfuse_v2_uses_standard_trace_id_when_available test failure
2025-12-11 14:00:33 -08:00
..
my-website [Fix] CI/CD – Docs & Spend logs (#17843) 2025-12-11 14:00:33 -08:00