opengradient 0.5.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- opengradient-0.5.3/LICENSE +21 -0
- opengradient-0.5.3/PKG-INFO +139 -0
- opengradient-0.5.3/README.md +111 -0
- opengradient-0.5.3/pyproject.toml +68 -0
- opengradient-0.5.3/setup.cfg +4 -0
- opengradient-0.5.3/src/opengradient/__init__.py +384 -0
- opengradient-0.5.3/src/opengradient/abi/InferencePrecompile.abi +1 -0
- opengradient-0.5.3/src/opengradient/abi/PriceHistoryInference.abi +1 -0
- opengradient-0.5.3/src/opengradient/abi/WorkflowScheduler.abi +13 -0
- opengradient-0.5.3/src/opengradient/abi/inference.abi +1 -0
- opengradient-0.5.3/src/opengradient/account.py +40 -0
- opengradient-0.5.3/src/opengradient/alphasense/__init__.py +11 -0
- opengradient-0.5.3/src/opengradient/alphasense/read_workflow_tool.py +77 -0
- opengradient-0.5.3/src/opengradient/alphasense/run_model_tool.py +152 -0
- opengradient-0.5.3/src/opengradient/alphasense/types.py +11 -0
- opengradient-0.5.3/src/opengradient/bin/PriceHistoryInference.bin +1 -0
- opengradient-0.5.3/src/opengradient/cli.py +799 -0
- opengradient-0.5.3/src/opengradient/client.py +1457 -0
- opengradient-0.5.3/src/opengradient/defaults.py +12 -0
- opengradient-0.5.3/src/opengradient/exceptions.py +109 -0
- opengradient-0.5.3/src/opengradient/llm/__init__.py +35 -0
- opengradient-0.5.3/src/opengradient/llm/og_langchain.py +136 -0
- opengradient-0.5.3/src/opengradient/llm/og_openai.py +115 -0
- opengradient-0.5.3/src/opengradient/proto/__init__.py +2 -0
- opengradient-0.5.3/src/opengradient/proto/infer.proto +50 -0
- opengradient-0.5.3/src/opengradient/proto/infer_pb2.py +45 -0
- opengradient-0.5.3/src/opengradient/proto/infer_pb2_grpc.py +195 -0
- opengradient-0.5.3/src/opengradient/types.py +287 -0
- opengradient-0.5.3/src/opengradient/utils.py +213 -0
- opengradient-0.5.3/src/opengradient/workflow_models/__init__.py +28 -0
- opengradient-0.5.3/src/opengradient/workflow_models/constants.py +13 -0
- opengradient-0.5.3/src/opengradient/workflow_models/types.py +16 -0
- opengradient-0.5.3/src/opengradient/workflow_models/utils.py +39 -0
- opengradient-0.5.3/src/opengradient/workflow_models/workflow_models.py +97 -0
- opengradient-0.5.3/src/opengradient.egg-info/PKG-INFO +139 -0
- opengradient-0.5.3/src/opengradient.egg-info/SOURCES.txt +38 -0
- opengradient-0.5.3/src/opengradient.egg-info/dependency_links.txt +1 -0
- opengradient-0.5.3/src/opengradient.egg-info/entry_points.txt +2 -0
- opengradient-0.5.3/src/opengradient.egg-info/requires.txt +11 -0
- opengradient-0.5.3/src/opengradient.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 OpenGradient
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: opengradient
|
|
3
|
+
Version: 0.5.3
|
|
4
|
+
Summary: Python SDK for OpenGradient decentralized model management & inference services
|
|
5
|
+
Author-email: OpenGradient <kyle@vannalabs.ai>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://opengradient.ai
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: eth-account>=0.13.4
|
|
17
|
+
Requires-Dist: web3>=7.3.0
|
|
18
|
+
Requires-Dist: click>=8.1.7
|
|
19
|
+
Requires-Dist: firebase-rest-api>=1.11.0
|
|
20
|
+
Requires-Dist: grpcio>=1.66.2
|
|
21
|
+
Requires-Dist: numpy>=1.26.4
|
|
22
|
+
Requires-Dist: requests>=2.32.3
|
|
23
|
+
Requires-Dist: langchain>=0.3.7
|
|
24
|
+
Requires-Dist: openai>=1.58.1
|
|
25
|
+
Requires-Dist: pydantic>=2.9.2
|
|
26
|
+
Requires-Dist: og-test-x402==0.0.1
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# OpenGradient Python SDK
|
|
30
|
+
|
|
31
|
+
A Python SDK for decentralized model management and inference services on the OpenGradient platform. The SDK enables programmatic access to our model repository and decentralized AI infrastructure.
|
|
32
|
+
|
|
33
|
+
## Key Features
|
|
34
|
+
|
|
35
|
+
- Model management and versioning
|
|
36
|
+
- Decentralized model inference
|
|
37
|
+
- Support for LLM inference with various models
|
|
38
|
+
- End-to-end verified AI execution
|
|
39
|
+
- Command-line interface (CLI) for direct access
|
|
40
|
+
|
|
41
|
+
## Model Hub
|
|
42
|
+
|
|
43
|
+
Browse and discover AI models on our [Model Hub](https://hub.opengradient.ai/). The Hub provides:
|
|
44
|
+
- Registry of models and LLMs
|
|
45
|
+
- Easy model discovery and deployment
|
|
46
|
+
- Direct integration with the SDK
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install opengradient
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Note: Windows users should temporarily enable WSL when installing `opengradient` (fix in progress).
|
|
55
|
+
|
|
56
|
+
## Getting Started
|
|
57
|
+
|
|
58
|
+
### 1. Account Setup
|
|
59
|
+
|
|
60
|
+
You'll need two accounts to use the SDK:
|
|
61
|
+
- **Model Hub account**: Create one at [Hub Sign Up](https://hub.opengradient.ai/signup)
|
|
62
|
+
- **OpenGradient account**: Use an existing Ethereum-compatible wallet or create a new one via SDK
|
|
63
|
+
|
|
64
|
+
The easiest way to set up your accounts is through our configuration wizard:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
opengradient config init
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This wizard will:
|
|
71
|
+
- Guide you through account creation
|
|
72
|
+
- Help you set up credentials
|
|
73
|
+
- Direct you to our Test Faucet for devnet tokens
|
|
74
|
+
|
|
75
|
+
### 2. Initialize the SDK
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
import opengradient as og
|
|
79
|
+
og.init(private_key="<private_key>", email="<email>", password="<password>")
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 3. Basic Usage
|
|
83
|
+
|
|
84
|
+
Browse available models on our [Model Hub](https://hub.opengradient.ai/) or create and upload your own:
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
# Create and upload a model
|
|
89
|
+
og.create_model(
|
|
90
|
+
model_name="my-model",
|
|
91
|
+
model_desc="Model description",
|
|
92
|
+
model_path="/path/to/model"
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
# Run inference
|
|
96
|
+
inference_mode = og.InferenceMode.VANILLA
|
|
97
|
+
result = og.infer(
|
|
98
|
+
model_cid="your-model-cid",
|
|
99
|
+
model_inputs={"input": "value"},
|
|
100
|
+
inference_mode=inference_mode
|
|
101
|
+
)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 4. Examples
|
|
105
|
+
|
|
106
|
+
See code examples under [examples](./examples).
|
|
107
|
+
|
|
108
|
+
## CLI Usage
|
|
109
|
+
|
|
110
|
+
The SDK includes a command-line interface for quick operations. First, verify your configuration:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
opengradient config show
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Run a test inference:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
opengradient infer -m QmbUqS93oc4JTLMHwpVxsE39mhNxy6hpf6Py3r9oANr8aZ \
|
|
120
|
+
--input '{"num_input1":[1.0, 2.0, 3.0], "num_input2":10}'
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Use Cases
|
|
124
|
+
|
|
125
|
+
1. **Off-chain Applications**: Use OpenGradient as a decentralized alternative to centralized AI providers like HuggingFace and OpenAI.
|
|
126
|
+
|
|
127
|
+
2. **Model Development**: Manage models on the Model Hub and integrate directly into your development workflow.
|
|
128
|
+
|
|
129
|
+
## Documentation
|
|
130
|
+
|
|
131
|
+
For comprehensive documentation, API reference, and examples, visit:
|
|
132
|
+
- [OpenGradient Documentation](https://docs.opengradient.ai/)
|
|
133
|
+
- [API Reference](https://docs.opengradient.ai/api_reference/python_sdk/)
|
|
134
|
+
|
|
135
|
+
## Support
|
|
136
|
+
|
|
137
|
+
- Run `opengradient --help` for CLI command reference
|
|
138
|
+
- Visit our [documentation](https://docs.opengradient.ai/) for detailed guides
|
|
139
|
+
- Join our [community](https://.opengradient.ai/) for support
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# OpenGradient Python SDK
|
|
2
|
+
|
|
3
|
+
A Python SDK for decentralized model management and inference services on the OpenGradient platform. The SDK enables programmatic access to our model repository and decentralized AI infrastructure.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- Model management and versioning
|
|
8
|
+
- Decentralized model inference
|
|
9
|
+
- Support for LLM inference with various models
|
|
10
|
+
- End-to-end verified AI execution
|
|
11
|
+
- Command-line interface (CLI) for direct access
|
|
12
|
+
|
|
13
|
+
## Model Hub
|
|
14
|
+
|
|
15
|
+
Browse and discover AI models on our [Model Hub](https://hub.opengradient.ai/). The Hub provides:
|
|
16
|
+
- Registry of models and LLMs
|
|
17
|
+
- Easy model discovery and deployment
|
|
18
|
+
- Direct integration with the SDK
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install opengradient
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Note: Windows users should temporarily enable WSL when installing `opengradient` (fix in progress).
|
|
27
|
+
|
|
28
|
+
## Getting Started
|
|
29
|
+
|
|
30
|
+
### 1. Account Setup
|
|
31
|
+
|
|
32
|
+
You'll need two accounts to use the SDK:
|
|
33
|
+
- **Model Hub account**: Create one at [Hub Sign Up](https://hub.opengradient.ai/signup)
|
|
34
|
+
- **OpenGradient account**: Use an existing Ethereum-compatible wallet or create a new one via SDK
|
|
35
|
+
|
|
36
|
+
The easiest way to set up your accounts is through our configuration wizard:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
opengradient config init
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This wizard will:
|
|
43
|
+
- Guide you through account creation
|
|
44
|
+
- Help you set up credentials
|
|
45
|
+
- Direct you to our Test Faucet for devnet tokens
|
|
46
|
+
|
|
47
|
+
### 2. Initialize the SDK
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
import opengradient as og
|
|
51
|
+
og.init(private_key="<private_key>", email="<email>", password="<password>")
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Basic Usage
|
|
55
|
+
|
|
56
|
+
Browse available models on our [Model Hub](https://hub.opengradient.ai/) or create and upload your own:
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
# Create and upload a model
|
|
61
|
+
og.create_model(
|
|
62
|
+
model_name="my-model",
|
|
63
|
+
model_desc="Model description",
|
|
64
|
+
model_path="/path/to/model"
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Run inference
|
|
68
|
+
inference_mode = og.InferenceMode.VANILLA
|
|
69
|
+
result = og.infer(
|
|
70
|
+
model_cid="your-model-cid",
|
|
71
|
+
model_inputs={"input": "value"},
|
|
72
|
+
inference_mode=inference_mode
|
|
73
|
+
)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 4. Examples
|
|
77
|
+
|
|
78
|
+
See code examples under [examples](./examples).
|
|
79
|
+
|
|
80
|
+
## CLI Usage
|
|
81
|
+
|
|
82
|
+
The SDK includes a command-line interface for quick operations. First, verify your configuration:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
opengradient config show
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Run a test inference:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
opengradient infer -m QmbUqS93oc4JTLMHwpVxsE39mhNxy6hpf6Py3r9oANr8aZ \
|
|
92
|
+
--input '{"num_input1":[1.0, 2.0, 3.0], "num_input2":10}'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Use Cases
|
|
96
|
+
|
|
97
|
+
1. **Off-chain Applications**: Use OpenGradient as a decentralized alternative to centralized AI providers like HuggingFace and OpenAI.
|
|
98
|
+
|
|
99
|
+
2. **Model Development**: Manage models on the Model Hub and integrate directly into your development workflow.
|
|
100
|
+
|
|
101
|
+
## Documentation
|
|
102
|
+
|
|
103
|
+
For comprehensive documentation, API reference, and examples, visit:
|
|
104
|
+
- [OpenGradient Documentation](https://docs.opengradient.ai/)
|
|
105
|
+
- [API Reference](https://docs.opengradient.ai/api_reference/python_sdk/)
|
|
106
|
+
|
|
107
|
+
## Support
|
|
108
|
+
|
|
109
|
+
- Run `opengradient --help` for CLI command reference
|
|
110
|
+
- Visit our [documentation](https://docs.opengradient.ai/) for detailed guides
|
|
111
|
+
- Join our [community](https://.opengradient.ai/) for support
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "opengradient"
|
|
7
|
+
version = "0.5.3"
|
|
8
|
+
description = "Python SDK for OpenGradient decentralized model management & inference services"
|
|
9
|
+
authors = [{name = "OpenGradient", email = "kyle@vannalabs.ai"}]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
license = "MIT"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 3 - Alpha",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
dependencies = [
|
|
22
|
+
"eth-account>=0.13.4",
|
|
23
|
+
"web3>=7.3.0",
|
|
24
|
+
"click>=8.1.7",
|
|
25
|
+
"firebase-rest-api>=1.11.0",
|
|
26
|
+
"grpcio>=1.66.2",
|
|
27
|
+
"numpy>=1.26.4",
|
|
28
|
+
"requests>=2.32.3",
|
|
29
|
+
"langchain>=0.3.7",
|
|
30
|
+
"openai>=1.58.1",
|
|
31
|
+
"pydantic>=2.9.2",
|
|
32
|
+
"og-test-x402==0.0.1",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
opengradient = "opengradient.cli:cli"
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://opengradient.ai"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.exclude-package-data]
|
|
42
|
+
"*" = ["*.ipynb", "*.pyc", "*.pyo", ".gitignore", "requirements.txt", "conftest.py"]
|
|
43
|
+
|
|
44
|
+
[tool.setuptools]
|
|
45
|
+
package-dir = {"" = "src"}
|
|
46
|
+
include-package-data = true
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
where = ["src"]
|
|
50
|
+
include = ["opengradient*"]
|
|
51
|
+
exclude = ["tests*", "stresstest*"]
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.package-data]
|
|
54
|
+
"opengradient" = [
|
|
55
|
+
"abi/*.abi",
|
|
56
|
+
"bin/*.bin",
|
|
57
|
+
"proto/*.proto",
|
|
58
|
+
"**/*.py"
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
[tool.ruff]
|
|
62
|
+
line-length = 140
|
|
63
|
+
target-version = "py310"
|
|
64
|
+
select = ["E", "F", "I", "N"]
|
|
65
|
+
ignore = []
|
|
66
|
+
|
|
67
|
+
[tool.ruff.mccabe]
|
|
68
|
+
max-complexity = 10
|