mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-14 04:09:09 +00:00
fix(proxy): strip the query string before matching vertex methods
`_matches_vertex_method` matched on the full url_route, so a canonical route with a query string (e.g. ``.../gemini-3.8-flash:streamGenerateContent?alt=sse``) no longer matched after the substring-hardening of #45787. Mid-stream vertex interruptions then failed to bill the already-delivered usage (test_chunk_processor_bills_partial_google_usage_on_mid_stream_exception). Match on the URL path (urlparse(...).path) instead; bare trailing-path forms still match, and plain substring hits stay rejected. Signed-off-by: apex-mochen <2756823972@qq.com>
This commit is contained in:
parent
d78aec0878
commit
9937e2cc13
1 changed files with 5 additions and 1 deletions
|
|
@ -129,8 +129,12 @@ class VertexPassthroughLoggingHandler:
|
|||
``.../models/gemini-2.0-flash:predict``) and its bare trailing path-segment
|
||||
form (e.g. ``/v1/generateContent``), while rejecting plain substring hits
|
||||
such as ``http://example.com/api/predict/laya`` that caused #45787.
|
||||
|
||||
The query string is stripped first so a route such as
|
||||
``.../gemini-3.8-flash:streamGenerateContent?alt=sse`` still matches.
|
||||
"""
|
||||
return url_route.endswith(method) or url_route.endswith(":" + method)
|
||||
path = urlparse(url_route).path
|
||||
return path.endswith(method) or path.endswith(":" + method)
|
||||
|
||||
@staticmethod
|
||||
def vertex_passthrough_handler(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue