opengradient 0.5.7__tar.gz → 0.5.10__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.
Files changed (42) hide show
  1. {opengradient-0.5.7/src/opengradient.egg-info → opengradient-0.5.10}/PKG-INFO +35 -13
  2. {opengradient-0.5.7 → opengradient-0.5.10}/README.md +33 -10
  3. {opengradient-0.5.7 → opengradient-0.5.10}/pyproject.toml +2 -3
  4. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/__init__.py +39 -97
  5. opengradient-0.5.10/src/opengradient/alpha.py +375 -0
  6. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/alphasense/read_workflow_tool.py +1 -1
  7. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/cli.py +155 -55
  8. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/client.py +449 -357
  9. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/defaults.py +4 -2
  10. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/llm/og_langchain.py +6 -1
  11. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/types.py +229 -11
  12. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/workflow_models/utils.py +1 -1
  13. opengradient-0.5.10/src/opengradient/x402_auth.py +102 -0
  14. {opengradient-0.5.7 → opengradient-0.5.10/src/opengradient.egg-info}/PKG-INFO +35 -13
  15. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient.egg-info/SOURCES.txt +2 -0
  16. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient.egg-info/requires.txt +1 -2
  17. {opengradient-0.5.7 → opengradient-0.5.10}/LICENSE +0 -0
  18. {opengradient-0.5.7 → opengradient-0.5.10}/setup.cfg +0 -0
  19. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/abi/InferencePrecompile.abi +0 -0
  20. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/abi/PriceHistoryInference.abi +0 -0
  21. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/abi/WorkflowScheduler.abi +0 -0
  22. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/abi/inference.abi +0 -0
  23. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/account.py +0 -0
  24. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/alphasense/__init__.py +0 -0
  25. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/alphasense/run_model_tool.py +0 -0
  26. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/alphasense/types.py +0 -0
  27. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/bin/PriceHistoryInference.bin +0 -0
  28. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/exceptions.py +0 -0
  29. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/llm/__init__.py +0 -0
  30. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/llm/og_openai.py +0 -0
  31. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/proto/__init__.py +0 -0
  32. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/proto/infer.proto +0 -0
  33. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/proto/infer_pb2.py +0 -0
  34. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/proto/infer_pb2_grpc.py +0 -0
  35. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/utils.py +0 -0
  36. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/workflow_models/__init__.py +0 -0
  37. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/workflow_models/constants.py +0 -0
  38. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/workflow_models/types.py +0 -0
  39. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient/workflow_models/workflow_models.py +0 -0
  40. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient.egg-info/dependency_links.txt +0 -0
  41. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient.egg-info/entry_points.txt +0 -0
  42. {opengradient-0.5.7 → opengradient-0.5.10}/src/opengradient.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opengradient
3
- Version: 0.5.7
3
+ Version: 0.5.10
4
4
  Summary: Python SDK for OpenGradient decentralized model management & inference services
5
5
  Author-email: OpenGradient <kyle@vannalabs.ai>
6
6
  License-Expression: MIT
@@ -23,8 +23,7 @@ Requires-Dist: requests>=2.32.3
23
23
  Requires-Dist: langchain>=0.3.7
24
24
  Requires-Dist: openai>=1.58.1
25
25
  Requires-Dist: pydantic>=2.9.2
26
- Requires-Dist: og-test-x402==0.0.1
27
- Requires-Dist: x402==0.2.1
26
+ Requires-Dist: og-test-x402==0.0.9
28
27
  Dynamic: license-file
29
28
 
30
29
  # OpenGradient Python SDK
@@ -36,6 +35,7 @@ A Python SDK for decentralized model management and inference services on the Op
36
35
  - Model management and versioning
37
36
  - Decentralized model inference
38
37
  - Support for LLM inference with various models
38
+ - **Trusted Execution Environment (TEE) inference** with cryptographic attestation
39
39
  - End-to-end verified AI execution
40
40
  - Command-line interface (CLI) for direct access
41
41
 
@@ -47,7 +47,6 @@ Browse and discover AI models on our [Model Hub](https://hub.opengradient.ai/).
47
47
  - Direct integration with the SDK
48
48
 
49
49
  ## Installation
50
-
51
50
  ```bash
52
51
  pip install opengradient
53
52
  ```
@@ -63,7 +62,6 @@ You'll need two accounts to use the SDK:
63
62
  - **OpenGradient account**: Use an existing Ethereum-compatible wallet or create a new one via SDK
64
63
 
65
64
  The easiest way to set up your accounts is through our configuration wizard:
66
-
67
65
  ```bash
68
66
  opengradient config init
69
67
  ```
@@ -74,7 +72,6 @@ This wizard will:
74
72
  - Direct you to our Test Faucet for devnet tokens
75
73
 
76
74
  ### 2. Initialize the SDK
77
-
78
75
  ```python
79
76
  import opengradient as og
80
77
  og.init(private_key="<private_key>", email="<email>", password="<password>")
@@ -83,8 +80,6 @@ og.init(private_key="<private_key>", email="<email>", password="<password>")
83
80
  ### 3. Basic Usage
84
81
 
85
82
  Browse available models on our [Model Hub](https://hub.opengradient.ai/) or create and upload your own:
86
-
87
-
88
83
  ```python
89
84
  # Create and upload a model
90
85
  og.create_model(
@@ -102,20 +97,41 @@ result = og.infer(
102
97
  )
103
98
  ```
104
99
 
105
- ### 4. Examples
100
+ ### 4. TEE (Trusted Execution Environment) Inference
101
+
102
+ OpenGradient supports secure, verifiable inference through TEE for leading LLM providers. Access models from OpenAI, Anthropic, Google, and xAI with cryptographic attestation:
103
+ ```python
104
+ from opengradient import TEE_LLM
105
+
106
+ # Use TEE-enabled models for verifiable AI execution
107
+ result = og.infer(
108
+ model_cid=TEE_LLM.CLAUDE_3_7_SONNET, # or any other TEE_LLM model
109
+ model_inputs={"prompt": "Your prompt here"},
110
+ inference_mode=og.InferenceMode.TEE
111
+ )
112
+ ```
113
+
114
+ **Available TEE Models:**
115
+ The SDK includes models from multiple providers accessible via the `TEE_LLM` enum:
116
+ - **OpenAI**: GPT-4.1, GPT-4o, o4-mini
117
+ - **Anthropic**: Claude 3.7 Sonnet, Claude 3.5 Haiku, Claude 4.0 Sonnet
118
+ - **Google**: Gemini 2.5 Flash, Gemini 2.5 Pro, and more
119
+ - **xAI**: Grok 3 Beta, Grok 4.1 Fast, and other Grok variants
120
+
121
+ For the complete list of available models, check the `TEE_LLM` enum in your IDE autocomplete or see the [API documentation](https://docs.opengradient.ai/).
122
+
123
+ ### 5. Examples
106
124
 
107
125
  See code examples under [examples](./examples).
108
126
 
109
127
  ## CLI Usage
110
128
 
111
129
  The SDK includes a command-line interface for quick operations. First, verify your configuration:
112
-
113
130
  ```bash
114
131
  opengradient config show
115
132
  ```
116
133
 
117
134
  Run a test inference:
118
-
119
135
  ```bash
120
136
  opengradient infer -m QmbUqS93oc4JTLMHwpVxsE39mhNxy6hpf6Py3r9oANr8aZ \
121
137
  --input '{"num_input1":[1.0, 2.0, 3.0], "num_input2":10}'
@@ -125,7 +141,9 @@ opengradient infer -m QmbUqS93oc4JTLMHwpVxsE39mhNxy6hpf6Py3r9oANr8aZ \
125
141
 
126
142
  1. **Off-chain Applications**: Use OpenGradient as a decentralized alternative to centralized AI providers like HuggingFace and OpenAI.
127
143
 
128
- 2. **Model Development**: Manage models on the Model Hub and integrate directly into your development workflow.
144
+ 2. **Verifiable AI Execution**: Leverage TEE inference for cryptographically attested AI outputs, enabling trustless AI applications.
145
+
146
+ 3. **Model Development**: Manage models on the Model Hub and integrate directly into your development workflow.
129
147
 
130
148
  ## Documentation
131
149
 
@@ -133,8 +151,12 @@ For comprehensive documentation, API reference, and examples, visit:
133
151
  - [OpenGradient Documentation](https://docs.opengradient.ai/)
134
152
  - [API Reference](https://docs.opengradient.ai/api_reference/python_sdk/)
135
153
 
154
+ ### Claude Code Users
155
+
156
+ If you use [Claude Code](https://claude.ai/code), copy [docs/CLAUDE_SDK_USERS.md](docs/CLAUDE_SDK_USERS.md) to your project's `CLAUDE.md` to help Claude assist you with OpenGradient SDK development.
157
+
136
158
  ## Support
137
159
 
138
160
  - Run `opengradient --help` for CLI command reference
139
161
  - Visit our [documentation](https://docs.opengradient.ai/) for detailed guides
140
- - Join our [community](https://.opengradient.ai/) for support
162
+ - Join our [community](https://opengradient.ai/) for support
@@ -7,6 +7,7 @@ A Python SDK for decentralized model management and inference services on the Op
7
7
  - Model management and versioning
8
8
  - Decentralized model inference
9
9
  - Support for LLM inference with various models
10
+ - **Trusted Execution Environment (TEE) inference** with cryptographic attestation
10
11
  - End-to-end verified AI execution
11
12
  - Command-line interface (CLI) for direct access
12
13
 
@@ -18,7 +19,6 @@ Browse and discover AI models on our [Model Hub](https://hub.opengradient.ai/).
18
19
  - Direct integration with the SDK
19
20
 
20
21
  ## Installation
21
-
22
22
  ```bash
23
23
  pip install opengradient
24
24
  ```
@@ -34,7 +34,6 @@ You'll need two accounts to use the SDK:
34
34
  - **OpenGradient account**: Use an existing Ethereum-compatible wallet or create a new one via SDK
35
35
 
36
36
  The easiest way to set up your accounts is through our configuration wizard:
37
-
38
37
  ```bash
39
38
  opengradient config init
40
39
  ```
@@ -45,7 +44,6 @@ This wizard will:
45
44
  - Direct you to our Test Faucet for devnet tokens
46
45
 
47
46
  ### 2. Initialize the SDK
48
-
49
47
  ```python
50
48
  import opengradient as og
51
49
  og.init(private_key="<private_key>", email="<email>", password="<password>")
@@ -54,8 +52,6 @@ og.init(private_key="<private_key>", email="<email>", password="<password>")
54
52
  ### 3. Basic Usage
55
53
 
56
54
  Browse available models on our [Model Hub](https://hub.opengradient.ai/) or create and upload your own:
57
-
58
-
59
55
  ```python
60
56
  # Create and upload a model
61
57
  og.create_model(
@@ -73,20 +69,41 @@ result = og.infer(
73
69
  )
74
70
  ```
75
71
 
76
- ### 4. Examples
72
+ ### 4. TEE (Trusted Execution Environment) Inference
73
+
74
+ OpenGradient supports secure, verifiable inference through TEE for leading LLM providers. Access models from OpenAI, Anthropic, Google, and xAI with cryptographic attestation:
75
+ ```python
76
+ from opengradient import TEE_LLM
77
+
78
+ # Use TEE-enabled models for verifiable AI execution
79
+ result = og.infer(
80
+ model_cid=TEE_LLM.CLAUDE_3_7_SONNET, # or any other TEE_LLM model
81
+ model_inputs={"prompt": "Your prompt here"},
82
+ inference_mode=og.InferenceMode.TEE
83
+ )
84
+ ```
85
+
86
+ **Available TEE Models:**
87
+ The SDK includes models from multiple providers accessible via the `TEE_LLM` enum:
88
+ - **OpenAI**: GPT-4.1, GPT-4o, o4-mini
89
+ - **Anthropic**: Claude 3.7 Sonnet, Claude 3.5 Haiku, Claude 4.0 Sonnet
90
+ - **Google**: Gemini 2.5 Flash, Gemini 2.5 Pro, and more
91
+ - **xAI**: Grok 3 Beta, Grok 4.1 Fast, and other Grok variants
92
+
93
+ For the complete list of available models, check the `TEE_LLM` enum in your IDE autocomplete or see the [API documentation](https://docs.opengradient.ai/).
94
+
95
+ ### 5. Examples
77
96
 
78
97
  See code examples under [examples](./examples).
79
98
 
80
99
  ## CLI Usage
81
100
 
82
101
  The SDK includes a command-line interface for quick operations. First, verify your configuration:
83
-
84
102
  ```bash
85
103
  opengradient config show
86
104
  ```
87
105
 
88
106
  Run a test inference:
89
-
90
107
  ```bash
91
108
  opengradient infer -m QmbUqS93oc4JTLMHwpVxsE39mhNxy6hpf6Py3r9oANr8aZ \
92
109
  --input '{"num_input1":[1.0, 2.0, 3.0], "num_input2":10}'
@@ -96,7 +113,9 @@ opengradient infer -m QmbUqS93oc4JTLMHwpVxsE39mhNxy6hpf6Py3r9oANr8aZ \
96
113
 
97
114
  1. **Off-chain Applications**: Use OpenGradient as a decentralized alternative to centralized AI providers like HuggingFace and OpenAI.
98
115
 
99
- 2. **Model Development**: Manage models on the Model Hub and integrate directly into your development workflow.
116
+ 2. **Verifiable AI Execution**: Leverage TEE inference for cryptographically attested AI outputs, enabling trustless AI applications.
117
+
118
+ 3. **Model Development**: Manage models on the Model Hub and integrate directly into your development workflow.
100
119
 
101
120
  ## Documentation
102
121
 
@@ -104,8 +123,12 @@ For comprehensive documentation, API reference, and examples, visit:
104
123
  - [OpenGradient Documentation](https://docs.opengradient.ai/)
105
124
  - [API Reference](https://docs.opengradient.ai/api_reference/python_sdk/)
106
125
 
126
+ ### Claude Code Users
127
+
128
+ If you use [Claude Code](https://claude.ai/code), copy [docs/CLAUDE_SDK_USERS.md](docs/CLAUDE_SDK_USERS.md) to your project's `CLAUDE.md` to help Claude assist you with OpenGradient SDK development.
129
+
107
130
  ## Support
108
131
 
109
132
  - Run `opengradient --help` for CLI command reference
110
133
  - Visit our [documentation](https://docs.opengradient.ai/) for detailed guides
111
- - Join our [community](https://.opengradient.ai/) for support
134
+ - Join our [community](https://opengradient.ai/) for support
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "opengradient"
7
- version = "0.5.7"
7
+ version = "0.5.10"
8
8
  description = "Python SDK for OpenGradient decentralized model management & inference services"
9
9
  authors = [{name = "OpenGradient", email = "kyle@vannalabs.ai"}]
10
10
  readme = "README.md"
@@ -29,8 +29,7 @@ dependencies = [
29
29
  "langchain>=0.3.7",
30
30
  "openai>=1.58.1",
31
31
  "pydantic>=2.9.2",
32
- "og-test-x402==0.0.1",
33
- "x402==0.2.1"
32
+ "og-test-x402==0.0.9",
34
33
  ]
35
34
 
36
35
  [project.scripts]
@@ -17,13 +17,19 @@ from .types import (
17
17
  InferenceResult,
18
18
  LlmInferenceMode,
19
19
  TextGenerationOutput,
20
+ TextGenerationStream,
20
21
  ModelOutput,
21
22
  ModelRepository,
22
23
  FileUploadResult,
24
+ x402SettlementMode,
23
25
  )
26
+ from .alpha import _AlphaNamespace
24
27
 
25
28
  from . import llm, alphasense
26
29
 
30
+ # Module-level alpha namespace for workflow/ML execution features (Alpha Testnet only)
31
+ alpha = _AlphaNamespace()
32
+
27
33
  _client = None
28
34
 
29
35
 
@@ -47,10 +53,25 @@ def new_client(
47
53
  contract_address: Optional inference contract address
48
54
  """
49
55
 
50
- return Client(email=email, password=password, private_key=private_key, rpc_url=rpc_url, api_url=api_url, contract_address=contract_address, **kwargs)
56
+ return Client(
57
+ email=email,
58
+ password=password,
59
+ private_key=private_key,
60
+ rpc_url=rpc_url,
61
+ api_url=api_url,
62
+ contract_address=contract_address,
63
+ **kwargs,
64
+ )
51
65
 
52
66
 
53
- def init(email: str, password: str, private_key: str, rpc_url=DEFAULT_RPC_URL, api_url=DEFAULT_API_URL, contract_address=DEFAULT_INFERENCE_CONTRACT_ADDRESS):
67
+ def init(
68
+ email: str,
69
+ password: str,
70
+ private_key: str,
71
+ rpc_url=DEFAULT_RPC_URL,
72
+ api_url=DEFAULT_API_URL,
73
+ contract_address=DEFAULT_INFERENCE_CONTRACT_ADDRESS,
74
+ ):
54
75
  """Initialize the OpenGradient SDK with authentication and network settings.
55
76
 
56
77
  Args:
@@ -62,8 +83,10 @@ def init(email: str, password: str, private_key: str, rpc_url=DEFAULT_RPC_URL, a
62
83
  contract_address: Optional inference contract address
63
84
  """
64
85
  global _client
65
-
66
- _client = Client(private_key=private_key, rpc_url=rpc_url, api_url=api_url, email=email, password=password, contract_address=contract_address)
86
+
87
+ _client = Client(
88
+ private_key=private_key, rpc_url=rpc_url, api_url=api_url, email=email, password=password, contract_address=contract_address
89
+ )
67
90
  return _client
68
91
 
69
92
 
@@ -162,6 +185,7 @@ def llm_completion(
162
185
  stop_sequence: Optional[List[str]] = None,
163
186
  temperature: float = 0.0,
164
187
  max_retries: Optional[int] = None,
188
+ x402_settlement_mode: Optional[x402SettlementMode] = x402SettlementMode.SETTLE_BATCH,
165
189
  ) -> TextGenerationOutput:
166
190
  """Generate text completion using an LLM.
167
191
 
@@ -173,6 +197,7 @@ def llm_completion(
173
197
  stop_sequence: Optional list of sequences where generation should stop
174
198
  temperature: Sampling temperature (0.0 = deterministic, 1.0 = creative)
175
199
  max_retries: Maximum number of retries for failed transactions
200
+ x402_settlement_mode: Settlement modes for x402 payment protocol transactions (enum x402SettlementMode)
176
201
 
177
202
  Returns:
178
203
  TextGenerationOutput: Transaction hash and generated text
@@ -190,6 +215,7 @@ def llm_completion(
190
215
  stop_sequence=stop_sequence,
191
216
  temperature=temperature,
192
217
  max_retries=max_retries,
218
+ x402_settlement_mode=x402_settlement_mode
193
219
  )
194
220
 
195
221
 
@@ -203,7 +229,9 @@ def llm_chat(
203
229
  tools: Optional[List[Dict]] = None,
204
230
  tool_choice: Optional[str] = None,
205
231
  max_retries: Optional[int] = None,
206
- ) -> TextGenerationOutput:
232
+ x402_settlement_mode: Optional[x402SettlementMode] = x402SettlementMode.SETTLE_BATCH,
233
+ stream: Optional[bool] = False,
234
+ ) -> Union[TextGenerationOutput, TextGenerationStream]:
207
235
  """Have a chat conversation with an LLM.
208
236
 
209
237
  Args:
@@ -216,9 +244,11 @@ def llm_chat(
216
244
  tools: Optional list of tools the model can use
217
245
  tool_choice: Optional specific tool to use
218
246
  max_retries: Maximum number of retries for failed transactions
247
+ x402_settlement_mode: Settlement modes for x402 payment protocol transactions (enum x402SettlementMode)
248
+ stream: Optional boolean to enable streaming
219
249
 
220
250
  Returns:
221
- TextGenerationOutput
251
+ TextGenerationOutput or TextGenerationStream
222
252
 
223
253
  Raises:
224
254
  RuntimeError: If SDK is not initialized
@@ -235,6 +265,8 @@ def llm_chat(
235
265
  tools=tools,
236
266
  tool_choice=tool_choice,
237
267
  max_retries=max_retries,
268
+ x402_settlement_mode=x402_settlement_mode,
269
+ stream=stream,
238
270
  )
239
271
 
240
272
 
@@ -256,93 +288,6 @@ def list_files(model_name: str, version: str) -> List[Dict]:
256
288
  return _client.list_files(model_name, version)
257
289
 
258
290
 
259
- def new_workflow(
260
- model_cid: str,
261
- input_query: HistoricalInputQuery,
262
- input_tensor_name: str,
263
- scheduler_params: Optional[SchedulerParams] = None,
264
- ) -> str:
265
- """
266
- Deploy a new workflow contract with the specified parameters.
267
-
268
- This function deploys a new workflow contract and optionally registers it with
269
- the scheduler for automated execution. If scheduler_params is not provided,
270
- the workflow will be deployed without automated execution scheduling.
271
-
272
- Args:
273
- model_cid: IPFS CID of the model
274
- input_query: HistoricalInputQuery containing query parameters
275
- input_tensor_name: Name of the input tensor
276
- scheduler_params: Optional scheduler configuration as SchedulerParams instance
277
- If not provided, the workflow will be deployed without scheduling.
278
-
279
- Returns:
280
- str: Deployed contract address. If scheduler_params was provided, the workflow
281
- will be automatically executed according to the specified schedule.
282
- """
283
- if _client is None:
284
- raise RuntimeError("OpenGradient client not initialized. Call og.init(...) first.")
285
-
286
- return _client.new_workflow(
287
- model_cid=model_cid, input_query=input_query, input_tensor_name=input_tensor_name, scheduler_params=scheduler_params
288
- )
289
-
290
-
291
- def read_workflow_result(contract_address: str) -> ModelOutput:
292
- """
293
- Reads the latest inference result from a deployed workflow contract.
294
-
295
- This function retrieves the most recent output from a deployed model executor contract.
296
- It includes built-in retry logic to handle blockchain state delays.
297
-
298
- Args:
299
- contract_address (str): Address of the deployed workflow contract
300
-
301
- Returns:
302
- Dict[str, Union[str, Dict]]: A dictionary containing:
303
- - status: "success" or "error"
304
- - result: The model output data if successful
305
- - error: Error message if status is "error"
306
-
307
- Raises:
308
- RuntimeError: If OpenGradient client is not initialized
309
- """
310
- if _client is None:
311
- raise RuntimeError("OpenGradient client not initialized. Call og.init() first.")
312
- return _client.read_workflow_result(contract_address)
313
-
314
-
315
- def run_workflow(contract_address: str) -> ModelOutput:
316
- """
317
- Executes the workflow by calling run() on the contract to pull latest data and perform inference.
318
-
319
- Args:
320
- contract_address (str): Address of the deployed workflow contract
321
-
322
- Returns:
323
- Dict[str, Union[str, Dict]]: Status of the run operation
324
- """
325
- if _client is None:
326
- raise RuntimeError("OpenGradient client not initialized. Call og.init() first.")
327
- return _client.run_workflow(contract_address)
328
-
329
-
330
- def read_workflow_history(contract_address: str, num_results: int) -> List[ModelOutput]:
331
- """
332
- Gets historical inference results from a workflow contract.
333
-
334
- Args:
335
- contract_address (str): Address of the deployed workflow contract
336
- num_results (int): Number of historical results to retrieve
337
-
338
- Returns:
339
- List[Dict]: List of historical inference results
340
- """
341
- if _client is None:
342
- raise RuntimeError("OpenGradient client not initialized. Call og.init() first.")
343
- return _client.read_workflow_history(contract_address, num_results)
344
-
345
-
346
291
  __all__ = [
347
292
  "list_files",
348
293
  "login",
@@ -355,10 +300,7 @@ __all__ = [
355
300
  "init",
356
301
  "LLM",
357
302
  "TEE_LLM",
358
- "new_workflow",
359
- "read_workflow_result",
360
- "run_workflow",
361
- "read_workflow_history",
303
+ "alpha",
362
304
  "InferenceMode",
363
305
  "LlmInferenceMode",
364
306
  "HistoricalInputQuery",