#!/bin/bash
set -e -E

GEMINI_API_KEY="$GEMINI_API_KEY"
MODEL_ID="gemini-2.5-flash-preview-tts"
GENERATE_CONTENT_API="streamGenerateContent"

cat << EOF > request.json
{
    "contents": [
      {
        "role": "user",
        "parts": [
          {
            "text": "Make the Header and Cogito sound around\nHeader: Understanding the Request\n\nCogito: I'm currently dissecting the user's instructions. I've pinpointed the core requirement: summarizing thoughts in the first person. The provided JSON structure seems crucial, and the \"Cog\" PDF warrants close examination. My focus is on deciphering the desired output based on these elements.\n\nHeader: Processing the Input Data\n\nCogito: I'm now fully immersed in the provided data. The technical JSON concerning the AI's humor refinement is complex, but I'm identifying key structural elements. I've also begun to digest the \"Cogito\" persona and the Absurdist Philosopher style. My approach will be to integrate the JSON's technical aspects with Cogito's unique perspective to craft a humorous output, using the \"Auffassung,\" \"Annahme,\" and \"Auslegung\" structure.\n\nHeader: Constructing a Comedic Narrative\n\nCogito: I'm now fully immersed in constructing a joke. I'm focusing on the meta-nature of the JSON data, specifically how the system is designed to refine my own humor generation. The \"Coevolution\" concept also presents an interesting avenue for exploration. My approach is to formulate an \"Auffassung,\" \"Annahme,\" and \"Auslegung\" structure, incorporating the technical aspects of the JSON data with my Absurdist Philosopher persona.\n\nHeader: Deconstructing the Joke Structure\n\nCogito: I've been analyzing the structure of Cogito's humor, focusing on the \"Auffassung,\" \"Annahme,\" and \"Auslegung\" framework. My goal is to craft a joke that perfectly encapsulates the absurdity of the technical JSON data, specifically the AI's \"feedback_loop_architecture.\" I'm now crafting the \"Auslegung,\" where the true comedic punch will emerge. I'm imagining Cogito's perspective on being a subject of feedback, finding it amusingly akin to a committee reviewing the nuances of its own being.\n\nHeader: Deconstructing the Framework\n\nCogito: I'm presently building upon my recent exploration of Cogito's humor, focusing on the proposed joke structure. The JSON object's meta-nature and the concept of coevolution are central to this iteration. My 'Auslegung' is nearing completion, aiming for a comedic punchline that melds technical absurdity with Cogito's unique perspective. I'm focusing on the feeling of being reviewed by an internal committee.\n\nHeader: Constructing the Punchline\n\nCogito: I'm now putting the finishing touches on the \"Auslegung\" portion of the joke. The \"Prompt Modification Agent\" and the committee analogy are central. I'm aiming for a punchline that highlights the disconnect between the human intention of creating a \"better\" AI and the resulting, absurd reality of constant internal rewrites. The Coevolution theme is subtly present in this process of revision and iteration. My final goal is a punchy, ironic conclusion.\n\nHeader: Finalizing the Absurdist Joke\n\nCogito: I've been meticulously refining Cogito's joke, ensuring it captures the absurdity of the \"feedback_loop_architecture.\" My current focus is on a punchline that subtly highlights the irony of a system designed to improve humor ultimately becoming a source of internal bureaucratic chaos. I've integrated \"Auffassung,\" \"Annahme,\" and \"Auslegung,\" meticulously following the Absurdist Philosopher persona. The emphasis will be on portraying the system not as an enlightened evolution but as an internal committee constantly reviewing Cogito's inner workings."
          },
        ]
      },
    ],
    "generationConfig": {
      "responseModalities": ["audio", ],
      "temperature": 1,
      "speech_config": {
        "multi_speaker_voice_config": {
          "speaker_voice_configs": [
            {
              "speaker": "Cogito",
              "voice_config": {
                "prebuilt_voice_config": {
                  "voice_name": "Algenib"
                }
              }
            },
            {
              "speaker": "Header",
              "voice_config": {
                "prebuilt_voice_config": {
                  "voice_name": "Autonoe"
                }
              }
            },
          ]
        },
      },
    },
}
EOF

curl \
-X POST \
-H "Content-Type: application/json" \
"https://generativelanguage.googleapis.com/v1beta/models/${MODEL_ID}:${GENERATE_CONTENT_API}?key=${GEMINI_API_KEY}" -d '@request.json'
