Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ OpenGradient enables developers to build AI applications with verifiable executi
pip install opengradient
```

**Note**: > **Windows users:** See the [Windows Installation Guide](./WINDOWS_INSTALL.md) for step-by-step setup instructions.
> **Note for Windows users:** See the [Windows Installation Guide](./WINDOWS_INSTALL.md) for step-by-step setup instructions.

### Claude Code Integration

Expand Down
3 changes: 2 additions & 1 deletion src/opengradient/client/alpha.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# How much time we wait for txn to be included in chain
INFERENCE_TX_TIMEOUT = 120
REGULAR_TX_TIMEOUT = 30
HTTP_REQUEST_TIMEOUT = 30 # seconds

PRECOMPILE_CONTRACT_ADDRESS = "0x00000000000000000000000000000000000000F4"

Expand Down Expand Up @@ -198,7 +199,7 @@ def _get_inference_result_from_node(self, inference_id: str, inference_mode: Inf
encoded_id = urllib.parse.quote(inference_id, safe="")
url = f"{self._api_url}/artela-network/artela-rollkit/inference/tx/{encoded_id}"

response = requests.get(url)
response = requests.get(url, timeout=HTTP_REQUEST_TIMEOUT)
if response.status_code == 200:
resp = response.json()
inference_result = resp.get("inference_results", {})
Expand Down
13 changes: 10 additions & 3 deletions src/opengradient/client/model_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from ..types import FileUploadResult, ModelRepository

# Security Update: Credentials moved to environment variables
_DEFAULT_HTTP_TIMEOUT = 30 # seconds
_FIREBASE_CONFIG = {
"apiKey": os.getenv("FIREBASE_API_KEY"),
"authDomain": os.getenv("FIREBASE_AUTH_DOMAIN"),
Expand Down Expand Up @@ -103,7 +104,7 @@ def create_model(self, model_name: str, model_desc: str, version: str = "1.00")
payload = {"name": model_name, "description": model_desc}

try:
response = requests.post(url, json=payload, headers=headers)
response = requests.post(url, json=payload, headers=headers, timeout=_DEFAULT_HTTP_TIMEOUT)
response.raise_for_status()
except requests.HTTPError as e:
error_details = f"HTTP {e.response.status_code}: {e.response.text}"
Expand Down Expand Up @@ -143,7 +144,13 @@ def create_version(self, model_name: str, notes: str = "", is_major: bool = Fals
payload = {"notes": notes, "is_major": is_major}

try:
response = requests.post(url, json=payload, headers=headers, allow_redirects=False)
response = requests.post(
url,
json=payload,
headers=headers,
allow_redirects=False,
timeout=_DEFAULT_HTTP_TIMEOUT,
)
response.raise_for_status()

json_response = response.json()
Expand Down Expand Up @@ -228,7 +235,7 @@ def list_files(self, model_name: str, version: str) -> List[Dict]:
headers = {"Authorization": f"Bearer {self._get_auth_token()}"}

try:
response = requests.get(url, headers=headers)
response = requests.get(url, headers=headers, timeout=_DEFAULT_HTTP_TIMEOUT)
response.raise_for_status()
result: list[dict] = response.json()
return result
Expand Down
Loading