Skip to content

Commit 6247529

Browse files
committed
PR fix
1 parent 53694d6 commit 6247529

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

decart/realtime/client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,9 @@ def _emit_error(self, error: DecartSDKError) -> None:
7979
except Exception as e:
8080
logger.exception(f"Error in error callback: {e}")
8181

82-
async def set_prompt(self, prompt: str, enrich: bool = True, max_timeout: float = 15.0) -> None:
82+
async def set_prompt(self, prompt: str, enrich: bool = True) -> None:
8383
if not prompt or not prompt.strip():
8484
raise InvalidInputError("Prompt cannot be empty")
85-
if max_timeout <= 0 or max_timeout > 60:
86-
raise InvalidInputError("max_timeout must be between 0 and 60 seconds")
8785

8886
event, result = self._manager.register_prompt_wait(prompt)
8987

@@ -93,7 +91,7 @@ async def set_prompt(self, prompt: str, enrich: bool = True, max_timeout: float
9391
)
9492

9593
try:
96-
await asyncio.wait_for(event.wait(), timeout=max_timeout)
94+
await asyncio.wait_for(event.wait(), timeout=15.0)
9795
except asyncio.TimeoutError:
9896
raise DecartSDKError("Prompt acknowledgment timed out")
9997

tests/test_realtime_unit.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,10 @@ def register_prompt_wait(prompt):
220220

221221
from decart.errors import DecartSDKError
222222

223-
with pytest.raises(DecartSDKError) as exc_info:
224-
await realtime_client.set_prompt("New prompt", max_timeout=0.01)
223+
# Mock asyncio.wait_for to immediately raise TimeoutError
224+
with patch("asyncio.wait_for", side_effect=asyncio.TimeoutError):
225+
with pytest.raises(DecartSDKError) as exc_info:
226+
await realtime_client.set_prompt("New prompt")
225227

226228
assert "timed out" in str(exc_info.value)
227229
mock_manager.unregister_prompt_wait.assert_called_with("New prompt")

0 commit comments

Comments
 (0)