Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions codeflash/api/aiservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def __init__(self) -> None:
self.headers = {"Authorization": f"Bearer {get_codeflash_api_key()}", "Connection": "close"}
self.llm_call_counter = count(1)
self.is_local = self.base_url == "http://localhost:8000"
self.timeout: float | None = 300 if self.is_local else 90
# (connect_timeout, read_timeout) — connect should be fast; read
# can be slow because the server runs LLM inference.
self.timeout: float | tuple[float, float] | None = (10, 300)

def get_next_sequence(self) -> int:
"""Get the next LLM call sequence number."""
Expand Down Expand Up @@ -88,7 +90,7 @@ def make_ai_service_request(
endpoint: str,
method: str = "POST",
payload: dict[str, Any] | list[dict[str, Any]] | None = None,
timeout: float | None = None,
timeout: float | tuple[float, float] | None = None,
) -> requests.Response:
"""Make an API request to the given endpoint on the AI service.

Expand Down
Loading