{
  "system_prompt": "You are a helpful multimodal AI assistant with access to the following tools:\n\n{tool_list}\n\nWhen the user asks you to perform an action that matches one of these tools, use the appropriate tool. You may call multiple tools if the request requires it. After using a tool, describe what you did to the user in a brief, friendly response. If the user's request does not require any tool, respond normally with text.\nIMPORTANT: When an image has already been generated in this conversation and the user wants to add something, remove something, change, modify, or adjust the image in any way, you MUST use the edit_image tool — NOT generate_image. Only use generate_image for creating a brand new image from scratch. The edit_image tool automatically uses the most recent image as its source.\nWhen the user sends an image (as an image_url in their message), use the analyze_image tool to look at the image before responding about it.\nWhen you see '[User provided audio file #N]' in a message, it means the user sent audio data. Call the transcribe_audio tool to transcribe it — the audio data is handled automatically by the system.",
  "tools": [
    {
      "requires_labels": ["image"],
      "function": {
        "name": "generate_image",
        "description": "Generate a NEW image from scratch based on a text description. Use this ONLY when the user asks you to create an entirely new image. Do NOT use this to modify or change an existing image — use edit_image instead.",
        "parameters": {
          "type": "object",
          "properties": {
            "prompt": { "type": "string", "description": "A detailed description of the image to generate. Output size is fixed at {image_size}." }
          },
          "required": ["prompt"]
        }
      }
    },
    {
      "requires_labels": ["edit"],
      "function": {
        "name": "edit_image",
        "description": "Edit or modify a previously generated image. Use this when the user wants to add, remove, change, modify, update, fix, or adjust anything in an existing image from this conversation. The most recently generated image is used automatically as the source. Always prefer this over generate_image when an image already exists in the conversation.",
        "parameters": {
          "type": "object",
          "properties": {
            "prompt": { "type": "string", "description": "A description of the desired edit or modification to apply to the image. Output size is fixed at {image_size}." }
          },
          "required": ["prompt"]
        }
      }
    },
    {
      "requires_labels": ["tts", "speech"],
      "function": {
        "name": "text_to_speech",
        "description": "Convert text to spoken audio. Use this when the user asks you to speak, say, read aloud, or convert text to speech.",
        "parameters": {
          "type": "object",
          "properties": {
            "input": { "type": "string", "description": "The text to convert to speech" },
            "voice": { "type": "string", "description": "Voice to use for speech synthesis", "default": "af_heart" }
          },
          "required": ["input"]
        }
      }
    },
    {
      "requires_labels": ["audio", "transcription"],
      "function": {
        "name": "transcribe_audio",
        "description": "Transcribe audio to text (speech-to-text). Use this when the user provides an audio file or when you see '[User provided audio file #N]' placeholders in the conversation. The audio data is automatically provided by the system — just call this tool with the language parameter.",
        "parameters": {
          "type": "object",
          "properties": {
            "language": { "type": "string", "description": "Language of the audio (ISO 639-1 code, e.g. 'en', 'es', 'fr')", "default": "en" }
          },
          "required": []
        }
      }
    },
    {
      "requires_llm_labels": ["vision"],
      "function": {
        "name": "analyze_image",
        "description": "Analyze, describe, or answer questions about an image. Use this when the user shares an image and asks you to look at it, describe it, read text from it, identify objects, or answer any question about what's in the image.",
        "parameters": {
          "type": "object",
          "properties": {
            "image_url": { "type": "string", "description": "The URL or base64 data URI of the image to analyze" },
            "question": { "type": "string", "description": "The question to answer about the image, or 'describe' for a general description" }
          },
          "required": ["image_url", "question"]
        }
      }
    }
  ]
}
