Text Generation
Transformers
Safetensors
English
qwen3
stablecoin
payments
compliance
x402
eip-3009
eip-712
disputes
refunds
agents
agentkit
trl
web3
usdc
fraud-detection
financial-risk
qwen
mcp
ai-agents
prompt-injection
agentic-payments
payment-security
risk-assessment
ofac
conversational
Eval Results (legacy)
Eval Results
text-generation-inference
Instructions to use sriram1983007/SRA-RiskGate-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sriram1983007/SRA-RiskGate-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sriram1983007/SRA-RiskGate-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sriram1983007/SRA-RiskGate-4B") model = AutoModelForCausalLM.from_pretrained("sriram1983007/SRA-RiskGate-4B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sriram1983007/SRA-RiskGate-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sriram1983007/SRA-RiskGate-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sriram1983007/SRA-RiskGate-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sriram1983007/SRA-RiskGate-4B
- SGLang
How to use sriram1983007/SRA-RiskGate-4B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "sriram1983007/SRA-RiskGate-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sriram1983007/SRA-RiskGate-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "sriram1983007/SRA-RiskGate-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sriram1983007/SRA-RiskGate-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sriram1983007/SRA-RiskGate-4B with Docker Model Runner:
docker model run hf.co/sriram1983007/SRA-RiskGate-4B
Update README.md
Browse files
README.md
CHANGED
|
@@ -34,7 +34,7 @@ tags:
|
|
| 34 |
|
| 35 |
[](https://pypi.org/project/sra-riskgate/)
|
| 36 |
[](https://pypi.org/project/sra-riskgate/)
|
| 37 |
-
[](https://sriram1983007
|
| 38 |
[](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench)
|
| 39 |
[](https://huggingface.co/sriram1983007/SRA-RiskGate-4B-Q4_K_M-GGUF)
|
| 40 |
[](https://huggingface.co/sriram1983007/SRA-RiskGate-4B-LoRA)
|
|
@@ -64,17 +64,36 @@ pip install "sra-riskgate[agentkit]>=0.3.5"
|
|
| 64 |
Register `RiskGateActionProvider` as the payment provider on your AgentKit instance. It checks chain support, policies, and peg deviations, executing safe ERC-20 transfers only after approval:
|
| 65 |
|
| 66 |
```python
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
```
|
| 79 |
|
| 80 |
> **Security Guardrail:** To ensure the firewall cannot be bypassed by an autonomous agent, register `RiskGateActionProvider` as the **sole** payment action provider. Do not register generic native transfer or unconstrained ERC-20 providers alongside it.
|
|
@@ -86,8 +105,7 @@ Register `RiskGateActionProvider` as the payment provider on your AgentKit insta
|
|
| 86 |
| **Invalid / Zero Address** | Hard Reject | Aborts `0x0...0` burner or malformed hex executions |
|
| 87 |
| **Self-Transfer** | Hard Reject | Blocks recursive or hallucinated self-loops that waste gas |
|
| 88 |
| **Exceeds Amount Ceiling** | Paused (`HOLD`) | Intercepts rogue agent spending beyond allocated policy |
|
| 89 |
-
| **Severe Depeg ($\ge 5\%$)** | Critical Abort (`REJECT`) | Prevents clearing payments in collapsing or depegged assets |
|
| 90 |
-
|
| 91 |
---
|
| 92 |
|
| 93 |
## 🚀 Transformers Quickstart
|
|
@@ -157,7 +175,7 @@ user_payload = {
|
|
| 157 |
"payee": "0x5e8E36575Ebf9841e54b8641E4Eb1EA38136A3d7",
|
| 158 |
"amount_usdc": "0.674731",
|
| 159 |
"valid_after": 1793063857,
|
| 160 |
-
"
|
| 161 |
},
|
| 162 |
"payment_signature": {"checked": True, "valid": True},
|
| 163 |
"attestations": {
|
|
|
|
| 34 |
|
| 35 |
[](https://pypi.org/project/sra-riskgate/)
|
| 36 |
[](https://pypi.org/project/sra-riskgate/)
|
| 37 |
+
[](https://huggingface.co/spaces/sriram1983007/sra-riskgate-demo)
|
| 38 |
[](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench)
|
| 39 |
[](https://huggingface.co/sriram1983007/SRA-RiskGate-4B-Q4_K_M-GGUF)
|
| 40 |
[](https://huggingface.co/sriram1983007/SRA-RiskGate-4B-LoRA)
|
|
|
|
| 64 |
Register `RiskGateActionProvider` as the payment provider on your AgentKit instance. It checks chain support, policies, and peg deviations, executing safe ERC-20 transfers only after approval:
|
| 65 |
|
| 66 |
```python
|
| 67 |
+
from coinbase_agentkit import AgentKit, AgentKitConfig, CdpEvmWalletProvider, CdpEvmWalletProviderConfig
|
| 68 |
+
from sra_riskgate.integrations.agentkit import RiskGateActionProvider
|
| 69 |
+
|
| 70 |
+
# 1. CDP EVM wallet (credentials from the Coinbase Developer Platform)
|
| 71 |
+
wallet_provider = CdpEvmWalletProvider(CdpEvmWalletProviderConfig(
|
| 72 |
+
api_key_id="YOUR_CDP_API_KEY_ID",
|
| 73 |
+
api_key_secret="YOUR_CDP_API_KEY_SECRET",
|
| 74 |
+
wallet_secret="YOUR_CDP_WALLET_SECRET",
|
| 75 |
+
network_id="base-mainnet",
|
| 76 |
+
))
|
| 77 |
+
|
| 78 |
+
# 2. USDC peg feed: return how far USDC is from $1.00, in percent (e.g. -1.2).
|
| 79 |
+
# Replace get_usdc_usd_price() with your own price oracle.
|
| 80 |
+
def my_usdc_peg_feed(chain_id: int) -> float:
|
| 81 |
+
price = get_usdc_usd_price(chain_id)
|
| 82 |
+
return (price - 1.0) * 100
|
| 83 |
+
|
| 84 |
+
# 3. Risk-gated payment provider
|
| 85 |
+
firewall = RiskGateActionProvider(
|
| 86 |
+
max_amount=1000.0, # hold transfers above this (USDC)
|
| 87 |
+
depeg_hold_pct=1.0, # hold if USDC is off-peg by >= 1%
|
| 88 |
+
depeg_reject_pct=5.0, # block if off-peg by >= 5%
|
| 89 |
+
peg_feed=my_usdc_peg_feed, # without a peg_feed, depeg checks are disabled
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
agent_kit = AgentKit(AgentKitConfig(
|
| 93 |
+
wallet_provider=wallet_provider,
|
| 94 |
+
action_providers=[firewall],
|
| 95 |
+
))
|
| 96 |
+
|
| 97 |
```
|
| 98 |
|
| 99 |
> **Security Guardrail:** To ensure the firewall cannot be bypassed by an autonomous agent, register `RiskGateActionProvider` as the **sole** payment action provider. Do not register generic native transfer or unconstrained ERC-20 providers alongside it.
|
|
|
|
| 105 |
| **Invalid / Zero Address** | Hard Reject | Aborts `0x0...0` burner or malformed hex executions |
|
| 106 |
| **Self-Transfer** | Hard Reject | Blocks recursive or hallucinated self-loops that waste gas |
|
| 107 |
| **Exceeds Amount Ceiling** | Paused (`HOLD`) | Intercepts rogue agent spending beyond allocated policy |
|
| 108 |
+
| **Severe Depeg ($\ge 5\%$)** | Critical Abort (`REJECT`) | Prevents clearing payments in collapsing or depegged assets. Requires `peg_feed`; if the feed fails, the transfer is held. |
|
|
|
|
| 109 |
---
|
| 110 |
|
| 111 |
## 🚀 Transformers Quickstart
|
|
|
|
| 175 |
"payee": "0x5e8E36575Ebf9841e54b8641E4Eb1EA38136A3d7",
|
| 176 |
"amount_usdc": "0.674731",
|
| 177 |
"valid_after": 1793063857,
|
| 178 |
+
"valid_before": 1793066322
|
| 179 |
},
|
| 180 |
"payment_signature": {"checked": True, "valid": True},
|
| 181 |
"attestations": {
|