diff --git a/terminal_helpers/api_snippet_to_json.py b/terminal_helpers/api_snippet_to_json.py index 9c07a69..c61c7e3 100644 --- a/terminal_helpers/api_snippet_to_json.py +++ b/terminal_helpers/api_snippet_to_json.py @@ -14,10 +14,6 @@ import os COMPONENTS = Path(__file__).parent.absolute() PRIMERE_ROOT = COMPONENTS.parent -if str(PRIMERE_ROOT) not in sys.path: - sys.path.insert(0, str(PRIMERE_ROOT)) - -from components.API.external_api_backend import canonical_param_name class SnippetParseError(RuntimeError): """Raised when call extraction fails.""" @@ -37,7 +33,7 @@ KNOWN_PARAM_OPTIONS: dict[str, list[str]] = { TYPE_MARKERS = {"INT", "FLOAT", "STRING", "BOOLEAN"} INLINE_PLACEHOLDER_RE = re.compile(r"(? set[str]: walk(node) return found -'''def _canonical_param_name(name: str) -> str: - low = name.lower() +def canonical_param_name(name: str, *, number_of_images_as_seed: bool = False) -> str: + low = str(name or "").lower() if "aspect_ratio" in low: return "aspect_ratio" if "resolution" in low or "image_size" in low: return "resolution" if low == "model" or low.endswith("_model"): return "model" - if low == "number_of_images": + if number_of_images_as_seed and low == "number_of_images": return "seed" if low in {"prompt", "contents"} or low.endswith("_prompt"): return "prompt" if "response_modalities" in low: return "response_modalities" - return name''' + return str(name) def _collect_type_markers(node: ast.AST) -> dict[str, str]: marked: dict[str, str] = {} diff --git a/terminal_helpers/result.json b/terminal_helpers/result.json index e29715b..e46a849 100644 --- a/terminal_helpers/result.json +++ b/terminal_helpers/result.json @@ -1,9 +1,9 @@ { "Gemini": { - "Nano2": { + "Imagen": { "provider": "Gemini", - "service": "Nano2", - "response_handler": "Gemini_Nano2.py", + "service": "Imagen", + "response_handler": "Gemini_Imagen.py", "import_modules": [ "import your_provider_sdk", "from your_provider_sdk import types" @@ -14,7 +14,6 @@ "fake_aspect_ratio_value_2" ], "resolution": [ - "512px", "1K", "2K", "4K" @@ -33,7 +32,6 @@ "$args": [], "$kwargs": { "response_modalities": [ - "TEXT", "IMAGE" ], "image_config": { diff --git a/terminal_helpers/snippet.py b/terminal_helpers/snippet.py index 8c8f4c2..0ac5a25 100644 --- a/terminal_helpers/snippet.py +++ b/terminal_helpers/snippet.py @@ -2,7 +2,7 @@ response = client.models.generate_content( model="gemini-3.1-flash-image-preview", contents=prompt, config=types.GenerateContentConfig( - response_modalities=['TEXT', 'IMAGE'], + response_modalities=['IMAGE'], image_config=types.ImageConfig( aspect_ratio=aspect_ratio, image_size=resolution