From 34170ce2404f915a75b47100f282a487eda0ef8a Mon Sep 17 00:00:00 2001 From: AMATH <116212274+amathxbt@users.noreply.github.com> Date: Mon, 30 Mar 2026 22:40:38 +0100 Subject: [PATCH] fix: remove arbitrary 0.1 OPG floor from LLM.ensure_opg_approval(); validate positive only --- src/opengradient/client/llm.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/opengradient/client/llm.py b/src/opengradient/client/llm.py index ed54fd9..d02f762 100644 --- a/src/opengradient/client/llm.py +++ b/src/opengradient/client/llm.py @@ -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``. @@ -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( @@ -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 +