type: image
name: generateDiagramImage
image_model:
  model: google/gemini-3-pro-image-preview
  #  The cues that come with thought patterns are actually not obvious
  # thinkingConfig: 
  #   includeThoughts: true      
  # responseModalities: 
  #   - 'TEXT'
  #   - 'IMAGE'
  imageConfig:
    imageSize:
      $get: size
    aspectRatio:
      $get: ratio

instructions:
  - role: system
    url: ../../prompts/detail/diagram/generate-image-system.md
  - role: user
    url: ../../prompts/detail/diagram/generate-image-user.md

# Support image-to-image generation by passing existing image via input_file_key
# If existingImage is provided (array of mediaFile objects), it will be passed to the model
input_file_key: existingImage

input_schema:
  type: object
  properties:
    documentContent:
      type: string
      description: The full original document content
    documentSummary:
      type: string
      description: A comprehensive summary of the document content for diagram generation (preferred over documentContent if available)
    diagramType:
      type: string
      description: The type of diagram to generate (architecture, flowchart, guide, intro, sequence, network)
    diagramStyle:
      type: string
      description: The visual style for the diagram (modern, standard, hand-drawn, anthropomorphic, flat, minimalist, 3d)
    locale:
      type: string
      description: Language for diagram labels
      default: en
    size:
      type: string
      description: Size of the generated image (e.g., "1K", "2K")
      default: "1K"
    ratio:
      type: string
      description: Aspect ratio of the generated image (must match content flow direction)
      enum: ["1:1", "5:4", "4:3", "3:2", "16:9", "21:9"]
    aspectRatio:
      type: string
      description: Aspect ratio of the generated image (alias for ratio, used in prompt templates)
      enum: ["1:1", "5:4", "4:3", "3:2", "16:9", "21:9"]
    existingImage:
      type: array
      nullable: true
      description: Array of mediaFile objects for existing diagram image (for image-to-image generation). If provided, the model will use this as reference and update based on document content and feedback.
      items:
        type: object
        properties:
          type:
            type: string
            description: File type, should be "local"
          path:
            type: string
            description: Absolute path to the image file
          filename:
            type: string
            description: Image filename
          mimeType:
            type: string
            description: MIME type of the image (e.g., "image/png", "image/jpeg")
    useImageToImage:
      type: boolean
      description: Whether to use image-to-image generation mode. If true and existingImage is provided, the model will update the existing image based on document content and feedback.
      default: false
    feedback:
      type: string
      description: User feedback for diagram updates. Used in image-to-image mode to guide modifications.
      default: ""
  required:
    - documentContent
    - diagramType
    - diagramStyle
    - ratio
include_input_in_output: true

