Conversation
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
|
|
@greptile can you please review this PR? |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR threads the
Confidence Score: 2/5
|
| Filename | Overview |
|---|---|
| litellm/litellm_core_utils/litellm_logging.py | Correctly merges response_cost and model from kwargs into model_call_details for pass-through endpoints, enabling proper cost tracking in standard logging payloads. |
| litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py | Accepts kwargs parameter to thread API key metadata, but the .update() call on litellm_params overwrites the incoming proxy_server_request with just the user field, losing URL/method/body/headers. |
| litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.py | Correctly preserves incoming litellm_params from kwargs and uses safe .setdefault() pattern for proxy_server_request. Adds call_type and litellm_call_id propagation. |
| litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py | Cleanly threads kwargs through to vertex logging payload builder by renaming local variable to _kwargs to avoid shadowing the parameter. |
| litellm/proxy/pass_through_endpoints/pass_through_endpoints.py | Passes the kwargs dict (containing litellm_params, passthrough_logging_payload, etc.) to chunk_processor for both streaming code paths. |
| litellm/proxy/pass_through_endpoints/streaming_handler.py | Propagates kwargs through chunk_processor to _route_streaming_logging_to_handler and renames local variable to handler_kwargs to avoid shadowing. Clean refactor. |
| tests/pass_through_unit_tests/test_unit_test_streaming.py | New test for kwargs propagation is missing import asyncio, causing a NameError at runtime. The test will always fail as-is. |
| tests/test_litellm/litellm_core_utils/test_litellm_logging.py | Good test verifying that response_cost from kwargs is merged into model_call_details and that API key metadata appears in the standard logging object. |
| poetry.lock | Bumps litellm-proxy-extras from 0.4.48 to 0.4.49. Routine dependency update. |
Sequence Diagram
sequenceDiagram
participant PT as pass_through_request
participant CP as chunk_processor
participant RH as _route_streaming_logging_to_handler
participant AH as AnthropicHandler
participant OH as OpenAIHandler
participant VH as VertexHandler
participant ASH as async_success_handler
PT->>CP: kwargs (litellm_params, passthrough_logging_payload, call_type, litellm_call_id)
CP->>CP: Yield raw bytes to client
CP->>RH: kwargs forwarded via asyncio.create_task
alt Anthropic endpoint
RH->>AH: _handle_logging_anthropic_collected_chunks(kwargs)
AH->>AH: _create_anthropic_response_logging_payload(kwargs)
AH-->>RH: handler_kwargs (response_cost, model, litellm_params)
else OpenAI endpoint
RH->>OH: _handle_logging_openai_collected_chunks(kwargs)
OH-->>RH: handler_kwargs (response_cost, model, litellm_params)
else Vertex endpoint
RH->>VH: _handle_logging_vertex_collected_chunks(kwargs)
VH-->>RH: handler_kwargs (response_cost, model)
end
RH->>ASH: result + **handler_kwargs
ASH->>ASH: Merge response_cost & model from kwargs into model_call_details
ASH->>ASH: Build standard_logging_object with API key metadata
Last reviewed commit: f67cb1a
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
@greptile can you please review this PR? |
| pass | ||
|
|
||
| # Allow the asyncio.create_task to run | ||
| await asyncio.sleep(0.5) |
There was a problem hiding this comment.
Missing asyncio import causes NameError
asyncio is used here (await asyncio.sleep(0.5)) but is never imported in this file. This will cause a NameError at runtime, meaning this test will always fail. Add import asyncio at the top of the file with the other module-level imports.
| await asyncio.sleep(0.5) | |
| await asyncio.sleep(0.5) |
The import needs to be added at the top of the file:
import asyncio
import json
import os
...Context Used: Context from dashboard - CLAUDE.md (source)
Additional Comments (1)
Now that kwargs carries the full Before this PR, kwargs was always The OpenAI handler correctly uses |
Claude code trace issues