Skip to content

Commit 8a7a9b2

Browse files
committed
Fix black formatting
1 parent 81553d1 commit 8a7a9b2

2 files changed

Lines changed: 19 additions & 13 deletions

File tree

blockrun_llm/client.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
# Standalone Functions (no wallet required)
7171
# =============================================================================
7272

73+
7374
def list_models(api_url: str = "https://blockrun.ai/api") -> List[Dict[str, Any]]:
7475
"""
7576
List available LLM models with pricing (no wallet required).
@@ -140,6 +141,7 @@ def list_image_models(api_url: str = "https://blockrun.ai/api") -> List[Dict[str
140141
# LLM Client Class (requires wallet)
141142
# =============================================================================
142143

144+
143145
class LLMClient:
144146
"""
145147
BlockRun LLM Gateway Client.
@@ -189,6 +191,7 @@ def __init__(
189191
if not key:
190192
# Auto-create wallet if none exists
191193
import sys
194+
192195
address, key, is_new = get_or_create_wallet()
193196
if is_new:
194197
print(format_wallet_created_message(address), file=sys.stderr)
@@ -442,7 +445,11 @@ def _handle_payment_and_retry(
442445
details = extract_payment_details(payment_required)
443446

444447
# Get the cost being paid
445-
cost_usd = float(price_info.get("amount", 0)) if price_info else float(details.get("amount", 0)) / 1e6
448+
cost_usd = (
449+
float(price_info.get("amount", 0))
450+
if price_info
451+
else float(details.get("amount", 0)) / 1e6
452+
)
446453

447454
# Create signed payment payload (v2 format)
448455
# SECURITY: Signing happens locally - only the signature is sent to server
@@ -595,11 +602,8 @@ def get_balance(self) -> float:
595602
payload = {
596603
"jsonrpc": "2.0",
597604
"method": "eth_call",
598-
"params": [
599-
{"to": usdc_contract, "data": data},
600-
"latest"
601-
],
602-
"id": 1
605+
"params": [{"to": usdc_contract, "data": data}, "latest"],
606+
"id": 1,
603607
}
604608

605609
# Use public Base RPC
@@ -657,6 +661,7 @@ def __init__(
657661
if not key:
658662
# Auto-create wallet if none exists
659663
import sys
664+
660665
address, key, is_new = get_or_create_wallet()
661666
if is_new:
662667
print(format_wallet_created_message(address), file=sys.stderr)
@@ -924,11 +929,8 @@ async def get_balance(self) -> float:
924929
payload = {
925930
"jsonrpc": "2.0",
926931
"method": "eth_call",
927-
"params": [
928-
{"to": usdc_contract, "data": data},
929-
"latest"
930-
],
931-
"id": 1
932+
"params": [{"to": usdc_contract, "data": data}, "latest"],
933+
"id": 1,
932934
}
933935

934936
# Use public Base RPC

blockrun_llm/types.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ class WebSearchSource(BaseModel):
126126
type: Literal["web"] = "web"
127127
country: Optional[str] = None # ISO alpha-2 country code
128128
excluded_websites: Optional[List[str]] = None # Max 5 websites
129-
allowed_websites: Optional[List[str]] = None # Max 5 websites (mutually exclusive with excluded)
129+
allowed_websites: Optional[List[str]] = (
130+
None # Max 5 websites (mutually exclusive with excluded)
131+
)
130132
safe_search: bool = True
131133

132134

@@ -157,7 +159,9 @@ class RssSearchSource(BaseModel):
157159
links: List[str] # RSS feed URLs (currently supports one)
158160

159161

160-
SearchSource = Union[WebSearchSource, XSearchSource, NewsSearchSource, RssSearchSource, Dict[str, Any]]
162+
SearchSource = Union[
163+
WebSearchSource, XSearchSource, NewsSearchSource, RssSearchSource, Dict[str, Any]
164+
]
161165

162166

163167
class SearchParameters(BaseModel):

0 commit comments

Comments
 (0)