opengradient 0.3.20__py3-none-any.whl → 0.3.22__py3-none-any.whl
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/__init__.py +74 -7
- opengradient/abi/ModelExecutorHistorical.abi +1 -0
- opengradient/cli.py +0 -1
- opengradient/client.py +157 -14
- opengradient/contracts/templates/ModelExecutorHistorical.bin +1 -0
- opengradient/llm/og_langchain.py +3 -2
- opengradient/llm/og_openai.py +0 -1
- opengradient/mltools/__init__.py +14 -0
- opengradient/mltools/model_tool.py +129 -0
- opengradient/types.py +43 -1
- {opengradient-0.3.20.dist-info → opengradient-0.3.22.dist-info}/METADATA +18 -17
- opengradient-0.3.22.dist-info/RECORD +26 -0
- {opengradient-0.3.20.dist-info → opengradient-0.3.22.dist-info}/WHEEL +2 -1
- opengradient-0.3.22.dist-info/top_level.txt +1 -0
- opengradient-0.3.20.dist-info/RECORD +0 -21
- {opengradient-0.3.20.dist-info/licenses → opengradient-0.3.22.dist-info}/LICENSE +0 -0
- {opengradient-0.3.20.dist-info → opengradient-0.3.22.dist-info}/entry_points.txt +0 -0
opengradient/__init__.py
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"""
|
|
2
2
|
OpenGradient Python SDK for interacting with AI models and infrastructure.
|
|
3
3
|
"""
|
|
4
|
-
|
|
5
|
-
from
|
|
6
|
-
|
|
4
|
+
from typing import Dict, List, Optional, Tuple, Any, Union
|
|
5
|
+
from pathlib import Path
|
|
7
6
|
from .client import Client
|
|
8
7
|
from .defaults import DEFAULT_INFERENCE_CONTRACT_ADDRESS, DEFAULT_RPC_URL
|
|
9
8
|
from .types import InferenceMode, LlmInferenceMode, LLM, TEE_LLM
|
|
10
9
|
from . import llm
|
|
11
|
-
|
|
12
|
-
__version__ = "0.3.20"
|
|
10
|
+
from . import mltools
|
|
13
11
|
|
|
14
12
|
_client = None
|
|
15
13
|
|
|
@@ -28,7 +26,15 @@ def init(email: str,
|
|
|
28
26
|
contract_address: Optional inference contract address
|
|
29
27
|
"""
|
|
30
28
|
global _client
|
|
31
|
-
|
|
29
|
+
|
|
30
|
+
_client = Client(
|
|
31
|
+
private_key=private_key,
|
|
32
|
+
rpc_url=rpc_url,
|
|
33
|
+
email=email,
|
|
34
|
+
password=password,
|
|
35
|
+
contract_address=contract_address
|
|
36
|
+
)
|
|
37
|
+
return _client
|
|
32
38
|
|
|
33
39
|
def upload(model_path, model_name, version):
|
|
34
40
|
"""Upload a model file to OpenGradient.
|
|
@@ -239,9 +245,66 @@ def generate_image(model: str, prompt: str, height: Optional[int] = None, width:
|
|
|
239
245
|
raise RuntimeError("OpenGradient client not initialized. Call og.init() first.")
|
|
240
246
|
return _client.generate_image(model, prompt, height=height, width=width)
|
|
241
247
|
|
|
248
|
+
def new_workflow(
|
|
249
|
+
model_cid: str,
|
|
250
|
+
input_query: Dict[str, Any],
|
|
251
|
+
input_tensor_name: str
|
|
252
|
+
) -> str:
|
|
253
|
+
"""
|
|
254
|
+
Deploy a new workflow contract with the specified parameters.
|
|
255
|
+
|
|
256
|
+
Args:
|
|
257
|
+
model_cid: IPFS CID of the model
|
|
258
|
+
input_query: Dictionary containing query parameters
|
|
259
|
+
input_tensor_name: Name of the input tensor
|
|
260
|
+
|
|
261
|
+
Returns:
|
|
262
|
+
str: Deployed contract address
|
|
263
|
+
"""
|
|
264
|
+
if _client is None:
|
|
265
|
+
raise RuntimeError("OpenGradient client not initialized. Call og.init(...) first.")
|
|
266
|
+
return _client.new_workflow(model_cid, input_query, input_tensor_name)
|
|
267
|
+
|
|
268
|
+
def read_workflow_result(contract_address: str) -> Dict[str, Union[str, Dict]]:
|
|
269
|
+
"""
|
|
270
|
+
Reads the latest inference result from a deployed workflow contract.
|
|
271
|
+
|
|
272
|
+
This function retrieves the most recent output from a deployed model executor contract.
|
|
273
|
+
It includes built-in retry logic to handle blockchain state delays.
|
|
274
|
+
|
|
275
|
+
Args:
|
|
276
|
+
contract_address (str): Address of the deployed workflow contract
|
|
277
|
+
|
|
278
|
+
Returns:
|
|
279
|
+
Dict[str, Union[str, Dict]]: A dictionary containing:
|
|
280
|
+
- status: "success" or "error"
|
|
281
|
+
- result: The model output data if successful
|
|
282
|
+
- error: Error message if status is "error"
|
|
283
|
+
|
|
284
|
+
Raises:
|
|
285
|
+
RuntimeError: If OpenGradient client is not initialized
|
|
286
|
+
"""
|
|
287
|
+
if _client is None:
|
|
288
|
+
raise RuntimeError("OpenGradient client not initialized. Call og.init() first.")
|
|
289
|
+
return _client.read_workflow_result(contract_address)
|
|
290
|
+
|
|
291
|
+
def run_workflow(contract_address: str) -> Dict[str, Union[str, Dict]]:
|
|
292
|
+
"""
|
|
293
|
+
Executes the workflow by calling run() on the contract to pull latest data and perform inference.
|
|
294
|
+
|
|
295
|
+
Args:
|
|
296
|
+
contract_address (str): Address of the deployed workflow contract
|
|
297
|
+
|
|
298
|
+
Returns:
|
|
299
|
+
Dict[str, Union[str, Dict]]: Status of the run operation
|
|
300
|
+
"""
|
|
301
|
+
if _client is None:
|
|
302
|
+
raise RuntimeError("OpenGradient client not initialized. Call og.init() first.")
|
|
303
|
+
return _client.run_workflow(contract_address)
|
|
304
|
+
|
|
242
305
|
__all__ = [
|
|
243
306
|
'generate_image',
|
|
244
|
-
'list_files'
|
|
307
|
+
'list_files',
|
|
245
308
|
'login',
|
|
246
309
|
'llm_chat',
|
|
247
310
|
'llm_completion',
|
|
@@ -252,6 +315,9 @@ __all__ = [
|
|
|
252
315
|
'init',
|
|
253
316
|
'LLM',
|
|
254
317
|
'TEE_LLM'
|
|
318
|
+
'new_workflow',
|
|
319
|
+
'read_workflow_result',
|
|
320
|
+
'run_workflow'
|
|
255
321
|
]
|
|
256
322
|
|
|
257
323
|
__pdoc__ = {
|
|
@@ -261,6 +327,7 @@ __pdoc__ = {
|
|
|
261
327
|
'defaults': False,
|
|
262
328
|
'exceptions': False,
|
|
263
329
|
'llm': True,
|
|
330
|
+
'mltools': True,
|
|
264
331
|
'proto': False,
|
|
265
332
|
'types': False,
|
|
266
333
|
'utils': False
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"inputs":[{"internalType":"string","name":"_modelCID","type":"string"},{"components":[{"internalType":"string","name":"currency_pair","type":"string"},{"internalType":"uint32","name":"total_candles","type":"uint32"},{"internalType":"uint32","name":"candle_duration_in_mins","type":"uint32"},{"internalType":"enum CandleOrder","name":"order","type":"uint8"},{"internalType":"enum CandleType[]","name":"candle_types","type":"uint8[]"}],"internalType":"struct HistoricalInputQuery","name":"_inputQuery","type":"tuple"},{"internalType":"address","name":"_historicalContractAddress","type":"address"},{"internalType":"string","name":"_inputTensorName","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"components":[{"components":[{"internalType":"string","name":"name","type":"string"},{"components":[{"internalType":"int128","name":"value","type":"int128"},{"internalType":"int128","name":"decimals","type":"int128"}],"internalType":"struct TensorLib.Number[]","name":"values","type":"tuple[]"},{"internalType":"uint32[]","name":"shape","type":"uint32[]"}],"internalType":"struct TensorLib.MultiDimensionalNumberTensor[]","name":"numbers","type":"tuple[]"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string[]","name":"values","type":"string[]"}],"internalType":"struct TensorLib.StringTensor[]","name":"strings","type":"tuple[]"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"value","type":"string"}],"internalType":"struct TensorLib.JsonScalar[]","name":"jsons","type":"tuple[]"},{"internalType":"bool","name":"is_simulation_result","type":"bool"}],"indexed":false,"internalType":"struct ModelOutput","name":"result","type":"tuple"}],"name":"InferenceResultEmitted","type":"event"},{"inputs":[],"name":"getInferenceResult","outputs":[{"components":[{"components":[{"internalType":"string","name":"name","type":"string"},{"components":[{"internalType":"int128","name":"value","type":"int128"},{"internalType":"int128","name":"decimals","type":"int128"}],"internalType":"struct TensorLib.Number[]","name":"values","type":"tuple[]"},{"internalType":"uint32[]","name":"shape","type":"uint32[]"}],"internalType":"struct TensorLib.MultiDimensionalNumberTensor[]","name":"numbers","type":"tuple[]"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string[]","name":"values","type":"string[]"}],"internalType":"struct TensorLib.StringTensor[]","name":"strings","type":"tuple[]"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"value","type":"string"}],"internalType":"struct TensorLib.JsonScalar[]","name":"jsons","type":"tuple[]"},{"internalType":"bool","name":"is_simulation_result","type":"bool"}],"internalType":"struct ModelOutput","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"historicalContract","outputs":[{"internalType":"contract OGHistorical","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"run","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
opengradient/cli.py
CHANGED
|
@@ -674,7 +674,6 @@ def generate_image(ctx, model: str, prompt: str, output_path: Path, width: int,
|
|
|
674
674
|
except Exception as e:
|
|
675
675
|
click.echo(f"Error generating image: {str(e)}")
|
|
676
676
|
|
|
677
|
-
|
|
678
677
|
if __name__ == '__main__':
|
|
679
678
|
logging.getLogger().setLevel(logging.WARN)
|
|
680
679
|
cli()
|
opengradient/client.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import asyncio
|
|
1
2
|
import json
|
|
2
3
|
import logging
|
|
3
4
|
import os
|
|
4
|
-
import
|
|
5
|
-
from typing import Dict, List, Optional, Tuple, Union
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Dict, List, Optional, Tuple, Union, Any
|
|
6
7
|
|
|
7
8
|
import firebase
|
|
8
9
|
import numpy as np
|
|
@@ -13,7 +14,14 @@ from web3.logs import DISCARD
|
|
|
13
14
|
|
|
14
15
|
from opengradient import utils
|
|
15
16
|
from opengradient.exceptions import OpenGradientError
|
|
16
|
-
from opengradient.types import
|
|
17
|
+
from opengradient.types import (
|
|
18
|
+
HistoricalInputQuery,
|
|
19
|
+
InferenceMode,
|
|
20
|
+
LlmInferenceMode,
|
|
21
|
+
LLM,
|
|
22
|
+
TEE_LLM,
|
|
23
|
+
ModelOutput
|
|
24
|
+
)
|
|
17
25
|
|
|
18
26
|
import grpc
|
|
19
27
|
import time
|
|
@@ -62,7 +70,6 @@ class Client:
|
|
|
62
70
|
def __init__(self, private_key: str, rpc_url: str, contract_address: str, email: str, password: str):
|
|
63
71
|
"""
|
|
64
72
|
Initialize the Client with private key, RPC URL, and contract address.
|
|
65
|
-
|
|
66
73
|
Args:
|
|
67
74
|
private_key (str): The private key for the wallet.
|
|
68
75
|
rpc_url (str): The RPC URL for the Ethereum node.
|
|
@@ -78,19 +85,23 @@ class Client:
|
|
|
78
85
|
self._w3 = Web3(Web3.HTTPProvider(self.rpc_url))
|
|
79
86
|
self.wallet_account = self._w3.eth.account.from_key(private_key)
|
|
80
87
|
self.wallet_address = self._w3.to_checksum_address(self.wallet_account.address)
|
|
88
|
+
|
|
81
89
|
self.firebase_app = firebase.initialize_app(self.FIREBASE_CONFIG)
|
|
82
90
|
self.auth = self.firebase_app.auth()
|
|
83
91
|
self.user = None
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
|
|
93
|
+
abi_path = Path(__file__).parent / 'abi' / 'inference.abi'
|
|
94
|
+
|
|
95
|
+
try:
|
|
96
|
+
with open(abi_path, 'r') as abi_file:
|
|
97
|
+
inference_abi = json.load(abi_file)
|
|
98
|
+
except FileNotFoundError:
|
|
99
|
+
raise
|
|
100
|
+
except json.JSONDecodeError:
|
|
101
|
+
raise
|
|
102
|
+
except Exception as e:
|
|
103
|
+
raise
|
|
104
|
+
|
|
94
105
|
self.abi = inference_abi
|
|
95
106
|
|
|
96
107
|
if email is not None:
|
|
@@ -787,3 +798,135 @@ class Client:
|
|
|
787
798
|
finally:
|
|
788
799
|
if channel:
|
|
789
800
|
channel.close()
|
|
801
|
+
|
|
802
|
+
def _get_model_executor_abi(self) -> List[Dict]:
|
|
803
|
+
"""
|
|
804
|
+
Returns the ABI for the ModelExecutorHistorical contract.
|
|
805
|
+
"""
|
|
806
|
+
abi_path = Path(__file__).parent / 'abi' / 'ModelExecutorHistorical.abi'
|
|
807
|
+
with open(abi_path, 'r') as f:
|
|
808
|
+
return json.load(f)
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
def new_workflow(
|
|
812
|
+
self,
|
|
813
|
+
model_cid: str,
|
|
814
|
+
input_query: Union[Dict[str, Any], HistoricalInputQuery],
|
|
815
|
+
input_tensor_name: str
|
|
816
|
+
) -> str:
|
|
817
|
+
"""
|
|
818
|
+
Deploy a new workflow contract with the specified parameters.
|
|
819
|
+
|
|
820
|
+
Args:
|
|
821
|
+
model_cid: IPFS CID of the model
|
|
822
|
+
input_query: Either a HistoricalInputQuery object or dictionary containing query parameters
|
|
823
|
+
input_tensor_name: Name of the input tensor
|
|
824
|
+
|
|
825
|
+
Returns:
|
|
826
|
+
str: Deployed contract address
|
|
827
|
+
"""
|
|
828
|
+
if isinstance(input_query, dict):
|
|
829
|
+
input_query = HistoricalInputQuery.from_dict(input_query)
|
|
830
|
+
|
|
831
|
+
# Get contract ABI and bytecode
|
|
832
|
+
abi = self._get_model_executor_abi()
|
|
833
|
+
bin_path = Path(__file__).parent / 'contracts' / 'templates' / 'ModelExecutorHistorical.bin'
|
|
834
|
+
|
|
835
|
+
with open(bin_path, 'r') as f:
|
|
836
|
+
bytecode = f.read().strip()
|
|
837
|
+
|
|
838
|
+
# Create contract instance
|
|
839
|
+
contract = self._w3.eth.contract(abi=abi, bytecode=bytecode)
|
|
840
|
+
|
|
841
|
+
# Deploy contract with constructor arguments
|
|
842
|
+
transaction = contract.constructor(
|
|
843
|
+
model_cid,
|
|
844
|
+
input_query.to_abi_format(),
|
|
845
|
+
"0x00000000000000000000000000000000000000F5", # Historical contract address
|
|
846
|
+
input_tensor_name
|
|
847
|
+
).build_transaction({
|
|
848
|
+
'from': self.wallet_address,
|
|
849
|
+
'nonce': self._w3.eth.get_transaction_count(self.wallet_address, 'pending'),
|
|
850
|
+
'gas': 15000000,
|
|
851
|
+
'gasPrice': self._w3.eth.gas_price,
|
|
852
|
+
'chainId': self._w3.eth.chain_id
|
|
853
|
+
})
|
|
854
|
+
|
|
855
|
+
signed_txn = self._w3.eth.account.sign_transaction(transaction, self.private_key)
|
|
856
|
+
tx_hash = self._w3.eth.send_raw_transaction(signed_txn.raw_transaction)
|
|
857
|
+
tx_receipt = self._w3.eth.wait_for_transaction_receipt(tx_hash)
|
|
858
|
+
|
|
859
|
+
return tx_receipt.contractAddress
|
|
860
|
+
|
|
861
|
+
def read_workflow_result(self, contract_address: str) -> Any:
|
|
862
|
+
"""
|
|
863
|
+
Reads the latest inference result from a deployed workflow contract.
|
|
864
|
+
|
|
865
|
+
Args:
|
|
866
|
+
contract_address (str): Address of the deployed workflow contract
|
|
867
|
+
|
|
868
|
+
Returns:
|
|
869
|
+
Any: The inference result from the contract
|
|
870
|
+
|
|
871
|
+
Raises:
|
|
872
|
+
ContractLogicError: If the transaction fails
|
|
873
|
+
Web3Error: If there are issues with the web3 connection or contract interaction
|
|
874
|
+
"""
|
|
875
|
+
if not self._w3:
|
|
876
|
+
self._initialize_web3()
|
|
877
|
+
|
|
878
|
+
# Get the contract interface
|
|
879
|
+
contract = self._w3.eth.contract(
|
|
880
|
+
address=Web3.to_checksum_address(contract_address),
|
|
881
|
+
abi=self._get_model_executor_abi()
|
|
882
|
+
)
|
|
883
|
+
|
|
884
|
+
# Get the result
|
|
885
|
+
result = contract.functions.getInferenceResult().call()
|
|
886
|
+
return result
|
|
887
|
+
|
|
888
|
+
def run_workflow(self, contract_address: str) -> ModelOutput:
|
|
889
|
+
"""
|
|
890
|
+
Triggers the run() function on a deployed workflow contract and returns the result.
|
|
891
|
+
|
|
892
|
+
Args:
|
|
893
|
+
contract_address (str): Address of the deployed workflow contract
|
|
894
|
+
|
|
895
|
+
Returns:
|
|
896
|
+
ModelOutput: The inference result from the contract
|
|
897
|
+
|
|
898
|
+
Raises:
|
|
899
|
+
ContractLogicError: If the transaction fails
|
|
900
|
+
Web3Error: If there are issues with the web3 connection or contract interaction
|
|
901
|
+
"""
|
|
902
|
+
if not self._w3:
|
|
903
|
+
self._initialize_web3()
|
|
904
|
+
|
|
905
|
+
# Get the contract interface
|
|
906
|
+
contract = self._w3.eth.contract(
|
|
907
|
+
address=Web3.to_checksum_address(contract_address),
|
|
908
|
+
abi=self._get_model_executor_abi()
|
|
909
|
+
)
|
|
910
|
+
|
|
911
|
+
# Call run() function
|
|
912
|
+
nonce = self._w3.eth.get_transaction_count(self.wallet_address, 'pending')
|
|
913
|
+
|
|
914
|
+
run_function = contract.functions.run()
|
|
915
|
+
transaction = run_function.build_transaction({
|
|
916
|
+
'from': self.wallet_address,
|
|
917
|
+
'nonce': nonce,
|
|
918
|
+
'gas': 30000000,
|
|
919
|
+
'gasPrice': self._w3.eth.gas_price,
|
|
920
|
+
'chainId': self._w3.eth.chain_id
|
|
921
|
+
})
|
|
922
|
+
|
|
923
|
+
signed_txn = self._w3.eth.account.sign_transaction(transaction, self.private_key)
|
|
924
|
+
tx_hash = self._w3.eth.send_raw_transaction(signed_txn.raw_transaction)
|
|
925
|
+
tx_receipt = self._w3.eth.wait_for_transaction_receipt(tx_hash)
|
|
926
|
+
|
|
927
|
+
if tx_receipt.status == 0:
|
|
928
|
+
raise ContractLogicError(f"Run transaction failed. Receipt: {tx_receipt}")
|
|
929
|
+
|
|
930
|
+
# Get the inference result from the contract
|
|
931
|
+
result = contract.functions.getInferenceResult().call()
|
|
932
|
+
return result
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
6080604052346100335761001d61001461039c565b92919091610a9c565b610025610038565b613964610ad2823961396490f35b61003e565b60405190565b5f80fd5b601f801991011690565b634e487b7160e01b5f52604160045260245ffd5b9061006a90610042565b810190811060018060401b0382111761008257604052565b61004c565b9061009a610093610038565b9283610060565b565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b60018060401b0381116100c8576100c4602091610042565b0190565b61004c565b90825f9392825e0152565b909291926100ed6100e8826100ac565b610087565b9381855260208501908284011161010957610107926100cd565b565b6100a8565b9080601f8301121561012c57816020610129935191016100d8565b90565b6100a4565b5f80fd5b5f80fd5b63ffffffff1690565b61014b81610139565b0361015257565b5f80fd5b9050519061016382610142565b565b6002111561016f57565b5f80fd5b9050519061018082610165565b565b60018060401b0381116101985760208091020190565b61004c565b5f80fd5b600411156101ab57565b5f80fd5b905051906101bc826101a1565b565b909291926101d36101ce82610182565b610087565b938185526020808601920283019281841161021057915b8383106101f75750505050565b6020809161020584866101af565b8152019201916101ea565b61019d565b9080601f8301121561023357816020610230935191016101be565b90565b6100a4565b91909160a0818403126102d45761024f60a0610087565b925f82015160018060401b0381116102cf578161026d91840161010e565b5f85015261027e8160208401610156565b60208501526102908160408401610156565b60408501526102a28160608401610173565b6060850152608082015160018060401b0381116102ca576102c39201610215565b6080830152565b610135565b610135565b610131565b60018060a01b031690565b6102ed906102d9565b90565b6102f9816102e4565b0361030057565b5f80fd5b90505190610311826102f0565b565b90608082820312610397575f82015160018060401b038111610392578161033b91840161010e565b92602083015160018060401b03811161038d578261035a918501610238565b926103688360408301610304565b92606082015160018060401b03811161038857610385920161010e565b90565b6100a0565b6100a0565b6100a0565b61009c565b6103ba614436803803806103af81610087565b928339810190610313565b90919293565b5190565b634e487b7160e01b5f52602260045260245ffd5b90600160028304921680156103f8575b60208310146103f357565b6103c4565b91607f16916103e8565b5f5260205f2090565b601f602091010490565b1b90565b9190600861043491029161042e5f1984610415565b92610415565b9181191691161790565b90565b90565b61045861045361045d9261043e565b610441565b61043e565b90565b90565b919061047961047461048193610444565b610460565b908354610419565b9055565b5f90565b61049b91610495610485565b91610463565b565b5b8181106104a9575050565b806104b65f600193610489565b0161049e565b9190601f81116104cc575b505050565b6104d86104fd93610402565b9060206104e48461040b565b83019310610505575b6104f69061040b565b019061049d565b5f80806104c7565b91506104f6819290506104ed565b1c90565b90610527905f1990600802610513565b191690565b8161053691610517565b906002021790565b90610548816103c0565b9060018060401b0382116106065761056a8261056485546103d8565b856104bc565b602090601f831160011461059e5791809161058d935f92610592575b505061052c565b90555b565b90915001515f80610586565b601f198316916105ad85610402565b925f5b8181106105ee575091600293918560019694106105d4575b50505002019055610590565b6105e4910151601f841690610517565b90555f80806105c8565b919360206001819287870151815501950192016105b0565b61004c565b906106159161053e565b565b5190565b6106259051610139565b90565b5f1b90565b9061063c63ffffffff91610628565b9181191691161790565b61065a61065561065f92610139565b610441565b610139565b90565b90565b9061067a61067561068192610646565b610662565b825461062d565b9055565b60201b90565b9061069e67ffffffff0000000091610685565b9181191691161790565b906106bd6106b86106c492610646565b610662565b825461068b565b9055565b634e487b7160e01b5f52602160045260245ffd5b600211156106e657565b6106c8565b906106f5826106dc565b565b61070190516106eb565b90565b60401b90565b9061071e68ff000000000000000091610704565b9181191691161790565b610731906106eb565b90565b90565b9061074c61074761075392610728565b610734565b825461070a565b9055565b5190565b5490565b60209060018203010490565b5f5260205f2090565b5b818110610780575050565b8061078d5f600193610489565b01610775565b906107a6905f1990602003600802610513565b8154169055565b9190918282106107bd575b505050565b600160206107cd6107f59561075f565b6107df6107d98661075f565b9461076b565b93840193019306025f81116107fd575b50610774565b5f80806107b8565b61080a9060018303610793565b5f6107ef565b90680100000000000000008111610839578161082e6108379361075b565b908281556107ad565b565b61004c565b5190565b6004111561084c57565b6106c8565b9061085b82610842565b565b6108679051610851565b90565b60200190565b9190600861088b91029161088560ff84610415565b92610415565b9181191691161790565b90565b906108a28161083e565b9060018060401b038211610983576108c66108cc916108c18486610810565b61086a565b9261076b565b60208204915f5b83811061093b57506020830290035f81116108ef575b50505050565b925f935f5b8181106109095750505001555f8080806108e9565b909194602061092f6001926109256109208a61085d565b610895565b9085850290610870565b960191019190916108f4565b5f5f5b6020811061095557509060019181850155016108d3565b9590602061097a60019261097061096b8661085d565b610895565b908a850290610870565b9201960161093e565b61004c565b9061099291610898565b565b90610a0a60806002610a10946109b75f82016109b15f8801610617565b9061060b565b6109d0600182016109ca6020880161061b565b90610665565b6109e9600182016109e36040880161061b565b906106a8565b610a02600182016109fc606088016106f7565b90610737565b019201610757565b90610988565b565b90610a1c91610994565b565b610a32610a2d610a37926102d9565b610441565b6102d9565b90565b610a4390610a1e565b90565b610a4f90610a3a565b90565b90610a6360018060a01b0391610628565b9181191691161790565b610a7690610a3a565b90565b90565b90610a91610a8c610a9892610a6d565b610a79565b8254610a52565b9055565b610acf9392610abd610ac893610ab6610ac294600561060b565b6006610a12565b610a46565b5f610a7c565b600961060b565b56fe60806040526004361015610013575b6106a9565b61001d5f3561004c565b80631b9fc70114610047578063c0406226146100425763df958cf60361000e57610674565b61059a565b610560565b60e01c90565b60405190565b5f80fd5b5f80fd5b5f91031261006a57565b61005c565b5190565b60209181520190565b60200190565b5190565b60209181520190565b90825f9392825e0152565b601f801991011690565b6100c36100cc6020936100d1936100ba81610082565b93848093610086565b9586910161008f565b61009a565b0190565b5190565b60209181520190565b60200190565b600f0b90565b6100f7906100e8565b9052565b9060208061011d936101135f8201515f8601906100ee565b01519101906100ee565b565b9061012c816040936100fb565b0190565b60200190565b9061015361014d610146846100d5565b80936100d9565b926100e2565b905f5b8181106101635750505090565b90919261017c610176600192865161011f565b94610130565b9101919091610156565b5190565b60209181520190565b60200190565b63ffffffff1690565b6101ab90610199565b9052565b906101bc816020936101a2565b0190565b60200190565b906101e36101dd6101d684610186565b809361018a565b92610193565b905f5b8181106101f35750505090565b90919261020c61020660019286516101af565b946101c0565b91019190916101e6565b610259916040610248610236606084015f8601518582035f8701526100a4565b60208501518482036020860152610136565b9201519060408184039101526101c6565b90565b9061026691610216565b90565b60200190565b9061028361027c8361006f565b8092610073565b90816102946020830284019461007c565b925f915b8383106102a757505050505090565b909192939460206102c96102c38385600195038752895161025c565b97610269565b9301930191939290610298565b5190565b60209181520190565b60200190565b5190565b60209181520190565b60200190565b90610306916100a4565b90565b60200190565b9061032361031c836102e9565b80926102ed565b9081610334602083028401946102f6565b925f915b83831061034757505050505090565b90919293946020610369610363838560019503875289516102fc565b97610309565b9301930191939290610338565b6103a4916020610393604083015f8501518482035f8601526100a4565b92015190602081840391015261030f565b90565b906103b191610376565b90565b60200190565b906103ce6103c7836102d6565b80926102da565b90816103df602083028401946102e3565b925f915b8383106103f257505050505090565b9091929394602061041461040e838560019503875289516103a7565b976103b4565b93019301919392906103e3565b5190565b60209181520190565b60200190565b610462916020610451604083015f8501518482035f8601526100a4565b9201519060208184039101526100a4565b90565b9061046f91610434565b90565b60200190565b9061048c61048583610421565b8092610425565b908161049d6020830284019461042e565b925f915b8383106104b057505050505090565b909192939460206104d26104cc83856001950387528951610465565b97610472565b93019301919392906104a1565b151590565b6104ed906104df565b9052565b906105459060608061053a610528610516608086015f8901518782035f89015261026f565b602088015186820360208801526103ba565b60408701518582036040870152610478565b9401519101906104e4565b90565b61055d9160208201915f8184039101526104f1565b90565b3461059057610570366004610060565b61058c61057b611114565b610583610052565b91829182610548565b0390f35b610058565b5f0190565b346105c8576105aa366004610060565b6105b261385c565b6105ba610052565b806105c481610595565b0390f35b610058565b1c90565b60018060a01b031690565b6105ec9060086105f193026105cd565b6105d1565b90565b906105ff91546105dc565b90565b61060d5f5f906105f4565b90565b60018060a01b031690565b90565b61063261062d61063792610610565b61061b565b610610565b90565b6106439061061e565b90565b61064f9061063a565b90565b61065b90610646565b9052565b9190610672905f60208501940190610652565b565b346106a457610684366004610060565b6106a061068f610602565b610697610052565b9182918261065f565b0390f35b610058565b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b906106cb9061009a565b810190811067ffffffffffffffff8211176106e557604052565b6106ad565b906106fd6106f6610052565b92836106c1565b565b61070960806106ea565b90565b606090565b606090565b606090565b5f90565b6107276106ff565b9060208080808561073661070c565b815201610741610711565b81520161074c610716565b81520161075761071b565b81525050565b61076561071f565b90565b5490565b67ffffffffffffffff81116107845760208091020190565b6106ad565b9061079b6107968361076c565b6106ea565b918252565b5f5260205f2090565b634e487b7160e01b5f52602260045260245ffd5b90600160028304921680156107dd575b60208310146107d857565b6107a9565b91607f16916107cd565b5f5260205f2090565b905f929180549061080a610803836107bd565b8094610086565b916001811690815f146108615750600114610825575b505050565b61083291929394506107e7565b915f925b81841061084957505001905f8080610820565b60018160209295939554848601520191019290610836565b92949550505060ff19168252151560200201905f8080610820565b90610886916107f0565b90565b906108a96108a292610899610052565b9384809261087c565b03836106c1565b565b52565b5490565b67ffffffffffffffff81116108ca5760208091020190565b6106ad565b906108e16108dc836108b2565b6106ea565b918252565b5f5260205f2090565b5f1c90565b600f0b90565b61090661090b916108ef565b6108f4565b90565b61091890546108fa565b90565b90610925906100e8565b9052565b60801c90565b61093b61094091610929565b6108f4565b90565b61094d905461092f565b90565b61095a60406106ea565b90565b9061099361098a5f61096d610950565b9461098461097c83830161090e565b83880161091b565b01610943565b6020840161091b565b565b61099e9061095d565b90565b906109ab826108ae565b6109b4816108cf565b926109c260208501916108e6565b5f915b8383106109d25750505050565b6001602081926109e185610995565b8152019201920191906109c5565b52565b5490565b5f5260205f2090565b63ffffffff1690565b610a14610a19916108ef565b6109ff565b90565b60201c90565b610a2e610a3391610a1c565b6109ff565b90565b60401c90565b610a48610a4d91610a36565b6109ff565b90565b60601c90565b610a62610a6791610a50565b6109ff565b90565b610a76610a7b91610929565b6109ff565b90565b60a01c90565b610a90610a9591610a7e565b6109ff565b90565b60c01c90565b610aaa610aaf91610a98565b6109ff565b90565b610abe610ac39161004c565b6109ff565b90565b90600190610ae6610ae0610ad9856109f2565b809361018a565b936109f6565b5f92610c50575b6001610afa575b50505090565b5490808310610c2e575b808310610c0c575b808310610bea575b808310610bc8575b808310610ba6575b808310610b84575b808310610b62575b8210610b41575b80610af4565b82610b5960019394610b54602094610ab2565b6101a2565b0191015f610b3b565b9192602081610b7b600193610b7686610a9e565b6101a2565b01930191610b34565b9192602081610b9d600193610b9886610a84565b6101a2565b01930191610b2c565b9192602081610bbf600193610bba86610a6a565b6101a2565b01930191610b24565b9192602081610be1600193610bdc86610a56565b6101a2565b01930191610b1c565b9192602081610c03600193610bfe86610a3c565b6101a2565b01930191610b14565b9192602081610c25600193610c2086610a22565b6101a2565b01930191610b0c565b9192602081610c47600193610c4286610a08565b6101a2565b01930191610b04565b5b81600160080384011015610aed579260016020610d04610d09600894838080808080808f5497610c8981610c848b610a08565b6101a2565b01610c9c81610c978a610a22565b6101a2565b01610caf81610caa89610a3c565b6101a2565b01610cc281610cbd88610a56565b6101a2565b01610cd581610cd087610a6a565b6101a2565b01610ce881610ce386610a84565b6101a2565b01610cfb81610cf685610a9e565b6101a2565b01928391610ab2565b6101a2565b019401920191610c51565b90610d1e91610ac6565b90565b90610d41610d3a92610d31610052565b93848092610d14565b03836106c1565b565b52565b610d5060606106ea565b90565b90610da2610d996002610d64610d46565b94610d7b610d735f8301610889565b5f88016108ab565b610d93610d8a600183016109a1565b602088016109ef565b01610d21565b60408401610d43565b565b610dad90610d53565b90565b90610dba82610768565b610dc381610789565b92610dd160208501916107a0565b5f915b838310610de15750505050565b60036020600192610df185610da4565b815201920192019190610dd4565b52565b5490565b67ffffffffffffffff8111610e1e5760208091020190565b6106ad565b90610e35610e3083610e06565b6106ea565b918252565b5f5260205f2090565b5490565b67ffffffffffffffff8111610e5f5760208091020190565b6106ad565b90610e76610e7183610e47565b6106ea565b918252565b5f5260205f2090565b610e8d90610889565b90565b90610e9a82610e43565b610ea381610e64565b92610eb16020850191610e7b565b5f915b838310610ec15750505050565b600160208192610ed085610e84565b815201920192019190610eb4565b52565b610eeb60406106ea565b90565b90610f25610f1c6001610eff610ee1565b94610f16610f0e5f8301610889565b5f88016108ab565b01610e90565b60208401610ede565b565b610f3090610eee565b90565b90610f3d82610e02565b610f4681610e23565b92610f546020850191610e3a565b5f915b838310610f645750505050565b60026020600192610f7485610f27565b815201920192019190610f57565b52565b5490565b67ffffffffffffffff8111610fa15760208091020190565b6106ad565b90610fb8610fb383610f89565b6106ea565b918252565b5f5260205f2090565b610fd060406106ea565b90565b9061100a6110016001610fe4610fc6565b94610ffb610ff35f8301610889565b5f88016108ab565b01610889565b602084016108ab565b565b61101590610fd3565b90565b9061102282610f85565b61102b81610fa6565b926110396020850191610fbd565b5f915b8383106110495750505050565b600260206001926110598561100c565b81520192019201919061103c565b52565b60ff1690565b61107c611081916108ef565b61106a565b90565b61108e9054611070565b90565b9061109b906104df565b9052565b906111066110fd60036110b06106ff565b946110c76110bf5f8301610db0565b5f8801610dff565b6110df6110d660018301610f33565b60208801610f82565b6110f76110ee60028301611018565b60408801611067565b01611084565b60608401611091565b565b6111119061109f565b90565b61111c61075d565b506111276001611108565b90565b61113661113b916108ef565b6105d1565b90565b611148905461112a565b90565b60e01b90565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f80fd5b67ffffffffffffffff81116111875761118360209161009a565b0190565b6106ad565b909291926111a161119c82611169565b6106ea565b938185526020850190828401116111bd576111bb9261008f565b565b611165565b9080601f830112156111e0578160206111dd9351910161118c565b90565b61115d565b6111ee816100e8565b036111f557565b5f80fd5b90505190611206826111e5565b565b91906040838203126112425761123b9061122260406106ea565b9361122f825f83016111f9565b5f8601526020016111f9565b6020830152565b611155565b9092919261125c611257826108b2565b6106ea565b93818552604060208601920283019281841161129b57915b8383106112815750505050565b60206040916112908486611208565b815201920191611274565b611161565b9080601f830112156112be578160206112bb93519101611247565b90565b61115d565b67ffffffffffffffff81116112db5760208091020190565b6106ad565b6112e981610199565b036112f057565b5f80fd5b90505190611301826112e0565b565b90929192611318611313826112c3565b6106ea565b938185526020808601920283019281841161135557915b83831061133c5750505050565b6020809161134a84866112f4565b81520192019161132f565b611161565b9080601f830112156113785781602061137593519101611303565b90565b61115d565b9190916060818403126114115761139460606106ea565b925f82015167ffffffffffffffff811161140c57816113b49184016111c2565b5f850152602082015167ffffffffffffffff811161140757816113d89184016112a0565b6020850152604082015167ffffffffffffffff8111611402576113fb920161135a565b6040830152565b611159565b611159565b611159565b611155565b92919061142a6114258261076c565b6106ea565b93818552602080860192028101918383116114815781905b838210611450575050505050565b815167ffffffffffffffff811161147c57602091611471878493870161137d565b815201910190611442565b61115d565b611161565b9080601f830112156114a4578160206114a193519101611416565b90565b61115d565b9291906114bd6114b882610e47565b6106ea565b93818552602080860192028101918383116115145781905b8382106114e3575050505050565b815167ffffffffffffffff811161150f5760209161150487849387016111c2565b8152019101906114d5565b61115d565b611161565b9080601f8301121561153757816020611534935191016114a9565b90565b61115d565b9190916040818403126115a65761155360406106ea565b925f82015167ffffffffffffffff81116115a157816115739184016111c2565b5f850152602082015167ffffffffffffffff811161159c576115959201611519565b6020830152565b611159565b611159565b611155565b9291906115bf6115ba82610e06565b6106ea565b93818552602080860192028101918383116116165781905b8382106115e5575050505050565b815167ffffffffffffffff811161161157602091611606878493870161153c565b8152019101906115d7565b61115d565b611161565b9080601f8301121561163957816020611636935191016115ab565b90565b61115d565b9190916040818403126116a85761165560406106ea565b925f82015167ffffffffffffffff81116116a357816116759184016111c2565b5f850152602082015167ffffffffffffffff811161169e5761169792016111c2565b6020830152565b611159565b611159565b611155565b9291906116c16116bc82610f89565b6106ea565b93818552602080860192028101918383116117185781905b8382106116e7575050505050565b815167ffffffffffffffff811161171357602091611708878493870161163e565b8152019101906116d9565b61115d565b611161565b9080601f8301121561173b57816020611738935191016116ad565b90565b61115d565b611749816104df565b0361175057565b5f80fd5b9050519061176182611740565b565b91909160808184031261180a5761177a60806106ea565b925f82015167ffffffffffffffff8111611805578161179a918401611486565b5f850152602082015167ffffffffffffffff811161180057816117be91840161161b565b602085015260408201519167ffffffffffffffff83116117fb576117e7826117f494830161171d565b6040860152606001611754565b6060830152565b611159565b611159565b611159565b611155565b9060208282031261183f575f82015167ffffffffffffffff811161183a576118379201611763565b90565b611151565b61005c565b60209181520190565b905f9291805490611867611860836107bd565b8094611844565b916001811690815f146118be5750600114611882575b505050565b61188f91929394506107e7565b915f925b8184106118a657505001905f808061187d565b60018160209295939554848601520191019290611893565b92949550505060ff19168252151560200201905f808061187d565b60ff1690565b6118eb6118f091610a36565b6118d9565b90565b634e487b7160e01b5f52602160045260245ffd5b6002111561191157565b6118f3565b9061192082611907565b565b61192b90611916565b90565b61193790611922565b9052565b5490565b60209181520190565b5f5260205f2090565b6004111561195b57565b6118f3565b9061196a82611951565b565b61197590611960565b90565b6119819061196c565b9052565b60ff1690565b61199761199c916108ef565b611985565b90565b60081c90565b6119b16119b69161199f565b611985565b90565b60101c90565b6119cb6119d0916119b9565b611985565b90565b60181c90565b6119e56119ea916119d3565b611985565b90565b6119f96119fe91610a1c565b611985565b90565b60281c90565b611a13611a1891611a01565b611985565b90565b60301c90565b611a2d611a3291611a1b565b611985565b90565b60381c90565b611a47611a4c91611a35565b611985565b90565b611a5b611a6091610a36565b611985565b90565b60481c90565b611a75611a7a91611a63565b611985565b90565b60501c90565b611a8f611a9491611a7d565b611985565b90565b60581c90565b611aa9611aae91611a97565b611985565b90565b611abd611ac291610a50565b611985565b90565b60681c90565b611ad7611adc91611ac5565b611985565b90565b60701c90565b611af1611af691611adf565b611985565b90565b60781c90565b611b0b611b1091611af9565b611985565b90565b611b1f611b2491610929565b611985565b90565b60881c90565b611b39611b3e91611b27565b611985565b90565b60901c90565b611b53611b5891611b41565b611985565b90565b60981c90565b611b6d611b7291611b5b565b611985565b90565b611b81611b8691610a7e565b611985565b90565b60a81c90565b611b9b611ba091611b89565b611985565b90565b60b01c90565b611bb5611bba91611ba3565b611985565b90565b60b81c90565b611bcf611bd491611bbd565b611985565b90565b611be3611be891610a98565b611985565b90565b60c81c90565b611bfd611c0291611beb565b611985565b90565b60d01c90565b611c17611c1c91611c05565b611985565b90565b60d81c90565b611c31611c3691611c1f565b611985565b90565b611c45611c4a9161004c565b611985565b90565b60e81c90565b611c5f611c6491611c4d565b611985565b90565b60f01c90565b611c79611c7e91611c67565b611985565b90565b60f81c90565b611c93611c9891611c81565b611985565b90565b90600190611cbb611cb5611cae8561193b565b809361193f565b93611948565b5f92612215575b6001611ccf575b50505090565b54908083106121f3575b8083106121d1575b8083106121af575b80831061218d575b80831061216b575b808310612149575b808310612127575b808310612105575b8083106120e3575b8083106120c1575b80831061209f575b80831061207d575b80831061205b575b808310612039575b808310612017575b808310611ff5575b808310611fd3575b808310611fb1575b808310611f8f575b808310611f6d575b808310611f4b575b808310611f29575b808310611f07575b808310611ee5575b808310611ec3575b808310611ea1575b808310611e7f575b808310611e5d575b808310611e3b575b808310611e19575b808310611df7575b8210611dd6575b80611cc9565b82611dee60019394611de9602094611c87565b611978565b0191015f611dd0565b9192602081611e10600193611e0b86611c6d565b611978565b01930191611dc9565b9192602081611e32600193611e2d86611c53565b611978565b01930191611dc1565b9192602081611e54600193611e4f86611c39565b611978565b01930191611db9565b9192602081611e76600193611e7186611c25565b611978565b01930191611db1565b9192602081611e98600193611e9386611c0b565b611978565b01930191611da9565b9192602081611eba600193611eb586611bf1565b611978565b01930191611da1565b9192602081611edc600193611ed786611bd7565b611978565b01930191611d99565b9192602081611efe600193611ef986611bc3565b611978565b01930191611d91565b9192602081611f20600193611f1b86611ba9565b611978565b01930191611d89565b9192602081611f42600193611f3d86611b8f565b611978565b01930191611d81565b9192602081611f64600193611f5f86611b75565b611978565b01930191611d79565b9192602081611f86600193611f8186611b61565b611978565b01930191611d71565b9192602081611fa8600193611fa386611b47565b611978565b01930191611d69565b9192602081611fca600193611fc586611b2d565b611978565b01930191611d61565b9192602081611fec600193611fe786611b13565b611978565b01930191611d59565b919260208161200e60019361200986611aff565b611978565b01930191611d51565b919260208161203060019361202b86611ae5565b611978565b01930191611d49565b919260208161205260019361204d86611acb565b611978565b01930191611d41565b919260208161207460019361206f86611ab1565b611978565b01930191611d39565b919260208161209660019361209186611a9d565b611978565b01930191611d31565b91926020816120b86001936120b386611a83565b611978565b01930191611d29565b91926020816120da6001936120d586611a69565b611978565b01930191611d21565b91926020816120fc6001936120f786611a4f565b611978565b01930191611d19565b919260208161211e60019361211986611a3b565b611978565b01930191611d11565b919260208161214060019361213b86611a21565b611978565b01930191611d09565b919260208161216260019361215d86611a07565b611978565b01930191611d01565b919260208161218460019361217f866119ed565b611978565b01930191611cf9565b91926020816121a66001936121a1866119d9565b611978565b01930191611cf1565b91926020816121c86001936121c3866119bf565b611978565b01930191611ce9565b91926020816121ea6001936121e5866119a5565b611978565b01930191611ce1565b919260208161220c6001936122078661198b565b611978565b01930191611cd9565b5b81600160200384011015611cc25792835490806122328361198b565b9061223c91611978565b60200180612249836119a5565b9061225391611978565b60200180612260836119bf565b9061226a91611978565b60200180612277836119d9565b9061228191611978565b6020018061228e836119ed565b9061229891611978565b602001806122a583611a07565b906122af91611978565b602001806122bc83611a21565b906122c691611978565b602001806122d383611a3b565b906122dd91611978565b602001806122ea83611a4f565b906122f491611978565b6020018061230183611a69565b9061230b91611978565b6020018061231883611a83565b9061232291611978565b6020018061232f83611a9d565b9061233991611978565b6020018061234683611ab1565b9061235091611978565b6020018061235d83611acb565b9061236791611978565b6020018061237483611ae5565b9061237e91611978565b6020018061238b83611aff565b9061239591611978565b602001806123a283611b13565b906123ac91611978565b602001806123b983611b2d565b906123c391611978565b602001806123d083611b47565b906123da91611978565b602001806123e783611b61565b906123f191611978565b602001806123fe83611b75565b9061240891611978565b6020018061241583611b8f565b9061241f91611978565b6020018061242c83611ba9565b9061243691611978565b6020018061244383611bc3565b9061244d91611978565b6020018061245a83611bd7565b9061246491611978565b6020018061247183611bf1565b9061247b91611978565b6020018061248883611c0b565b9061249291611978565b6020018061249f83611c25565b906124a991611978565b602001806124b683611c39565b906124c091611978565b602001806124cd83611c53565b906124d791611978565b602001806124e483611c6d565b906124ee91611978565b6020016124fb8192611c87565b9061250591611978565b602001926001019160200191612216565b61258891600261253260a083015f85018482035f8601526107f0565b9261257961256f600183015461255461254a82610a08565b60208801906101a2565b61256a61256082610a22565b60408801906101a2565b6118df565b606085019061192e565b01906080818403910152611c9b565b90565b916125b7906125a96125c5959360608601908682035f88015261184d565b90848203602086015261184d565b916040818403910152612516565b90565b6125d0610052565b3d5f823e3d90fd5b634e487b7160e01b5f525f60045260245ffd5b5190565b90565b634e487b7160e01b5f52601160045260245ffd5b61261561261b919392936125ef565b926125ef565b916126278382026125ef565b92818404149015171561263657565b6125f2565b612646906003612606565b90565b9061265c905f19906020036008026105cd565b8154169055565b1b90565b9190600861268291029161267c5f1984612663565b92612663565b9181191691161790565b6126a061269b6126a5926125ef565b61061b565b6125ef565b90565b90565b91906126c16126bc6126c99361268c565b6126a8565b908354612667565b9055565b5f90565b6126e3916126dd6126cd565b916126ab565b565b5b8181106126f1575050565b806126fe5f6001936126d1565b016126e6565b90612714905f19906008026105cd565b191690565b8161272391612704565b906002021790565b905f9161274261273a826107e7565b928354612719565b905555565b601f602091010490565b919290602082105f146127aa57601f841160011461277a57612774929350612719565b90555b5b565b50906127a06127a5936001612797612791856107e7565b92612747565b820191016126e5565b61272b565b612777565b506127e182936127bb6001946107e7565b6127da6127c785612747565b820192601f8616806127ec575b50612747565b01906126e5565b600202179055612778565b6127f890888603612649565b5f6127d4565b92909168010000000000000000821161285e576020115f1461284f57602081105f146128335761282d91612719565b90555b5b565b60019160ff1916612843846107e7565b55600202019055612830565b60019150600202019055612831565b6106ad565b90815461286f816107bd565b90818311612898575b818310612886575b50505050565b61288f93612751565b5f808080612880565b6128a4838383876127fe565b612878565b5f6128b391612863565b565b905f036128c7576128c5906128a9565b565b6125d8565b600190818003010490565b5f80910155565b905f036128f0576128ee906128d7565b565b6125d8565b5b818110612901575050565b8061290e5f6001936128de565b016128f6565b9091828110612923575b505050565b61294161293b61293561294c956128cc565b926128cc565b926108e6565b9182019101906128f5565b5f808061291e565b9068010000000000000000811161297d578161297261297b936108ae565b90828155612914565b565b6106ad565b5f61298c91612954565b565b905f036129a05761299e90612982565b565b6125d8565b60089060018203010490565b5b8181106129bd575050565b806129ca5f6001936126d1565b016129b2565b9190918282106129e0575b505050565b600460086129f0612a18956129a5565b612a026129fc866129a5565b946109f6565b93840193019306025f8111612a20575b506129b1565b5f80806129db565b612a2d9060018303612649565b5f612a12565b90680100000000000000008111612a5c5781612a51612a5a936109f2565b908281556129d0565b565b6106ad565b5f612a6b91612a33565b565b905f03612a7f57612a7d90612a61565b565b6125d8565b5f6002612aaa92612a97838083016128b5565b612aa4836001830161298e565b01612a6d565b565b905f03612abe57612abc90612a84565b565b6125d8565b5b818110612acf575050565b80612adc5f600393612aac565b01612ac4565b9091828110612af1575b505050565b612b0f612b09612b03612b1a9561263b565b9261263b565b926107a0565b918201910190612ac3565b5f8080612aec565b90680100000000000000008111612b4b5781612b40612b4993610768565b90828155612ae2565b565b6106ad565b5190565b5190565b9190601f8111612b68575b505050565b612b74612b99936107e7565b906020612b8084612747565b83019310612ba1575b612b9290612747565b01906126e5565b5f8080612b63565b9150612b9281929050612b89565b90612bb981610082565b9067ffffffffffffffff8211612c7957612bdd82612bd785546107bd565b85612b58565b602090601f8311600114612c1157918091612c00935f92612c05575b5050612719565b90555b565b90915001515f80612bf9565b601f19831691612c20856107e7565b925f5b818110612c6157509160029391856001969410612c47575b50505002019055612c03565b612c57910151601f841690612704565b90555f8080612c3b565b91936020600181928787015181550195019201612c23565b6106ad565b90612c8891612baf565b565b5190565b5190565b612c9c90516100e8565b90565b5f1b90565b90612cbf6fffffffffffffffffffffffffffffffff91612c9f565b9181191691161790565b612cdd612cd8612ce2926100e8565b61061b565b6100e8565b90565b90565b90612cfd612cf8612d0492612cc9565b612ce5565b8254612ca4565b9055565b60801b90565b90612d2a6fffffffffffffffffffffffffffffffff1991612d08565b9181191691161790565b90612d49612d44612d5092612cc9565b612ce5565b8254612d0e565b9055565b90612d7e60205f612d8494612d76828201612d70848801612c92565b90612ce8565b019201612c92565b90612d34565b565b90612d9091612d54565b565b612db7612db1612da1846100d5565b93612dac8585612954565b6100e2565b916108e6565b5f915b838310612dc75750505050565b6001602082612ddf612dd98495612c8e565b86612d86565b01920192019190612dba565b90612df591612d92565b565b5190565b612e059051610199565b90565b91906008612e26910291612e2063ffffffff84612663565b92612663565b9181191691161790565b90565b90612e3d81610186565b9067ffffffffffffffff8211612f2257612e63612e6991612e5e8486612a33565b610193565b926109f6565b60088204915f5b838110612ed957506008830290035f8111612e8c575b50505050565b925f935f5b818110612ea65750505001555f808080612e86565b9091946020612ecd600192612ec2612ebd8a612dfb565b612e30565b908560040290612e08565b96019101919091612e91565b5f5f5b60088110612ef35750906001918185015501612e70565b95906020612f19600192612f0e612f0986612dfb565b612e30565b908a60040290612e08565b92019601612edc565b6106ad565b90612f3191612e33565b565b90612f7760406002612f7d94612f565f8201612f505f8801612b54565b90612c7e565b612f6f60018201612f6960208801612c8a565b90612deb565b019201612df7565b90612f27565b565b90612f8991612f33565b565b612fb0612faa612f9a8461006f565b93612fa58585612b22565b61007c565b916107a0565b5f915b838310612fc05750505050565b6003602082612fd9612fd3600195612b50565b86612f7f565b01920192019190612fb3565b90612fef91612f8b565b565b5190565b613000906002612606565b90565b600190818003010490565b5b81811061301a575050565b806130275f6001936128b5565b0161300f565b909182811061303c575b505050565b61305a61305461304e61306595613003565b92613003565b92610e7b565b91820191019061300e565b5f8080613037565b90680100000000000000008111613096578161308b61309493610e43565b9082815561302d565b565b6106ad565b5f6130a59161306d565b565b905f036130b9576130b79061309b565b565b6125d8565b5f60016130d7926130d1838083016128b5565b016130a7565b565b905f036130eb576130e9906130be565b565b6125d8565b5b8181106130fc575050565b806131095f6002936130d9565b016130f1565b909182811061311e575b505050565b61313c61313661313061314795612ff5565b92612ff5565b92610e3a565b9182019101906130f0565b5f8080613119565b90680100000000000000008111613178578161316d61317693610e02565b9082815561310f565b565b6106ad565b5190565b5190565b6131aa6131a4613194846102e9565b9361319f858561306d565b6102f6565b91610e7b565b5f915b8383106131ba5750505050565b60016020826131d26131cc8495612b54565b86612c7e565b019201920191906131ad565b906131e891613185565b565b906132156020600161321b9461320d5f82016132075f8801612b54565b90612c7e565b019201613181565b906131de565b565b90613227916131ea565b565b61324e613248613238846102d6565b93613243858561314f565b6102e3565b91610e3a565b5f915b83831061325e5750505050565b600260208261327761327160019561317d565b8661321d565b01920192019190613251565b9061328d91613229565b565b5190565b61329e906002612606565b90565b5f60016132ba926132b4838083016128b5565b016128b5565b565b905f036132ce576132cc906132a1565b565b6125d8565b5b8181106132df575050565b806132ec5f6002936132bc565b016132d4565b9091828110613301575b505050565b61331f61331961331361332a95613293565b92613293565b92610fbd565b9182019101906132d3565b5f80806132fc565b9068010000000000000000811161335b578161335061335993610f85565b908281556132f2565b565b6106ad565b5190565b9061338f60206001613395946133875f82016133815f8801612b54565b90612c7e565b019201612b54565b90612c7e565b565b906133a191613364565b565b6133c86133c26133b284610421565b936133bd8585613332565b61042e565b91610fbd565b5f915b8383106133d85750505050565b60026020826133f16133eb600195613360565b86613397565b019201920191906133cb565b90613407916133a3565b565b61341390516104df565b90565b9061342260ff91612c9f565b9181191691161790565b613435906104df565b90565b90565b9061345061344b6134579261342c565b613438565b8254613416565b9055565b906134b8606060036134be9461347e5f82016134785f88016125eb565b90612fe5565b6134976001820161349160208801612ff1565b90613283565b6134b0600282016134aa6040880161328f565b906133fd565b019201613409565b9061343b565b565b906134ca9161345b565b565b6134d59061063a565b90565b9060206134ff5f6135079401546134fa6134f1826108fa565b5f8601906100ee565b61092f565b9101906100ee565b565b90613516816040936134d8565b0190565b60010190565b9061353d613537613530846108ae565b80936100d9565b926108e6565b905f5b81811061354d5750505090565b90919261356561355f60019286613509565b9461351a565b9101919091613540565b6135af91600261359f61358e606084015f86018582035f8701526107f0565b600185018482036020860152613520565b9201906040818403910152610ac6565b90565b906135bc9161356f565b90565b60030190565b906135d96135d283610768565b8092610073565b90816135ea602083028401946107a0565b925f915b8383106135fd57505050505090565b9091929394602061361e6136188385600195038752896135b2565b976135bf565b93019301919392906135ee565b60010190565b9061364561363e83610e43565b80926102ed565b908161365660208302840194610e7b565b925f915b83831061366957505050505090565b9091929394602061368a61368483856001950387528961087c565b9761362b565b930193019193929061365a565b6136c39160016136b3604083015f85018482035f8601526107f0565b9201906020818403910152613631565b90565b906136d091613697565b90565b60020190565b906136ed6136e683610e02565b80926102da565b90816136fe60208302840194610e3a565b925f915b83831061371157505050505090565b9091929394602061373261372c8385600195038752896136c6565b976136d3565b9301930191939290613702565b61376b91600161375b604083015f85018482035f8601526107f0565b92019060208184039101526107f0565b90565b906137789161373f565b90565b60020190565b9061379561378e83610f85565b8092610425565b90816137a660208302840194610fbd565b925f915b8383106137b957505050505090565b909192939460206137da6137d483856001950387528961376e565b9761377b565b93019301919392906137aa565b90613841906060613839600361383161382061380f608087015f8a018882035f8a01526135c5565b6001890187820360208901526136d9565b600288018682036040880152613781565b950154611070565b9101906104e4565b90565b6138599160208201915f8184039101526137e7565b90565b61386d6138685f61113e565b610646565b5f63a28e7f6091600590613897836009956138a2600661388b610052565b9889978896879561114b565b85526004850161258b565b03925af18015613929576138bf915f91613907575b5060016134c0565b336001906139026138f07f5a1ed425a160d1bc929890b991acc0e3d25a6f5db1ac65c07ee4c917708f76d4926134cc565b926138f9610052565b91829182613844565b0390a2565b61392391503d805f833e61391b81836106c1565b81019061180f565b5f6138b7565b6125c856fea26469706673582212208a225bf79dc0821e5142fcebfa5d0bcfd9466b71de12c0acda5c1f199e4cc77064736f6c634300081c0033
|
opengradient/llm/og_langchain.py
CHANGED
|
@@ -17,7 +17,7 @@ from langchain_core.callbacks.manager import CallbackManagerForLLMRun
|
|
|
17
17
|
from langchain_core.tools import BaseTool
|
|
18
18
|
from langchain_core.messages import ToolCall
|
|
19
19
|
|
|
20
|
-
from opengradient import Client
|
|
20
|
+
from opengradient import Client, LlmInferenceMode
|
|
21
21
|
from opengradient.defaults import DEFAULT_RPC_URL, DEFAULT_INFERENCE_CONTRACT_ADDRESS
|
|
22
22
|
|
|
23
23
|
|
|
@@ -99,7 +99,8 @@ class OpenGradientChatModel(BaseChatModel):
|
|
|
99
99
|
messages=sdk_messages,
|
|
100
100
|
stop_sequence=stop,
|
|
101
101
|
max_tokens=self.max_tokens,
|
|
102
|
-
tools=self.tools
|
|
102
|
+
tools=self.tools,
|
|
103
|
+
inference_mode=LlmInferenceMode.VANILLA
|
|
103
104
|
)
|
|
104
105
|
|
|
105
106
|
if "tool_calls" in chat_response and chat_response["tool_calls"]:
|
opengradient/llm/og_openai.py
CHANGED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import Callable, Dict, Any, Type
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
from langchain_core.tools import BaseTool, StructuredTool
|
|
6
|
+
import opengradient as og
|
|
7
|
+
|
|
8
|
+
class ToolType(str, Enum):
|
|
9
|
+
"""Indicates the framework the tool is compatible with."""
|
|
10
|
+
|
|
11
|
+
LANGCHAIN = "langchain"
|
|
12
|
+
SWARM = "swarm"
|
|
13
|
+
|
|
14
|
+
def __str__(self) -> str:
|
|
15
|
+
return self.value
|
|
16
|
+
|
|
17
|
+
def create_og_model_tool(
|
|
18
|
+
tool_type: ToolType,
|
|
19
|
+
model_cid: str,
|
|
20
|
+
tool_name: str,
|
|
21
|
+
input_getter: Callable,
|
|
22
|
+
output_formatter: Callable[..., str],
|
|
23
|
+
input_schema: Type[BaseModel] = None,
|
|
24
|
+
tool_description: str = "Executes the given ML model",
|
|
25
|
+
inference_mode: og.InferenceMode= og.InferenceMode.VANILLA) -> BaseTool:
|
|
26
|
+
"""
|
|
27
|
+
Creates a tool that wraps an OpenGradient model for inference.
|
|
28
|
+
|
|
29
|
+
This function generates a tool that can be integrated into either a LangChain pipeline
|
|
30
|
+
or a Swarm system, allowing the model to be executed as part of a chain of operations.
|
|
31
|
+
The tool uses the provided input_getter function to obtain the necessary input data and
|
|
32
|
+
runs inference using the specified OpenGradient model.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
tool_type (ToolType): Specifies the framework to create the tool for. Use
|
|
36
|
+
ToolType.LANGCHAIN for LangChain integration or ToolType.SWARM for Swarm
|
|
37
|
+
integration.
|
|
38
|
+
model_cid (str): The CID of the OpenGradient model to be executed.
|
|
39
|
+
tool_name (str): The name to assign to the created tool. This will be used to identify
|
|
40
|
+
and invoke the tool within the agent.
|
|
41
|
+
input_getter (Callable): A function that returns the input data required by the model.
|
|
42
|
+
The function should return data in a format compatible with the model's expectations.
|
|
43
|
+
output_formatter (Callable[..., str]): A function that takes the model output and
|
|
44
|
+
formats it into a string. This is required to ensure the output is compatible
|
|
45
|
+
with the tool framework.
|
|
46
|
+
input_schema (Type[BaseModel], optional): A Pydantic BaseModel class defining the
|
|
47
|
+
input schema. This will be used directly for LangChain tools and converted
|
|
48
|
+
to appropriate annotations for Swarm tools. Default is None.
|
|
49
|
+
tool_description (str, optional): A description of what the tool does. Defaults to
|
|
50
|
+
"Executes the given ML model".
|
|
51
|
+
inference_mode (og.InferenceMode, optional): The inference mode to use when running
|
|
52
|
+
the model. Defaults to VANILLA.
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
BaseTool: For ToolType.LANGCHAIN, returns a LangChain StructuredTool.
|
|
56
|
+
Callable: For ToolType.SWARM, returns a decorated function with appropriate metadata.
|
|
57
|
+
|
|
58
|
+
Raises:
|
|
59
|
+
ValueError: If an invalid tool_type is provided.
|
|
60
|
+
|
|
61
|
+
Examples:
|
|
62
|
+
>>> from pydantic import BaseModel, Field
|
|
63
|
+
>>> class ClassifierInput(BaseModel):
|
|
64
|
+
... query: str = Field(description="User query to analyze")
|
|
65
|
+
... parameters: dict = Field(description="Additional parameters")
|
|
66
|
+
>>> def get_input():
|
|
67
|
+
... return {"text": "Sample input text"}
|
|
68
|
+
>>> def format_output(output):
|
|
69
|
+
... return str(output.get("class", "Unknown"))
|
|
70
|
+
>>> # Create a LangChain tool
|
|
71
|
+
>>> langchain_tool = create_og_model_tool(
|
|
72
|
+
... tool_type=ToolType.LANGCHAIN,
|
|
73
|
+
... model_cid="Qm...",
|
|
74
|
+
... tool_name="text_classifier",
|
|
75
|
+
... input_getter=get_input,
|
|
76
|
+
... output_formatter=format_output,
|
|
77
|
+
... input_schema=ClassifierInput
|
|
78
|
+
... tool_description="Classifies text into categories"
|
|
79
|
+
... )
|
|
80
|
+
"""
|
|
81
|
+
# define runnable
|
|
82
|
+
def model_executor(**llm_input):
|
|
83
|
+
# Combine LLM input with input provided by code
|
|
84
|
+
combined_input = {
|
|
85
|
+
**llm_input,
|
|
86
|
+
**input_getter()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
_, output = og.infer(
|
|
90
|
+
model_cid=model_cid,
|
|
91
|
+
inference_mode=inference_mode,
|
|
92
|
+
model_input=combined_input
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
return output_formatter(output)
|
|
96
|
+
|
|
97
|
+
if tool_type == ToolType.LANGCHAIN:
|
|
98
|
+
return StructuredTool.from_function(
|
|
99
|
+
func=model_executor,
|
|
100
|
+
name=tool_name,
|
|
101
|
+
description=tool_description,
|
|
102
|
+
args_schema=input_schema
|
|
103
|
+
)
|
|
104
|
+
elif tool_type == ToolType.SWARM:
|
|
105
|
+
model_executor.__name__ = tool_name
|
|
106
|
+
model_executor.__doc__ = tool_description
|
|
107
|
+
# Convert Pydantic model to Swarm annotations if provided
|
|
108
|
+
if input_schema:
|
|
109
|
+
model_executor.__annotations__ = _convert_pydantic_to_annotations(input_schema)
|
|
110
|
+
return model_executor
|
|
111
|
+
else:
|
|
112
|
+
raise ValueError(f"Invalid tooltype: {tool_type}")
|
|
113
|
+
|
|
114
|
+
def _convert_pydantic_to_annotations(model: Type[BaseModel]) -> Dict[str, Any]:
|
|
115
|
+
"""
|
|
116
|
+
Convert a Pydantic model to function annotations format used by Swarm.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
model: A Pydantic BaseModel class
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
Dict mapping field names to (type, description) tuples
|
|
123
|
+
"""
|
|
124
|
+
annotations = {}
|
|
125
|
+
for field_name, field in model.model_fields.items():
|
|
126
|
+
field_type = field.annotation
|
|
127
|
+
description = field.description or ""
|
|
128
|
+
annotations[field_name] = (field_type, description)
|
|
129
|
+
return annotations
|
opengradient/types.py
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import List, Tuple, Union
|
|
3
|
-
from enum import Enum
|
|
3
|
+
from enum import Enum, IntEnum
|
|
4
|
+
|
|
5
|
+
class CandleOrder(IntEnum):
|
|
6
|
+
ASCENDING = 0
|
|
7
|
+
DESCENDING = 1
|
|
8
|
+
|
|
9
|
+
class CandleType(IntEnum):
|
|
10
|
+
HIGH = 0
|
|
11
|
+
LOW = 1
|
|
12
|
+
OPEN = 2
|
|
13
|
+
CLOSE = 3
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class HistoricalInputQuery:
|
|
17
|
+
currency_pair: str
|
|
18
|
+
total_candles: int
|
|
19
|
+
candle_duration_in_mins: int
|
|
20
|
+
order: CandleOrder
|
|
21
|
+
candle_types: List[CandleType]
|
|
22
|
+
|
|
23
|
+
def to_abi_format(self) -> tuple:
|
|
24
|
+
"""Convert to format expected by contract ABI"""
|
|
25
|
+
return (
|
|
26
|
+
self.currency_pair,
|
|
27
|
+
self.total_candles,
|
|
28
|
+
self.candle_duration_in_mins,
|
|
29
|
+
int(self.order),
|
|
30
|
+
[int(ct) for ct in self.candle_types]
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def from_dict(cls, data: dict) -> 'HistoricalInputQuery':
|
|
35
|
+
"""Create HistoricalInputQuery from dictionary format"""
|
|
36
|
+
order = CandleOrder[data['order'].upper()]
|
|
37
|
+
candle_types = [CandleType[ct.upper()] for ct in data['candle_types']]
|
|
38
|
+
|
|
39
|
+
return cls(
|
|
40
|
+
currency_pair=data['currency_pair'],
|
|
41
|
+
total_candles=int(data['total_candles']),
|
|
42
|
+
candle_duration_in_mins=int(data['candle_duration_in_mins']),
|
|
43
|
+
order=order,
|
|
44
|
+
candle_types=candle_types
|
|
45
|
+
)
|
|
4
46
|
|
|
5
47
|
@dataclass
|
|
6
48
|
class Number:
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: opengradient
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.22
|
|
4
4
|
Summary: Python SDK for OpenGradient decentralized model management & inference services
|
|
5
|
-
Project-URL: Homepage, https://opengradient.ai
|
|
6
5
|
Author-email: OpenGradient <oliver@opengradient.ai>
|
|
7
6
|
License: MIT License
|
|
8
7
|
|
|
@@ -25,7 +24,8 @@ License: MIT License
|
|
|
25
24
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
25
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
26
|
SOFTWARE.
|
|
28
|
-
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://opengradient.ai
|
|
29
29
|
Classifier: Development Status :: 3 - Alpha
|
|
30
30
|
Classifier: Intended Audience :: Developers
|
|
31
31
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -33,13 +33,15 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
33
33
|
Classifier: Programming Language :: Python :: 3.11
|
|
34
34
|
Classifier: Programming Language :: Python :: 3.12
|
|
35
35
|
Requires-Python: >=3.10
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
License-File: LICENSE
|
|
36
38
|
Requires-Dist: aiohappyeyeballs>=2.4.3
|
|
37
39
|
Requires-Dist: aiohttp>=3.10.8
|
|
38
40
|
Requires-Dist: aiosignal>=1.3.1
|
|
39
41
|
Requires-Dist: annotated-types>=0.7.0
|
|
40
42
|
Requires-Dist: attrs>=24.2.0
|
|
41
43
|
Requires-Dist: bitarray>=2.9.2
|
|
42
|
-
Requires-Dist:
|
|
44
|
+
Requires-Dist: CacheControl>=0.14.0
|
|
43
45
|
Requires-Dist: cachetools>=5.5.0
|
|
44
46
|
Requires-Dist: certifi>=2024.8.30
|
|
45
47
|
Requires-Dist: cffi>=1.17.1
|
|
@@ -53,7 +55,6 @@ Requires-Dist: cryptography>=43.0.1
|
|
|
53
55
|
Requires-Dist: cytoolz>=0.12.3
|
|
54
56
|
Requires-Dist: distlib>=0.3.8
|
|
55
57
|
Requires-Dist: dulwich>=0.21.7
|
|
56
|
-
Requires-Dist: eth-abi>=5.1.0
|
|
57
58
|
Requires-Dist: eth-account>=0.13.4
|
|
58
59
|
Requires-Dist: eth-hash>=0.7.0
|
|
59
60
|
Requires-Dist: eth-keyfile>=0.8.1
|
|
@@ -61,6 +62,7 @@ Requires-Dist: eth-keys>=0.5.1
|
|
|
61
62
|
Requires-Dist: eth-rlp>=2.1.0
|
|
62
63
|
Requires-Dist: eth-typing>=5.0.0
|
|
63
64
|
Requires-Dist: eth-utils>=5.0.0
|
|
65
|
+
Requires-Dist: eth_abi>=5.1.0
|
|
64
66
|
Requires-Dist: fastjsonschema>=2.20.0
|
|
65
67
|
Requires-Dist: fastparquet>=2024.5.0
|
|
66
68
|
Requires-Dist: filelock>=3.16.1
|
|
@@ -75,11 +77,12 @@ Requires-Dist: google-cloud-storage>=2.18.2
|
|
|
75
77
|
Requires-Dist: google-crc32c>=1.6.0
|
|
76
78
|
Requires-Dist: google-resumable-media>=2.7.2
|
|
77
79
|
Requires-Dist: googleapis-common-protos>=1.65.0
|
|
78
|
-
Requires-Dist: grpcio-tools>=1.66.2
|
|
79
80
|
Requires-Dist: grpcio>=1.66.2
|
|
81
|
+
Requires-Dist: grpcio-tools>=1.66.2
|
|
82
|
+
Requires-Dist: protobuf>=4.24.0
|
|
80
83
|
Requires-Dist: hexbytes>=1.2.1
|
|
81
84
|
Requires-Dist: idna>=3.10
|
|
82
|
-
Requires-Dist: jaraco
|
|
85
|
+
Requires-Dist: jaraco.classes>=3.4.0
|
|
83
86
|
Requires-Dist: jwcrypto>=1.5.6
|
|
84
87
|
Requires-Dist: keyring>=24.3.1
|
|
85
88
|
Requires-Dist: langchain>=0.3.7
|
|
@@ -96,25 +99,24 @@ Requires-Dist: pkce>=1.0.3
|
|
|
96
99
|
Requires-Dist: pkginfo>=1.11.1
|
|
97
100
|
Requires-Dist: platformdirs>=4.3.6
|
|
98
101
|
Requires-Dist: proto-plus>=1.24.0
|
|
99
|
-
Requires-Dist: protobuf>=4.24.0
|
|
100
102
|
Requires-Dist: protobuf>=5.28.2
|
|
101
103
|
Requires-Dist: ptyprocess>=0.7.0
|
|
102
104
|
Requires-Dist: pyarrow>=17.0.0
|
|
103
|
-
Requires-Dist: pyasn1-modules>=0.4.1
|
|
104
105
|
Requires-Dist: pyasn1>=0.6.1
|
|
106
|
+
Requires-Dist: pyasn1_modules>=0.4.1
|
|
105
107
|
Requires-Dist: pycparser>=2.22
|
|
106
108
|
Requires-Dist: pycryptodome>=3.21.0
|
|
107
|
-
Requires-Dist: pydantic-core>=2.23.4
|
|
108
109
|
Requires-Dist: pydantic>=2.9.2
|
|
109
|
-
Requires-Dist:
|
|
110
|
+
Requires-Dist: pydantic_core>=2.23.4
|
|
111
|
+
Requires-Dist: pyproject_hooks>=1.2.0
|
|
110
112
|
Requires-Dist: python-dateutil>=2.9.0.post0
|
|
111
113
|
Requires-Dist: python-jwt>=4.1.0
|
|
112
114
|
Requires-Dist: pytz>=2024.2
|
|
113
115
|
Requires-Dist: pyunormalize>=16.0.0
|
|
114
|
-
Requires-Dist:
|
|
116
|
+
Requires-Dist: RapidFuzz>=3.10.0
|
|
115
117
|
Requires-Dist: regex>=2024.9.11
|
|
116
|
-
Requires-Dist: requests-toolbelt>=1.0.0
|
|
117
118
|
Requires-Dist: requests>=2.32.3
|
|
119
|
+
Requires-Dist: requests-toolbelt>=1.0.0
|
|
118
120
|
Requires-Dist: rlp>=4.0.1
|
|
119
121
|
Requires-Dist: rsa>=4.9
|
|
120
122
|
Requires-Dist: shellingham>=1.5.4
|
|
@@ -123,14 +125,13 @@ Requires-Dist: tomlkit>=0.13.2
|
|
|
123
125
|
Requires-Dist: toolz>=0.12.1
|
|
124
126
|
Requires-Dist: trove-classifiers>=2024.9.12
|
|
125
127
|
Requires-Dist: types-requests>=2.32.0.20240914
|
|
126
|
-
Requires-Dist:
|
|
128
|
+
Requires-Dist: typing_extensions>=4.12.2
|
|
127
129
|
Requires-Dist: tzdata>=2024.2
|
|
128
130
|
Requires-Dist: urllib3>=2.2.3
|
|
129
131
|
Requires-Dist: web3>=7.3.0
|
|
130
132
|
Requires-Dist: websockets>=13.1
|
|
131
133
|
Requires-Dist: xattr>=1.1.0
|
|
132
134
|
Requires-Dist: yarl>=1.13.1
|
|
133
|
-
Description-Content-Type: text/markdown
|
|
134
135
|
|
|
135
136
|
# OpenGradient Python SDK
|
|
136
137
|
Python SDK for the OpenGradient platform provides decentralized model management & inference services. Python SDK allows programmatic access to our model repository and decentralized AI infrastructure.
|
|
@@ -272,4 +273,4 @@ Or you can use files instead of text input in order to simplify your command:
|
|
|
272
273
|
opengradient chat --model "mistralai/Mistral-7B-Instruct-v0.3" --messages-file messages.json --tools-file tools.json --max-tokens 200
|
|
273
274
|
```
|
|
274
275
|
|
|
275
|
-
For more information read the OpenGradient [documentation](https://docs.opengradient.ai/).
|
|
276
|
+
For more information read the OpenGradient [documentation](https://docs.opengradient.ai/).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
opengradient/__init__.py,sha256=g6uHW_AlVFF_Pdo0v5VFC29iEEPDHQfYl-HzBZVJPDI,11524
|
|
2
|
+
opengradient/account.py,sha256=2B7rtCXQDX-yF4U69h8B9-OUreJU4IqoGXG_1Hn9nWs,1150
|
|
3
|
+
opengradient/cli.py,sha256=vYE_zr1oKYOkiAEWRyW3cR6jJQr6xKterjI1grhmROg,26399
|
|
4
|
+
opengradient/client.py,sha256=WUXt-XJygaH6F5oC1LtEC4uk_TJC7-55mCaeYzDJ3aY,40164
|
|
5
|
+
opengradient/defaults.py,sha256=6tsW9Z84z6YtITCsULTTgnN0KRUZjfSoeWJZqdWkYCo,384
|
|
6
|
+
opengradient/exceptions.py,sha256=v4VmUGTvvtjhCZAhR24Ga42z3q-DzR1Y5zSqP_yn2Xk,3366
|
|
7
|
+
opengradient/types.py,sha256=Lw-SF2GwTVyMu7_R5dql_2VsPNoGNPL3syfHs18X75s,3658
|
|
8
|
+
opengradient/utils.py,sha256=lUDPmyPqLwpZI-owyN6Rm3QvUjOn5pLN5G1QyriVm-E,6994
|
|
9
|
+
opengradient/abi/ModelExecutorHistorical.abi,sha256=Z-2CQRG2BO5R-Ix1OLgQD9GCcHZw8w6-Zth3rzNX0TU,3278
|
|
10
|
+
opengradient/abi/inference.abi,sha256=MR5u9npZ-Yx2EqRW17_M-UnGgFF3mMEMepOwaZ-Bkgc,7040
|
|
11
|
+
opengradient/contracts/templates/ModelExecutorHistorical.bin,sha256=J_bHglQOXEsv44BkBkMvA9uWz7c9c8gdqqSb0KxIzkI,34924
|
|
12
|
+
opengradient/llm/__init__.py,sha256=J1W_AKPntqlDqLeflhn2x7A0i-dkMT-ol3jlEdFgMWU,1135
|
|
13
|
+
opengradient/llm/og_langchain.py,sha256=-QBGFdQJ1cdSCTUUerajHXNvV5Xi9yaVpa3BeAqKZbQ,4541
|
|
14
|
+
opengradient/llm/og_openai.py,sha256=3oaQOQnA7RzQ-LcFw-AQRn2RON8tsprSa9bGtyD88OE,3853
|
|
15
|
+
opengradient/mltools/__init__.py,sha256=cfzf6lZmqLNN1efa5K_pCa7k1D5PnRkB6LNyJ9UeJvk,162
|
|
16
|
+
opengradient/mltools/model_tool.py,sha256=q1k3Zq7jmRe-8HqP_-ia-p7ocDRcSn18T4gbNM9xlD0,5237
|
|
17
|
+
opengradient/proto/__init__.py,sha256=AhaSmrqV0TXGzCKaoPV8-XUvqs2fGAJBM2aOmDpkNbE,55
|
|
18
|
+
opengradient/proto/infer.proto,sha256=13eaEMcppxkBF8yChptsX9HooWFwJKze7oLZNl-LEb8,1217
|
|
19
|
+
opengradient/proto/infer_pb2.py,sha256=wg2vjLQCNv6HRhYuIqgj9xivi3nO4IPz6E5wh2dhDqY,3446
|
|
20
|
+
opengradient/proto/infer_pb2_grpc.py,sha256=y5GYwD1EdNs892xx58jdfyA0fO5QC7k3uZOtImTHMiE,6891
|
|
21
|
+
opengradient-0.3.22.dist-info/LICENSE,sha256=xEcvQ3AxZOtDkrqkys2Mm6Y9diEnaSeQRKvxi-JGnNA,1069
|
|
22
|
+
opengradient-0.3.22.dist-info/METADATA,sha256=q2tugCQdfo-675y6Z8ETQIP87Yh6ThNfrbQO4DaGQtw,8754
|
|
23
|
+
opengradient-0.3.22.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
24
|
+
opengradient-0.3.22.dist-info/entry_points.txt,sha256=yUKTaJx8RXnybkob0J62wVBiCp_1agVbgw9uzsmaeJc,54
|
|
25
|
+
opengradient-0.3.22.dist-info/top_level.txt,sha256=oC1zimVLa2Yi1LQz8c7x-0IQm92milb5ax8gHBHwDqU,13
|
|
26
|
+
opengradient-0.3.22.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
opengradient
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
opengradient/__init__.py,sha256=2kBCVdEjuZvLDFjivX_aQSn7wnTLxYVTixy4jLQSXts,9262
|
|
2
|
-
opengradient/account.py,sha256=2B7rtCXQDX-yF4U69h8B9-OUreJU4IqoGXG_1Hn9nWs,1150
|
|
3
|
-
opengradient/cli.py,sha256=niN8tlLaiVEpdtkdWEUbxidG75nxrlb6mMUfUAIjiVw,26400
|
|
4
|
-
opengradient/client.py,sha256=axMbfqAQ6OWq3sM_D4bGVWrpAd-15Ru-bOHJ6R6GruA,35197
|
|
5
|
-
opengradient/defaults.py,sha256=6tsW9Z84z6YtITCsULTTgnN0KRUZjfSoeWJZqdWkYCo,384
|
|
6
|
-
opengradient/exceptions.py,sha256=v4VmUGTvvtjhCZAhR24Ga42z3q-DzR1Y5zSqP_yn2Xk,3366
|
|
7
|
-
opengradient/types.py,sha256=-lGWv_yfXMN48bbvARKIFrj1L0AotIwr2c7GOv1JBcI,2464
|
|
8
|
-
opengradient/utils.py,sha256=lUDPmyPqLwpZI-owyN6Rm3QvUjOn5pLN5G1QyriVm-E,6994
|
|
9
|
-
opengradient/abi/inference.abi,sha256=MR5u9npZ-Yx2EqRW17_M-UnGgFF3mMEMepOwaZ-Bkgc,7040
|
|
10
|
-
opengradient/llm/__init__.py,sha256=J1W_AKPntqlDqLeflhn2x7A0i-dkMT-ol3jlEdFgMWU,1135
|
|
11
|
-
opengradient/llm/og_langchain.py,sha256=F32yN1o8EvRbzZSJkUwI0-FmSVAWMuMTI9ho7wgW5hk,4470
|
|
12
|
-
opengradient/llm/og_openai.py,sha256=GilEkIVDac5Cacennb7YNXD6BKwUj69mfnMkvxkiW5Y,3865
|
|
13
|
-
opengradient/proto/__init__.py,sha256=AhaSmrqV0TXGzCKaoPV8-XUvqs2fGAJBM2aOmDpkNbE,55
|
|
14
|
-
opengradient/proto/infer.proto,sha256=13eaEMcppxkBF8yChptsX9HooWFwJKze7oLZNl-LEb8,1217
|
|
15
|
-
opengradient/proto/infer_pb2.py,sha256=wg2vjLQCNv6HRhYuIqgj9xivi3nO4IPz6E5wh2dhDqY,3446
|
|
16
|
-
opengradient/proto/infer_pb2_grpc.py,sha256=y5GYwD1EdNs892xx58jdfyA0fO5QC7k3uZOtImTHMiE,6891
|
|
17
|
-
opengradient-0.3.20.dist-info/METADATA,sha256=ePeui6GaKauFQNAKa-ZRNx0VKWjVOKg0ZZYN77Mjiew,8744
|
|
18
|
-
opengradient-0.3.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
19
|
-
opengradient-0.3.20.dist-info/entry_points.txt,sha256=yUKTaJx8RXnybkob0J62wVBiCp_1agVbgw9uzsmaeJc,54
|
|
20
|
-
opengradient-0.3.20.dist-info/licenses/LICENSE,sha256=xEcvQ3AxZOtDkrqkys2Mm6Y9diEnaSeQRKvxi-JGnNA,1069
|
|
21
|
-
opengradient-0.3.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|