Skip to content

Commit 9f2dbd7

Browse files
[FIX] Fixing timeout for prompt execution (#58)
* Exception handling for Prompt Service * Fixing timeout * Fixing timeout * Fixing typo
1 parent e8979f5 commit 9f2dbd7

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

src/unstract/sdk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.31.0"
1+
__version__ = "0.31.1"
22

33

44
def get_sdk_version():

src/unstract/sdk/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def index_file(
401401
)
402402

403403
@deprecated(
404-
"Deprecated class and method. Use Index and query_texy_from_index() instead"
404+
"Deprecated class and method. Use Index and query_index() instead"
405405
)
406406
def get_text_from_index(
407407
self, embedding_type: str, vector_db: str, doc_id: str

src/unstract/sdk/prompt.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import Any, Optional
33

44
import requests
5-
from requests import ConnectionError, RequestException, Response, Timeout
5+
from requests import ConnectionError, RequestException, Response
66

77
from unstract.sdk.constants import LogLevel, PromptStudioKeys, ToolEnv
88
from unstract.sdk.helper import SdkHelper
@@ -68,21 +68,14 @@ def _post_call(self, url_path: str, payload: dict[str, Any]) -> dict[str, Any]:
6868
headers: dict[str, str] = {"Authorization": f"Bearer {self.bearer_token}"}
6969
response: Response = Response()
7070
try:
71-
response = requests.post(url, json=payload, headers=headers, timeout=600)
71+
response = requests.post(url, json=payload, headers=headers)
7272
response.raise_for_status()
7373
result["status"] = "OK"
7474
result["structure_output"] = response.text
7575
except ConnectionError as connect_err:
7676
msg = "Unable to connect to prompt service. Please contact admin."
7777
self._stringify_and_stream_err(connect_err, msg)
7878
result["error"] = msg
79-
except Timeout as time_out:
80-
msg = (
81-
"Request to run prompt has timed out. "
82-
"Probable causes might be connectivity issues in LLMs."
83-
)
84-
self._stringify_and_stream_err(time_out, msg)
85-
result["error"] = msg
8679
except RequestException as e:
8780
# Extract error information from the response if available
8881
error_message = str(e)

0 commit comments

Comments
 (0)