Skip to content

Commit e7edfb8

Browse files
author
Mrityunjay Shukla
committed
fix: fixed seed value generation which got updated by mistake in last commit
1 parent 4638a99 commit e7edfb8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/strands_tools/generate_image.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import base64
5353
import json
5454
import os
55+
import random
5556
import re
5657
from typing import Any, List, Tuple
5758

@@ -81,7 +82,7 @@
8182
},
8283
"seed": {
8384
"type": "integer",
84-
"description": "Optional: Seed for deterministic generation (default: 2147483646)",
85+
"description": "Optional: Seed for deterministic generation (default: random)",
8586
},
8687
"cfg_scale": {
8788
"type": "number",
@@ -233,7 +234,7 @@ def generate_image(tool: ToolUse, **kwargs: Any) -> ToolResult:
233234
- prompt: The text prompt describing the desired image.
234235
- model_id: Optional model identifier.
235236
- region: Optional AWS region (default: from AWS_REGION env variable or us-west-2).
236-
- seed: Optional seed value (default: 2147483646).
237+
- seed: Optional seed value (default: random integer b/w O and 2147483646).
237238
- cfg_scale: Optional CFG scale value (default: 10).
238239
**kwargs: Additional keyword arguments (unused).
239240
@@ -296,7 +297,8 @@ def generate_image(tool: ToolUse, **kwargs: Any) -> ToolResult:
296297
}
297298

298299
# Get seed from input or use a default value that works for all models
299-
seed = tool_input.get("seed", 2147483646)
300+
# Keeping range's end to 2147483646 as this is the max seed value supported by Nova models
301+
seed = tool_input.get("seed", random.randint(0, 2147483646))
300302
cfg_scale = tool_input.get("cfg_scale", 10)
301303

302304
# Validate if the model is available in the specified region

0 commit comments

Comments
 (0)