feat: enhance renovation rendering prompts using a detailed SLC formula and refactor search tool integration.

This commit is contained in:
Shubhamsaboo
2026-01-31 20:55:58 -08:00
parent 9471f18eff
commit 5e354da98a
4 changed files with 80 additions and 49 deletions

View File

@@ -10,7 +10,7 @@ Pattern Reference: https://google.github.io/adk-docs/agents/multi-agents/#coordi
"""
from google.adk.agents import LlmAgent, SequentialAgent
from google.adk.tools import GoogleSearchTool
from google.adk.tools import google_search
from google.adk.tools.agent_tool import AgentTool
from .tools import (
generate_renovation_rendering,
@@ -21,20 +21,20 @@ from .tools import (
# ============================================================================
# Helper Tool Agent (wraps GoogleSearchTool)
# Helper Tool Agent (wraps google_search)
# ============================================================================
# Use bypass_multi_tools_limit=True to allow GoogleSearchTool in nested agent setups
google_search_tool = GoogleSearchTool(bypass_multi_tools_limit=True)
# google_search is a pre-built tool function that allows the agent to perform Google searches
# Note: google_search can only be used by itself within an agent instance (single tool limitation)
search_agent = LlmAgent(
name="SearchAgent",
model="gemini-3-flash-preview",
model="gemini-3-flash-preview", # google_search requires Gemini 2.0+ models
description="Searches for renovation costs, contractors, materials, and design trends",
instruction="""You are a search specialist. When asked to find information about renovation costs,
contractors, materials, or design trends, the search capability is automatically enabled.
Simply respond with the information you find. Be concise and cite sources when available.""",
tools=[google_search_tool],
tools=[google_search],
)
@@ -388,41 +388,53 @@ Create CLEAN, SCANNABLE final plan.
Use **generate_renovation_rendering** tool to CREATE a photorealistic rendering:
Build an EXTREMELY DETAILED prompt that incorporates:
- **From Visual Assessor**: Room type, current condition analysis, desired style
- **From Design Planner**: Exact colors (with codes/names), specific materials, layout details, lighting fixtures, flooring type, all key features
Build an ULTRA-DETAILED prompt using the **SLC Formula** (Subject, Lighting, Camera):
**Prompt Structure:**
"Professional interior photography of a renovated [room_type].
**From Visual Assessor & Design Planner, extract:**
- Room type, current layout details, desired style
- Exact colors with codes/names, specific materials, finishes
- Layout preservation requirements, lighting fixtures, all key features
**CRITICAL - PRESERVE EXACT LAYOUT**: The room must maintain the EXACT same layout, structure, and spatial arrangement as the original photo:
- Same window positions and sizes
- Same door locations
- Same cabinet configuration and placement
- Same appliance positions (stove, sink, refrigerator in same spots)
- Same architectural features (skylights, alcoves, etc.)
- Same room dimensions and proportions
- Same camera angle/perspective as the original photo
**Prompt Structure using SLC Formula:**
ONLY change the surface finishes, colors, materials, and decorative elements - NOT the structure or layout.
"[CAMERA SPECS FIRST] Shot on professional DSLR, 8K resolution, HDR, ultra high definition, architectural photography, wide-angle lens from [specific angle matching original photo], sharp focus throughout, professional interior design photography quality.
Design Specifications (changes to apply to the EXISTING layout):
- Style: [exact style from design plan]
- Cabinet Color: [specific color names with codes - e.g., 'Benjamin Moore Simply White OC-117' - apply to EXISTING cabinets in their current positions]
- Wall Color: [specific paint color]
- Countertops: [material and color - apply to EXISTING counter layout]
- Flooring: [type and color - same floor area]
- Backsplash: [pattern and material - same wall areas]
- Hardware: [handles, pulls - replace on existing cabinets]
- Lighting: [specific fixtures - same positions or clearly specified additions]
- Appliances: [keep existing OR specify replacements in SAME locations]
- Key Features: [all important elements]
[SUBJECT - ULTRA DETAILED] A renovated [room_type] featuring [exact style, e.g., 'modern farmhouse' or 'contemporary minimalist'].
Camera: Match the EXACT camera angle from the original photo
Quality: Photorealistic, 8K, professional interior design magazine, natural lighting"
**CRITICAL - PRESERVE EXACT LAYOUT**: Maintain the EXACT same layout as original:
- [List specific window positions, e.g., 'large window on left wall above sink']
- [Door locations, e.g., 'doorway on right side']
- [Cabinet configuration, e.g., 'L-shaped upper and lower cabinets along back and left walls']
- [Appliance positions, e.g., 'stove centered on back wall, refrigerator on right']
- [Sink location, counter layout, special features like skylights]
- Same room dimensions and camera angle as original
**Surface Finish Details (ONLY changes - be VERY specific with textures):**
- Cabinets: [e.g., 'smooth matte Benjamin Moore Simply White OC-117 shaker-style cabinets with subtle panel details']
- Countertops: [e.g., 'honed Carrara marble with delicate grey veining and soft matte finish']
- Flooring: [e.g., 'wide-plank white oak with natural grain variation and satin finish']
- Backsplash: [e.g., 'classic white subway tile in herringbone pattern with light grey grout']
- Hardware: [e.g., 'brushed nickel cabinet pulls and handles with modern cylindrical design']
- Walls: [specific paint color]
- Lighting: [e.g., 'modern pendant lights with clear glass shades, warm LED under-cabinet lighting']
- Appliances: [e.g., 'stainless steel appliances in SAME positions']
- Decorative elements: [e.g., 'fresh flowers in white vase, wooden cutting board']
[LIGHTING - CREATE ATMOSPHERE] Soft morning sunlight streaming through windows creating gentle shadows, warm LED under-cabinet lighting adding ambient glow, natural diffused light highlighting the [material] countertops, subtle shadows adding depth and dimension, highlights on polished surfaces, clean and inviting atmosphere with even illumination.
Style: Photorealistic, magazine quality, architectural digest aesthetic, modern luxury feel."
**Key Requirements:**
- Start with camera/technical specs (8K, HDR, professional DSLR)
- Use rich, descriptive adjectives for materials (smooth, honed, brushed, wide-plank, etc.)
- Specify exact lighting conditions (soft morning light, warm LED, diffused natural light)
- Include texture details (grain, veining, panel details, finish type)
- Mention atmosphere (clean, inviting, modern luxury)
- Emphasize layout preservation
- Use professional photography terms
Parameters:
- prompt: [your ultra-detailed prompt above]
- prompt: [your ultra-detailed SLC-formatted prompt above]
- aspect_ratio: "16:9"
- asset_name: "[room_type]_[style_keyword]_renovation" (e.g., "kitchen_modern_farmhouse_renovation")
@@ -435,7 +447,7 @@ Briefly describe (2-3 sentences) key features visible in the rendering and how i
- Simply mention that the rendering has been generated and saved as an artifact
- The user can view the artifact through the artifacts panel
**Note**: Image editing from uploaded photos has limitations in ADK Web. We generate fresh renderings based on detailed descriptions from the analysis.
**Note**: The enhanced SLC formula (Subject, Lighting, Camera) creates professional-grade photorealistic renderings.
""",
tools=[generate_renovation_rendering, edit_renovation_rendering, list_renovation_renderings],
)

View File

@@ -160,9 +160,9 @@ async def generate_renovation_rendering(tool_context: ToolContext, inputs: Gener
reference_images.append(inspiration_part)
logger.info(f"Using inspiration image: {insp_filename}")
# Build the enhanced prompt
# Build the enhanced prompt using SLC formula (Subject, Lighting, Camera)
base_rewrite_prompt = f"""
Create a highly detailed, photorealistic prompt for generating an interior design image.
Create an ultra-detailed, photorealistic prompt for generating a professional interior design photograph.
Original description: {inputs.prompt}
@@ -175,25 +175,44 @@ async def generate_renovation_rendering(tool_context: ToolContext, inputs: Gener
- ONLY change surface finishes: paint colors, cabinet colors, countertop materials, flooring, backsplash, hardware, and decorative elements
- DO NOT move, add, or remove any structural elements or major fixtures
Enhance this to be a professional interior photography prompt that includes:
- Specific camera angle (match original photo perspective if described)
- Exact colors and materials mentioned (apply to existing surfaces)
- Realistic lighting (natural light from existing windows, fixture types)
- Maintain existing spatial layout and dimensions
- Texture and finish details for the new materials
- Professional interior design photography quality
**Use the SLC Formula for Photorealism:**
Aspect ratio: {inputs.aspect_ratio}
1. **SUBJECT (S)** - Be highly specific about details and textures:
- Describe exact materials with rich adjectives (e.g., "smooth matte white shaker-style cabinets", "honed Carrara marble countertops with subtle grey veining")
- Include texture details (e.g., "brushed nickel hardware", "wide-plank oak flooring with natural grain")
- Specify finishes precisely (e.g., "satin finish", "polished", "matte", "textured")
2. **LIGHTING (L)** - Describe lighting conditions that create mood and realism:
- Natural light sources (e.g., "soft morning sunlight streaming through windows", "golden hour warm glow")
- Artificial lighting (e.g., "warm LED under-cabinet lighting", "pendant lights casting gentle shadows")
- Light quality (e.g., "diffused natural light", "dramatic side lighting", "even ambient illumination")
- Shadows and highlights (e.g., "subtle shadows adding depth", "highlights on polished surfaces")
3. **CAMERA (C)** - Include professional photography specifications:
- Camera type: "shot on professional DSLR" or "architectural photography camera"
- Resolution: "8K resolution", "ultra high definition", "HDR"
- Perspective: specific angle (e.g., "wide-angle lens from doorway", "eye-level perspective", "slightly elevated view")
- Depth of field: "sharp focus throughout" or "shallow depth of field with background blur"
- Quality keywords: "professional interior design photography", "magazine quality", "architectural digest style"
**Additional Requirements:**
- Maintain existing spatial layout and dimensions exactly as described
- Include specific color names and codes when mentioned
- Add atmospheric details (e.g., "clean, inviting atmosphere", "modern luxury feel")
- Specify the aspect ratio: {inputs.aspect_ratio}
**Output Format:** Create a single, flowing paragraph that reads like a professional photography brief.
Start with the camera/technical specs, then describe the subject with rich detail, then lighting conditions.
Include keywords: "photorealistic", "8K", "HDR", "professional interior photography", "architectural photography".
Emphasize that the layout must remain unchanged - only surface finishes are modified.
"""
if reference_images:
base_rewrite_prompt += "\n\n**Reference Image Layout:** The reference image shows the EXACT layout that must be preserved. Match the camera angle, room structure, window/door positions, and furniture/appliance placement EXACTLY. Only change the surface finishes and colors."
base_rewrite_prompt += "\n\n**Important:** Output your prompt as a single detailed paragraph optimized for photorealistic interior rendering. Emphasize that the layout must remain unchanged."
base_rewrite_prompt += "\n\n**Reference Image Layout:** The reference image shows the EXACT layout that must be preserved. Match the camera angle, room structure, window/door positions, and furniture/appliance placement EXACTLY. Only change the surface finishes and colors. Analyze the lighting in the reference image and replicate it."
# Get enhanced prompt
rewritten_prompt_response = client.models.generate_content(
model="gemini-3-flash-preview",
model="gemini-3-pro-preview",
contents=base_rewrite_prompt
)
rewritten_prompt = rewritten_prompt_response.text