mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
fix(e2e): give the deepseek reasoner test a per-call timeout so provider thinking latency does not hit the 60s transport default
This commit is contained in:
parent
d0758a291c
commit
910ac037ad
3 changed files with 29 additions and 6 deletions
|
|
@ -29,6 +29,7 @@ pytestmark = pytest.mark.e2e
|
|||
|
||||
REASONER = "deepseek/deepseek-v4-pro"
|
||||
PROMPT = "What is 17 + 26? Answer with just the number."
|
||||
REASONER_TIMEOUT_SECONDS = 240.0
|
||||
|
||||
|
||||
def _register_reasoner(client: PassthroughClient, resources: ResourceManager) -> str:
|
||||
|
|
@ -63,6 +64,7 @@ class TestDeepSeekReasoningDisable:
|
|||
messages=[ChatMessage(role="user", content=PROMPT)],
|
||||
max_tokens=64,
|
||||
),
|
||||
timeout=REASONER_TIMEOUT_SECONDS,
|
||||
)
|
||||
)
|
||||
reasoning = _reasoning_content(response)
|
||||
|
|
@ -86,6 +88,7 @@ class TestDeepSeekReasoningDisable:
|
|||
max_tokens=64,
|
||||
reasoning_effort="none",
|
||||
),
|
||||
timeout=REASONER_TIMEOUT_SECONDS,
|
||||
)
|
||||
)
|
||||
assert not _reasoning_content(response), (
|
||||
|
|
@ -108,6 +111,7 @@ class TestDeepSeekReasoningDisable:
|
|||
max_tokens=64,
|
||||
thinking=ThinkingParam(type="disabled"),
|
||||
),
|
||||
timeout=REASONER_TIMEOUT_SECONDS,
|
||||
)
|
||||
)
|
||||
assert not _reasoning_content(response), (
|
||||
|
|
|
|||
|
|
@ -269,12 +269,13 @@ class ProxyClient:
|
|||
|
||||
# ---- LLM calls ------------------------------------------------------
|
||||
|
||||
def chat(self, key: str, body: ChatBody) -> Result[ChatResponse]:
|
||||
def chat(self, key: str, body: ChatBody, timeout: float | None = None) -> Result[ChatResponse]:
|
||||
return self.transport.post(
|
||||
"/chat/completions",
|
||||
headers=self.transport.bearer(key),
|
||||
json=body,
|
||||
response_type=ChatResponse,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
def chat_stream(self, key: str, body: ChatBody) -> StreamingResponse:
|
||||
|
|
|
|||
|
|
@ -25,7 +25,13 @@ from e2e_http import (
|
|||
|
||||
class Transport(Protocol):
|
||||
def post[R: BaseModel](
|
||||
self, path: str, *, headers: BaseModel, json: BaseModel, response_type: type[R]
|
||||
self,
|
||||
path: str,
|
||||
*,
|
||||
headers: BaseModel,
|
||||
json: BaseModel,
|
||||
response_type: type[R],
|
||||
timeout: float | None = None,
|
||||
) -> Result[R]: ...
|
||||
|
||||
def stream(
|
||||
|
|
@ -119,14 +125,20 @@ class HttpTransport:
|
|||
return self.bearer(self.master_key)
|
||||
|
||||
def post[R: BaseModel](
|
||||
self, path: str, *, headers: BaseModel, json: BaseModel, response_type: type[R]
|
||||
self,
|
||||
path: str,
|
||||
*,
|
||||
headers: BaseModel,
|
||||
json: BaseModel,
|
||||
response_type: type[R],
|
||||
timeout: float | None = None,
|
||||
) -> Result[R]:
|
||||
return e2e_http.post(
|
||||
self._url(path),
|
||||
headers=headers,
|
||||
json=json,
|
||||
response_type=response_type,
|
||||
timeout=self.request_timeout,
|
||||
timeout=timeout if timeout is not None else self.request_timeout,
|
||||
)
|
||||
|
||||
def get[R: BaseModel](
|
||||
|
|
@ -323,10 +335,16 @@ class SplitTransport:
|
|||
return self.data.master
|
||||
|
||||
def post[R: BaseModel](
|
||||
self, path: str, *, headers: BaseModel, json: BaseModel, response_type: type[R]
|
||||
self,
|
||||
path: str,
|
||||
*,
|
||||
headers: BaseModel,
|
||||
json: BaseModel,
|
||||
response_type: type[R],
|
||||
timeout: float | None = None,
|
||||
) -> Result[R]:
|
||||
return self._route(path).post(
|
||||
path, headers=headers, json=json, response_type=response_type
|
||||
path, headers=headers, json=json, response_type=response_type, timeout=timeout
|
||||
)
|
||||
|
||||
def get[R: BaseModel](
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue