Run pre_call_hook on Google generateContent endpoints - #26914
Conversation
|
Michael Riad Zaky seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Greptile SummaryThis PR refactors the Confidence Score: 5/5Safe to merge — the refactor is consistent with existing proxy patterns and no regressions were identified. Only a P2 test-gap finding; no P1 or P0 issues found. Core change correctly routes through the hook pipeline. tests/test_litellm/proxy/test_route_llm_request.py — minor assertion gap in
|
| Filename | Overview |
|---|---|
| litellm/proxy/google_endpoints/endpoints.py | Both google_generate_content and google_stream_generate_content now delegate to ProxyBaseLLMRequestProcessing.base_process_llm_request, enabling the full pre/during/post-call hook pipeline (including guardrails); generationConfig → config mapping moved to route_request. |
| tests/test_litellm/proxy/google_endpoints/test_google_api_endpoints.py | Tests refactored to mock at the ProxyBaseLLMRequestProcessing level; previous end-to-end assertions replaced with processor-invocation checks; coverage of generationConfig → config transformation moved to test_route_llm_request.py. |
| tests/test_litellm/proxy/test_route_llm_request.py | New parametrized tests verify generationConfig → config mapping and preservation logic in route_request; minor gap: the "preserve existing config" test doesn't assert generationConfig is removed from forwarded kwargs. |
Reviews (2): Last reviewed commit: "run pre_call_hook on Google generateCont..." | Re-trigger Greptile
74d1231 to
0ac1e25
Compare
|
@greptile-ai |
0ac1e25 to
2a2e9d8
Compare
2a2e9d8 to
053e040
Compare
e4fb325
into
litellm_internal_staging
…tHooks Run pre_call_hook on Google generateContent endpoints
Relevant issues
Adds a hook onto the google generateContent endpoints like everywhere else in the code base.
Linear ticket
Resolves LIT-2706
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/test_litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewScreenshots / Proof of Fix
Added test that go through guardrails fails before and passes after.
Type
🧹 Refactoring
✅ Test
Changes
Changes google_endpoints/endpoints.py