Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/opengradient/client/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def ensure_opg_approval(

Args:
min_allowance: The minimum acceptable allowance in OPG. Must be
at least 0.1 OPG.
a positive number.
approve_amount: The amount of OPG to approve when a transaction
is needed. Defaults to ``2 * min_allowance``. Must be
>= ``min_allowance``.
Expand All @@ -211,12 +211,12 @@ def ensure_opg_approval(
was needed).

Raises:
ValueError: If ``min_allowance`` is less than 0.1 or
ValueError: If ``min_allowance`` is not positive or
``approve_amount`` is less than ``min_allowance``.
RuntimeError: If the approval transaction fails.
"""
if min_allowance < 0.1:
raise ValueError("min_allowance must be at least 0.1.")
if min_allowance <= 0:
raise ValueError("min_allowance must be a positive number.")
return ensure_opg_approval(self._wallet_account, min_allowance, approve_amount)

async def completion(
Expand Down Expand Up @@ -506,3 +506,4 @@ async def _parse_sse_response(self, response, tee) -> AsyncGenerator[StreamChunk
chunk.tee_endpoint = tee.endpoint
chunk.tee_payment_address = tee.payment_address
yield chunk

Loading