From 4765c0a10ba131adeb4edc87cb95a8198339c1a4 Mon Sep 17 00:00:00 2001 From: Abbas Asad <168946441+Abbas-Asad@users.noreply.github.com> Date: Thu, 14 Aug 2025 21:11:46 +0500 Subject: [PATCH] Fix: Clarify random_number function docstring for inclusive range (in lifecycle_example.py) ## Summary Fixed an ambiguous docstring in the `random_number` function that could lead to confusion about whether the range is inclusive or exclusive of the maximum value. ## Problem The random_number function docstring was ambiguous, using "up to the provided maximum" which could be interpreted as either inclusive or exclusive of the maximum value. The implementation correctly uses `random.randint(0, max)` which generates numbers from 0 to max inclusive, matching the expected behavior based on usage in the example. ## Changes Made Changed the docstring from: ```python "Generate a random number up to the provided maximum." ``` To: ```python "Generate a random number from 0 to max (inclusive)." ``` This makes the behavior explicit and eliminates potential confusion for developers using this function. --- examples/basic/lifecycle_example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/basic/lifecycle_example.py b/examples/basic/lifecycle_example.py index 02ce449f4..a714c2c12 100644 --- a/examples/basic/lifecycle_example.py +++ b/examples/basic/lifecycle_example.py @@ -56,7 +56,7 @@ async def on_handoff( @function_tool def random_number(max: int) -> int: - """Generate a random number up to the provided max.""" + """Generate a random number from 0 to max (inclusive).""" return random.randint(0, max)