opengradient 0.5.0a2__py3-none-any.whl → 0.5.1__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/client.py +227 -66
- opengradient/defaults.py +2 -1
- opengradient/types.py +53 -3
- {opengradient-0.5.0a2.dist-info → opengradient-0.5.1.dist-info}/METADATA +2 -1
- {opengradient-0.5.0a2.dist-info → opengradient-0.5.1.dist-info}/RECORD +9 -9
- {opengradient-0.5.0a2.dist-info → opengradient-0.5.1.dist-info}/WHEEL +0 -0
- {opengradient-0.5.0a2.dist-info → opengradient-0.5.1.dist-info}/entry_points.txt +0 -0
- {opengradient-0.5.0a2.dist-info → opengradient-0.5.1.dist-info}/licenses/LICENSE +0 -0
- {opengradient-0.5.0a2.dist-info → opengradient-0.5.1.dist-info}/top_level.txt +0 -0
opengradient/client.py
CHANGED
|
@@ -14,6 +14,9 @@ from web3 import Web3
|
|
|
14
14
|
from web3.exceptions import ContractLogicError
|
|
15
15
|
from web3.logs import DISCARD
|
|
16
16
|
import urllib.parse
|
|
17
|
+
import asyncio
|
|
18
|
+
from x402.clients.httpx import x402HttpxClient
|
|
19
|
+
from x402.clients.base import decode_x_payment_response, x402Client
|
|
17
20
|
|
|
18
21
|
from .exceptions import OpenGradientError
|
|
19
22
|
from .proto import infer_pb2, infer_pb2_grpc
|
|
@@ -30,7 +33,12 @@ from .types import (
|
|
|
30
33
|
ModelRepository,
|
|
31
34
|
FileUploadResult,
|
|
32
35
|
)
|
|
33
|
-
from .defaults import
|
|
36
|
+
from .defaults import (
|
|
37
|
+
DEFAULT_IMAGE_GEN_HOST,
|
|
38
|
+
DEFAULT_IMAGE_GEN_PORT,
|
|
39
|
+
DEFAULT_SCHEDULER_ADDRESS,
|
|
40
|
+
DEFAULT_LLM_SERVER_URL,
|
|
41
|
+
DEFAULT_OPENGRADIENT_LLM_SERVER_URL)
|
|
34
42
|
from .utils import convert_array_to_model_output, convert_to_model_input, convert_to_model_output
|
|
35
43
|
|
|
36
44
|
_FIREBASE_CONFIG = {
|
|
@@ -53,6 +61,9 @@ DEFAULT_RETRY_DELAY_SEC = 1
|
|
|
53
61
|
|
|
54
62
|
PRECOMPILE_CONTRACT_ADDRESS = "0x00000000000000000000000000000000000000F4"
|
|
55
63
|
|
|
64
|
+
X402_PROCESSING_HASH_HEADER = "x-processing-hash"
|
|
65
|
+
X402_PLACEHOLDER_API_KEY = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
|
|
66
|
+
|
|
56
67
|
class Client:
|
|
57
68
|
_inference_hub_contract_address: str
|
|
58
69
|
_blockchain: Web3
|
|
@@ -73,6 +84,7 @@ class Client:
|
|
|
73
84
|
email: Optional[str] = None,
|
|
74
85
|
password: Optional[str] = None,
|
|
75
86
|
llm_server_url: Optional[str] = DEFAULT_LLM_SERVER_URL,
|
|
87
|
+
og_llm_server_url: Optional[str] = DEFAULT_OPENGRADIENT_LLM_SERVER_URL,
|
|
76
88
|
openai_api_key: Optional[str] = None,
|
|
77
89
|
anthropic_api_key: Optional[str] = None,
|
|
78
90
|
google_api_key: Optional[str] = None,
|
|
@@ -106,6 +118,7 @@ class Client:
|
|
|
106
118
|
self._hub_user = None
|
|
107
119
|
|
|
108
120
|
self._llm_server_url = llm_server_url
|
|
121
|
+
self._og_llm_server_url = og_llm_server_url
|
|
109
122
|
|
|
110
123
|
self._external_api_keys = {}
|
|
111
124
|
if openai_api_key or os.getenv("OPENAI_API_KEY"):
|
|
@@ -404,6 +417,15 @@ class Client:
|
|
|
404
417
|
|
|
405
418
|
return run_with_retry(execute_transaction, max_retries)
|
|
406
419
|
|
|
420
|
+
def _og_payment_selector(self, accepts, network_filter=None, scheme_filter=None, max_value=None):
|
|
421
|
+
"""Custom payment selector for OpenGradient network (og-devnet)."""
|
|
422
|
+
return x402Client.default_payment_requirements_selector(
|
|
423
|
+
accepts,
|
|
424
|
+
network_filter="og-devnet",
|
|
425
|
+
scheme_filter=scheme_filter,
|
|
426
|
+
max_value=max_value,
|
|
427
|
+
)
|
|
428
|
+
|
|
407
429
|
def llm_completion(
|
|
408
430
|
self,
|
|
409
431
|
model_cid: str, # Changed from LLM to str to accept any model
|
|
@@ -437,7 +459,11 @@ class Client:
|
|
|
437
459
|
OpenGradientError: If the inference fails.
|
|
438
460
|
"""
|
|
439
461
|
# Check if this is a local model or external
|
|
440
|
-
|
|
462
|
+
# TODO (Kyle): separate TEE and Vanilla completion requests
|
|
463
|
+
if inference_mode == LlmInferenceMode.TEE:
|
|
464
|
+
if model_cid not in TEE_LLM:
|
|
465
|
+
return OpenGradientError("That model CID is not supported yet for TEE inference")
|
|
466
|
+
|
|
441
467
|
return self._external_llm_completion(
|
|
442
468
|
model=model_cid,
|
|
443
469
|
prompt=prompt,
|
|
@@ -448,11 +474,11 @@ class Client:
|
|
|
448
474
|
|
|
449
475
|
# Original local model logic
|
|
450
476
|
def execute_transaction():
|
|
451
|
-
if inference_mode != LlmInferenceMode.VANILLA
|
|
477
|
+
if inference_mode != LlmInferenceMode.VANILLA:
|
|
452
478
|
raise OpenGradientError("Invalid inference mode %s: Inference mode must be VANILLA or TEE" % inference_mode)
|
|
453
479
|
|
|
454
|
-
if
|
|
455
|
-
raise OpenGradientError("That model CID is not
|
|
480
|
+
if model_cid not in [llm.value for llm in LLM]:
|
|
481
|
+
raise OpenGradientError("That model CID is not yet supported for inference")
|
|
456
482
|
|
|
457
483
|
contract = self._blockchain.eth.contract(address=self._inference_hub_contract_address, abi=self._inference_abi)
|
|
458
484
|
|
|
@@ -488,7 +514,7 @@ class Client:
|
|
|
488
514
|
temperature: float = 0.0,
|
|
489
515
|
) -> TextGenerationOutput:
|
|
490
516
|
"""
|
|
491
|
-
Route completion request to external LLM server.
|
|
517
|
+
Route completion request to external LLM server with x402 payments.
|
|
492
518
|
|
|
493
519
|
Args:
|
|
494
520
|
model: Model identifier
|
|
@@ -503,35 +529,96 @@ class Client:
|
|
|
503
529
|
Raises:
|
|
504
530
|
OpenGradientError: If request fails
|
|
505
531
|
"""
|
|
506
|
-
url = f"{self._llm_server_url}/v1/completions"
|
|
507
|
-
|
|
508
|
-
headers = {"Content-Type": "application/json"}
|
|
509
532
|
api_key = self._get_api_key_for_model(model)
|
|
533
|
+
|
|
510
534
|
if api_key:
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
payload = {
|
|
514
|
-
"model": model,
|
|
515
|
-
"prompt": prompt,
|
|
516
|
-
"max_tokens": max_tokens,
|
|
517
|
-
"temperature": temperature,
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
if stop_sequence:
|
|
521
|
-
payload["stop"] = stop_sequence
|
|
522
|
-
|
|
523
|
-
try:
|
|
524
|
-
response = requests.post(url, json=payload, headers=headers, timeout=60)
|
|
525
|
-
response.raise_for_status()
|
|
535
|
+
logging.debug("External LLM completions using API key")
|
|
536
|
+
url = f"{self._llm_server_url}/v1/completions"
|
|
526
537
|
|
|
527
|
-
|
|
538
|
+
headers = {
|
|
539
|
+
"Content-Type": "application/json",
|
|
540
|
+
"Authorization": f"Bearer {api_key}"
|
|
541
|
+
}
|
|
528
542
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
543
|
+
payload = {
|
|
544
|
+
"model": model,
|
|
545
|
+
"prompt": prompt,
|
|
546
|
+
"max_tokens": max_tokens,
|
|
547
|
+
"temperature": temperature,
|
|
548
|
+
}
|
|
533
549
|
|
|
534
|
-
|
|
550
|
+
if stop_sequence:
|
|
551
|
+
payload["stop"] = stop_sequence
|
|
552
|
+
|
|
553
|
+
try:
|
|
554
|
+
response = requests.post(url, json=payload, headers=headers, timeout=60)
|
|
555
|
+
response.raise_for_status()
|
|
556
|
+
|
|
557
|
+
result = response.json()
|
|
558
|
+
|
|
559
|
+
return TextGenerationOutput(
|
|
560
|
+
transaction_hash="external",
|
|
561
|
+
completion_output=result.get("completion")
|
|
562
|
+
)
|
|
563
|
+
|
|
564
|
+
except requests.RequestException as e:
|
|
565
|
+
error_msg = f"External LLM completion failed: {str(e)}"
|
|
566
|
+
if hasattr(e, 'response') and e.response is not None:
|
|
567
|
+
try:
|
|
568
|
+
error_detail = e.response.json()
|
|
569
|
+
error_msg += f" - {error_detail}"
|
|
570
|
+
except:
|
|
571
|
+
error_msg += f" - {e.response.text}"
|
|
572
|
+
logging.error(error_msg)
|
|
573
|
+
raise OpenGradientError(error_msg)
|
|
574
|
+
|
|
575
|
+
async def make_request():
|
|
576
|
+
async with x402HttpxClient(
|
|
577
|
+
account=self._wallet_account,
|
|
578
|
+
base_url=self._og_llm_server_url,
|
|
579
|
+
payment_requirements_selector=self._og_payment_selector,
|
|
580
|
+
) as client:
|
|
581
|
+
headers = {
|
|
582
|
+
"Content-Type": "application/json",
|
|
583
|
+
"Authorization": f"Bearer {X402_PLACEHOLDER_API_KEY}"
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
payload = {
|
|
587
|
+
"model": model,
|
|
588
|
+
"prompt": prompt,
|
|
589
|
+
"max_tokens": max_tokens,
|
|
590
|
+
"temperature": temperature,
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
if stop_sequence:
|
|
594
|
+
payload["stop"] = stop_sequence
|
|
595
|
+
|
|
596
|
+
try:
|
|
597
|
+
response = await client.post("/v1/completions", json=payload, headers=headers, timeout=60)
|
|
598
|
+
|
|
599
|
+
# Read the response content
|
|
600
|
+
content = await response.aread()
|
|
601
|
+
result = json.loads(content.decode())
|
|
602
|
+
payment_hash = ""
|
|
603
|
+
|
|
604
|
+
if X402_PROCESSING_HASH_HEADER in response.headers:
|
|
605
|
+
payment_hash = response.headers[X402_PROCESSING_HASH_HEADER]
|
|
606
|
+
|
|
607
|
+
return TextGenerationOutput(
|
|
608
|
+
transaction_hash="external",
|
|
609
|
+
completion_output=result.get("completion"),
|
|
610
|
+
payment_hash=payment_hash
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
except Exception as e:
|
|
614
|
+
error_msg = f"External LLM completion request failed: {str(e)}"
|
|
615
|
+
logging.error(error_msg)
|
|
616
|
+
raise OpenGradientError(error_msg)
|
|
617
|
+
|
|
618
|
+
try:
|
|
619
|
+
# Run the async function in a sync context
|
|
620
|
+
return asyncio.run(make_request())
|
|
621
|
+
except Exception as e:
|
|
535
622
|
error_msg = f"External LLM completion failed: {str(e)}"
|
|
536
623
|
if hasattr(e, 'response') and e.response is not None:
|
|
537
624
|
try:
|
|
@@ -544,7 +631,7 @@ class Client:
|
|
|
544
631
|
|
|
545
632
|
def llm_chat(
|
|
546
633
|
self,
|
|
547
|
-
model_cid: str,
|
|
634
|
+
model_cid: str,
|
|
548
635
|
messages: List[Dict],
|
|
549
636
|
inference_mode: LlmInferenceMode = LlmInferenceMode.VANILLA,
|
|
550
637
|
max_tokens: int = 100,
|
|
@@ -577,7 +664,11 @@ class Client:
|
|
|
577
664
|
OpenGradientError: If the inference fails.
|
|
578
665
|
"""
|
|
579
666
|
# Check if this is a local model or external
|
|
580
|
-
|
|
667
|
+
# TODO (Kyle): separate TEE and Vanilla completion requests
|
|
668
|
+
if inference_mode == LlmInferenceMode.TEE:
|
|
669
|
+
if model_cid not in TEE_LLM:
|
|
670
|
+
return OpenGradientError("That model CID is not supported yet for TEE inference")
|
|
671
|
+
|
|
581
672
|
return self._external_llm_chat(
|
|
582
673
|
model=model_cid,
|
|
583
674
|
messages=messages,
|
|
@@ -590,11 +681,11 @@ class Client:
|
|
|
590
681
|
|
|
591
682
|
# Original local model logic
|
|
592
683
|
def execute_transaction():
|
|
593
|
-
if inference_mode != LlmInferenceMode.VANILLA
|
|
684
|
+
if inference_mode != LlmInferenceMode.VANILLA:
|
|
594
685
|
raise OpenGradientError("Invalid inference mode %s: Inference mode must be VANILLA or TEE" % inference_mode)
|
|
595
|
-
|
|
596
|
-
if
|
|
597
|
-
raise OpenGradientError("That model CID is not
|
|
686
|
+
|
|
687
|
+
if model_cid not in [llm.value for llm in LLM]:
|
|
688
|
+
raise OpenGradientError("That model CID is not yet supported for inference")
|
|
598
689
|
|
|
599
690
|
contract = self._blockchain.eth.contract(address=self._inference_hub_contract_address, abi=self._inference_abi)
|
|
600
691
|
|
|
@@ -663,7 +754,7 @@ class Client:
|
|
|
663
754
|
tool_choice: Optional[str] = None,
|
|
664
755
|
) -> TextGenerationOutput:
|
|
665
756
|
"""
|
|
666
|
-
Route chat request to external LLM server.
|
|
757
|
+
Route chat request to external LLM server with x402 payments.
|
|
667
758
|
|
|
668
759
|
Args:
|
|
669
760
|
model: Model identifier
|
|
@@ -680,40 +771,110 @@ class Client:
|
|
|
680
771
|
Raises:
|
|
681
772
|
OpenGradientError: If request fails
|
|
682
773
|
"""
|
|
683
|
-
url = f"{self._llm_server_url}/v1/chat/completions"
|
|
684
|
-
|
|
685
|
-
headers = {"Content-Type": "application/json"}
|
|
686
774
|
api_key = self._get_api_key_for_model(model)
|
|
775
|
+
|
|
687
776
|
if api_key:
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
payload = {
|
|
691
|
-
"model": model,
|
|
692
|
-
"messages": messages,
|
|
693
|
-
"max_tokens": max_tokens,
|
|
694
|
-
"temperature": temperature,
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
if stop_sequence:
|
|
698
|
-
payload["stop"] = stop_sequence
|
|
699
|
-
|
|
700
|
-
if tools:
|
|
701
|
-
payload["tools"] = tools
|
|
702
|
-
payload["tool_choice"] = tool_choice or "auto"
|
|
703
|
-
|
|
704
|
-
try:
|
|
705
|
-
response = requests.post(url, json=payload, headers=headers, timeout=60)
|
|
706
|
-
response.raise_for_status()
|
|
777
|
+
logging.debug("External LLM completion using API key")
|
|
778
|
+
url = f"{self._llm_server_url}/v1/chat/completions"
|
|
707
779
|
|
|
708
|
-
|
|
780
|
+
headers = {
|
|
781
|
+
"Content-Type": "application/json",
|
|
782
|
+
"Authorization": f"Bearer {api_key}"
|
|
783
|
+
}
|
|
709
784
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
785
|
+
payload = {
|
|
786
|
+
"model": model,
|
|
787
|
+
"messages": messages,
|
|
788
|
+
"max_tokens": max_tokens,
|
|
789
|
+
"temperature": temperature,
|
|
790
|
+
}
|
|
715
791
|
|
|
716
|
-
|
|
792
|
+
if stop_sequence:
|
|
793
|
+
payload["stop"] = stop_sequence
|
|
794
|
+
|
|
795
|
+
if tools:
|
|
796
|
+
payload["tools"] = tools
|
|
797
|
+
payload["tool_choice"] = tool_choice or "auto"
|
|
798
|
+
|
|
799
|
+
try:
|
|
800
|
+
response = requests.post(url, json=payload, headers=headers, timeout=60)
|
|
801
|
+
response.raise_for_status()
|
|
802
|
+
|
|
803
|
+
result = response.json()
|
|
804
|
+
|
|
805
|
+
return TextGenerationOutput(
|
|
806
|
+
transaction_hash="external",
|
|
807
|
+
finish_reason=result.get("finish_reason"),
|
|
808
|
+
chat_output=result.get("message")
|
|
809
|
+
)
|
|
810
|
+
|
|
811
|
+
except requests.RequestException as e:
|
|
812
|
+
error_msg = f"External LLM chat failed: {str(e)}"
|
|
813
|
+
if hasattr(e, 'response') and e.response is not None:
|
|
814
|
+
try:
|
|
815
|
+
error_detail = e.response.json()
|
|
816
|
+
error_msg += f" - {error_detail}"
|
|
817
|
+
except:
|
|
818
|
+
error_msg += f" - {e.response.text}"
|
|
819
|
+
logging.error(error_msg)
|
|
820
|
+
raise OpenGradientError(error_msg)
|
|
821
|
+
|
|
822
|
+
async def make_request():
|
|
823
|
+
async with x402HttpxClient(
|
|
824
|
+
account=self._wallet_account,
|
|
825
|
+
base_url=self._og_llm_server_url,
|
|
826
|
+
payment_requirements_selector=self._og_payment_selector,
|
|
827
|
+
) as client:
|
|
828
|
+
headers = {
|
|
829
|
+
"Content-Type": "application/json",
|
|
830
|
+
"Authorization": f"Bearer {X402_PLACEHOLDER_API_KEY}"
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
payload = {
|
|
834
|
+
"model": model,
|
|
835
|
+
"messages": messages,
|
|
836
|
+
"max_tokens": max_tokens,
|
|
837
|
+
"temperature": temperature,
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
if stop_sequence:
|
|
841
|
+
payload["stop"] = stop_sequence
|
|
842
|
+
|
|
843
|
+
if tools:
|
|
844
|
+
payload["tools"] = tools
|
|
845
|
+
payload["tool_choice"] = tool_choice or "auto"
|
|
846
|
+
|
|
847
|
+
try:
|
|
848
|
+
response = await client.post("/v1/chat/completions", json=payload, headers=headers, timeout=60)
|
|
849
|
+
|
|
850
|
+
# Read the response content
|
|
851
|
+
content = await response.aread()
|
|
852
|
+
result = json.loads(content.decode())
|
|
853
|
+
|
|
854
|
+
payment_hash = ""
|
|
855
|
+
if X402_PROCESSING_HASH_HEADER in response.headers:
|
|
856
|
+
payment_hash = response.headers[X402_PROCESSING_HASH_HEADER]
|
|
857
|
+
|
|
858
|
+
choices = result.get("choices")
|
|
859
|
+
if not choices:
|
|
860
|
+
raise OpenGradientError(f"Invalid response: 'choices' missing or empty in {result}")
|
|
861
|
+
|
|
862
|
+
return TextGenerationOutput(
|
|
863
|
+
transaction_hash="external",
|
|
864
|
+
finish_reason=choices[0].get("finish_reason"),
|
|
865
|
+
chat_output=choices[0].get("message"),
|
|
866
|
+
payment_hash=payment_hash
|
|
867
|
+
)
|
|
868
|
+
|
|
869
|
+
except Exception as e:
|
|
870
|
+
error_msg = f"External LLM chat request failed: {str(e)}"
|
|
871
|
+
logging.error(error_msg)
|
|
872
|
+
raise OpenGradientError(error_msg)
|
|
873
|
+
|
|
874
|
+
try:
|
|
875
|
+
# Run the async function in a sync context
|
|
876
|
+
return asyncio.run(make_request())
|
|
877
|
+
except Exception as e:
|
|
717
878
|
error_msg = f"External LLM chat failed: {str(e)}"
|
|
718
879
|
if hasattr(e, 'response') and e.response is not None:
|
|
719
880
|
try:
|
opengradient/defaults.py
CHANGED
|
@@ -8,4 +8,5 @@ DEFAULT_SCHEDULER_ADDRESS = "0x7179724De4e7FF9271FA40C0337c7f90C0508eF6"
|
|
|
8
8
|
DEFAULT_BLOCKCHAIN_EXPLORER = "https://explorer.opengradient.ai/tx/"
|
|
9
9
|
DEFAULT_IMAGE_GEN_HOST = "18.217.25.69"
|
|
10
10
|
DEFAULT_IMAGE_GEN_PORT = 5125
|
|
11
|
-
DEFAULT_LLM_SERVER_URL = "http://35.225.197.84:8000"
|
|
11
|
+
DEFAULT_LLM_SERVER_URL = "http://35.225.197.84:8000"
|
|
12
|
+
DEFAULT_OPENGRADIENT_LLM_SERVER_URL = "https://llm.opengradient.ai"
|
opengradient/types.py
CHANGED
|
@@ -151,6 +151,9 @@ class TextGenerationOutput:
|
|
|
151
151
|
completion_output: Optional[str] = None
|
|
152
152
|
"""Raw text output from completion-style generation. Empty string if not applicable."""
|
|
153
153
|
|
|
154
|
+
payment_hash: Optional[str] = None
|
|
155
|
+
"""Payment hash for x402 transaction"""
|
|
156
|
+
|
|
154
157
|
|
|
155
158
|
@dataclass
|
|
156
159
|
class AbiFunction:
|
|
@@ -190,18 +193,65 @@ class Abi:
|
|
|
190
193
|
class LLM(str, Enum):
|
|
191
194
|
"""Enum for available LLM models"""
|
|
192
195
|
|
|
196
|
+
# Existing open-source OG hosted models
|
|
193
197
|
META_LLAMA_3_8B_INSTRUCT = "meta-llama/Meta-Llama-3-8B-Instruct"
|
|
194
198
|
LLAMA_3_2_3B_INSTRUCT = "meta-llama/Llama-3.2-3B-Instruct"
|
|
195
199
|
QWEN_2_5_72B_INSTRUCT = "Qwen/Qwen2.5-72B-Instruct"
|
|
196
200
|
META_LLAMA_3_1_70B_INSTRUCT = "meta-llama/Llama-3.1-70B-Instruct"
|
|
197
201
|
DOBBY_UNHINGED_3_1_8B = "SentientAGI/Dobby-Mini-Unhinged-Llama-3.1-8B"
|
|
198
202
|
DOBBY_LEASHED_3_1_8B = "SentientAGI/Dobby-Mini-Leashed-Llama-3.1-8B"
|
|
199
|
-
|
|
203
|
+
|
|
204
|
+
# OpenAI models via TEE
|
|
205
|
+
GPT_4_1_2025_04_14 = "gpt-4.1-2025-04-14"
|
|
206
|
+
GPT_4O = "gpt-4o"
|
|
207
|
+
O4_MINI = "o4-mini"
|
|
208
|
+
|
|
209
|
+
# Anthropic models via TEE
|
|
210
|
+
CLAUDE_3_7_SONNET = "claude-3.7-sonnet"
|
|
211
|
+
CLAUDE_3_5_HAIKU = "claude-3.5-haiku"
|
|
212
|
+
CLAUDE_4_0_SONNET = "claude-4.0-sonnet"
|
|
213
|
+
|
|
214
|
+
# Google models via TEE
|
|
215
|
+
GEMINI_2_5_FLASH = "gemini-2.5-flash"
|
|
216
|
+
GEMINI_2_5_PRO = "gemini-2.5-pro"
|
|
217
|
+
GEMINI_2_0_FLASH = "gemini-2.0-flash"
|
|
218
|
+
|
|
219
|
+
# xAI Grok models via TEE
|
|
220
|
+
GROK_3_MINI_BETA = "grok-3-mini-beta"
|
|
221
|
+
GROK_3_BETA = "grok-3-beta"
|
|
222
|
+
GROK_2_1212 = "grok-2-1212"
|
|
223
|
+
GROK_2_VISION_LATEST = "grok-2-vision-latest"
|
|
224
|
+
GROK_4_1_FAST = "grok-4.1-fast"
|
|
225
|
+
GROK_4_1_FAST_NON_REASONING = "grok-4-1-fast-non-reasoning"
|
|
200
226
|
|
|
201
227
|
class TEE_LLM(str, Enum):
|
|
202
228
|
"""Enum for LLM models available for TEE execution"""
|
|
203
|
-
|
|
204
|
-
|
|
229
|
+
|
|
230
|
+
# Existing (Currently turned off)
|
|
231
|
+
# META_LLAMA_3_1_70B_INSTRUCT = "meta-llama/Llama-3.1-70B-Instruct"
|
|
232
|
+
|
|
233
|
+
# OpenAI models via TEE
|
|
234
|
+
GPT_4_1_2025_04_14 = "gpt-4.1-2025-04-14"
|
|
235
|
+
GPT_4O = "gpt-4o"
|
|
236
|
+
O4_MINI = "o4-mini"
|
|
237
|
+
|
|
238
|
+
# Anthropic models via TEE
|
|
239
|
+
CLAUDE_3_7_SONNET = "claude-3.7-sonnet"
|
|
240
|
+
CLAUDE_3_5_HAIKU = "claude-3.5-haiku"
|
|
241
|
+
CLAUDE_4_0_SONNET = "claude-4.0-sonnet"
|
|
242
|
+
|
|
243
|
+
# Google models via TEE
|
|
244
|
+
GEMINI_2_5_FLASH = "gemini-2.5-flash"
|
|
245
|
+
GEMINI_2_5_PRO = "gemini-2.5-pro"
|
|
246
|
+
GEMINI_2_0_FLASH = "gemini-2.0-flash"
|
|
247
|
+
|
|
248
|
+
# xAI Grok models via TEE
|
|
249
|
+
GROK_3_MINI_BETA = "grok-3-mini-beta"
|
|
250
|
+
GROK_3_BETA = "grok-3-beta"
|
|
251
|
+
GROK_2_1212 = "grok-2-1212"
|
|
252
|
+
GROK_2_VISION_LATEST = "grok-2-vision-latest"
|
|
253
|
+
GROK_4_1_FAST = "grok-4.1-fast"
|
|
254
|
+
GROK_4_1_FAST_NON_REASONING = "grok-4-1-fast-non-reasoning"
|
|
205
255
|
|
|
206
256
|
|
|
207
257
|
@dataclass
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opengradient
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.1
|
|
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,6 +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
|
|
26
27
|
Dynamic: license-file
|
|
27
28
|
|
|
28
29
|
# OpenGradient Python SDK
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
opengradient/__init__.py,sha256=wVg0KTFNBl7RnZF9huR5-m_q1E7tO-YyQwY7AD9JFoc,12635
|
|
2
2
|
opengradient/account.py,sha256=5wrYpws_1lozjOFjLCTHtxgoxK-LmObDAaVy9eDcJY4,1145
|
|
3
3
|
opengradient/cli.py,sha256=QzjH_KS6TF8gm_L1otFWA-oHkJ5SSfizFoRn0xR0b70,29162
|
|
4
|
-
opengradient/client.py,sha256=
|
|
5
|
-
opengradient/defaults.py,sha256=
|
|
4
|
+
opengradient/client.py,sha256=46pj3l-JkQfdojoLh94na0kJIYIVwusTcDP5qi_nKwk,62004
|
|
5
|
+
opengradient/defaults.py,sha256=w8-dr5ciF2TGnqbm_ib0Yz4U0YL5ikpNqkcPVpmXzP8,673
|
|
6
6
|
opengradient/exceptions.py,sha256=88tfegboGtlehQcwhxsl6ZzhLJWZWlkf_bkHTiCtXpo,3391
|
|
7
|
-
opengradient/types.py,sha256=
|
|
7
|
+
opengradient/types.py,sha256=f4HiDnsNBHtsyLD6AlWihtSB93qTFmj72zOQFZRNK5k,7360
|
|
8
8
|
opengradient/utils.py,sha256=ZUq4OBIml2vsC0tRqus4Zwb_e3g4woo00apByrafuVw,8058
|
|
9
9
|
opengradient/abi/InferencePrecompile.abi,sha256=reepTHg6Q01UrFP0Gexc-JayplsvOLPfG7jrEZ-cV28,10197
|
|
10
10
|
opengradient/abi/PriceHistoryInference.abi,sha256=ZB3fZdx1kaFlp2wt1vTbTZZG1k8HPvmNtkG5Q8Bnajw,5098
|
|
@@ -27,9 +27,9 @@ opengradient/workflow_models/constants.py,sha256=viIkb_LGcfVprqQNaA80gBTj6cfYam0
|
|
|
27
27
|
opengradient/workflow_models/types.py,sha256=Z22hF6c8Y4D2GlzVEIBODGwsqSjSrQvUcpZ7R-mIJdI,409
|
|
28
28
|
opengradient/workflow_models/utils.py,sha256=ySfpuiOBqLTlfto6ZxZf2vc7K6RGIja0l4eaVm5AOzY,1503
|
|
29
29
|
opengradient/workflow_models/workflow_models.py,sha256=d4C_gs39DAfy4cdY9Ee6GMXpPfzwvKFpmxzK1A7LNgU,3900
|
|
30
|
-
opengradient-0.5.
|
|
31
|
-
opengradient-0.5.
|
|
32
|
-
opengradient-0.5.
|
|
33
|
-
opengradient-0.5.
|
|
34
|
-
opengradient-0.5.
|
|
35
|
-
opengradient-0.5.
|
|
30
|
+
opengradient-0.5.1.dist-info/licenses/LICENSE,sha256=xEcvQ3AxZOtDkrqkys2Mm6Y9diEnaSeQRKvxi-JGnNA,1069
|
|
31
|
+
opengradient-0.5.1.dist-info/METADATA,sha256=_Gi-TVU_xljBPwwS6J3olNQWul73Hy3Ak0tErnP1Ed0,3992
|
|
32
|
+
opengradient-0.5.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
33
|
+
opengradient-0.5.1.dist-info/entry_points.txt,sha256=yUKTaJx8RXnybkob0J62wVBiCp_1agVbgw9uzsmaeJc,54
|
|
34
|
+
opengradient-0.5.1.dist-info/top_level.txt,sha256=oC1zimVLa2Yi1LQz8c7x-0IQm92milb5ax8gHBHwDqU,13
|
|
35
|
+
opengradient-0.5.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|