Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the Client API by splitting the monolithic client.py file into smaller, modular namespace-based components. The refactoring introduces separate modules for LLM operations (llm.py), onchain inference (onchain_inference.py), model hub functionality (model_hub.py), and alpha features (alpha.py). The new structure provides cleaner separation of concerns and improved code organization.
Changes:
- Split monolithic
client.pyinto modular namespace components (LLM, Inference, ModelHub, Alpha) - Updated all client method calls to use namespace accessors (e.g.,
client.llm.chat(),client.inference.infer()) - Reorganized imports and moved utility functions to dedicated modules (
_utils.py,_conversions.py)
Reviewed changes
Copilot reviewed 38 out of 40 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/opengradient/client/client.py | New modular client implementation with namespace properties |
| src/opengradient/client/llm.py | Extracted LLM-specific functionality into dedicated namespace |
| src/opengradient/client/onchain_inference.py | Extracted onchain inference functionality into dedicated namespace |
| src/opengradient/client/model_hub.py | Extracted Model Hub functionality into dedicated namespace |
| src/opengradient/client/alpha.py | Moved Alpha features to client submodule |
| src/opengradient/client/_utils.py | Utility functions for ABI/bytecode loading and retry logic |
| src/opengradient/client/_conversions.py | Data conversion utilities moved from main client |
| tests/client_test.py | Updated tests to use new namespace accessors |
| examples/*.py | Updated example code to use new client API structure |
| src/opengradient/workflow_models/*.py | Updated to accept Alpha namespace as parameter |
| src/opengradient/alphasense/*.py | Updated tools to accept namespace instances as parameters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| print(f"Gas estimation failed: {str(e)}") | ||
| gas_limit = 5000000 # Conservative fallback | ||
| print(f"Using fallback gas limit: {gas_limit}") |
There was a problem hiding this comment.
Using print() statements for error reporting is not consistent with production-quality error handling. Consider using Python's logging module instead (e.g., logging.warning()) to provide configurable and structured error reporting that can be controlled by the application using this SDK.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 51 out of 54 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # dobj.module is None so pull module name from qualname | ||
| parts = dobj.qualname.split('.') | ||
| if len(parts) < 2: | ||
| return '`{}`'.format(parts[0]) |
There was a problem hiding this comment.
Inconsistent indentation: the added lines use 2 spaces while the surrounding code uses 4 spaces. This should match the file's indentation style.
| return '`{}`'.format(parts[0]) | |
| return '`{}`'.format(parts[0]) |
|
|
||
|
|
||
| def read_sui_1_hour_price_forecast() -> WorkflowModelOutput: | ||
| def read_sui_1_hour_price_forecast(alpha: Alpha) -> WorkflowModelOutput: |
There was a problem hiding this comment.
The function signature changed to require an alpha parameter, but the docstring doesn't document this new parameter. Add an Args section documenting the alpha parameter.
|
|
||
|
|
||
| def read_sui_usdt_30_min_price_forecast() -> WorkflowModelOutput: | ||
| def read_sui_usdt_30_min_price_forecast(alpha: Alpha) -> WorkflowModelOutput: |
There was a problem hiding this comment.
The function signature changed to require an alpha parameter, but the docstring doesn't document this new parameter. Add an Args section documenting the alpha parameter.
This PR refactors the Client API by splitting the monolithic client.py file into smaller, modular namespace-based components. The refactoring introduces separate modules for LLM operations (llm.py), onchain inference (onchain_inference.py), model hub functionality (model_hub.py), and alpha features (alpha.py). The new structure provides cleaner separation of concerns and improved code organization.